public function testSerializeDeserialize() { $p1 = $this->payee; $p2 = new Payee(); $p2->fromJson($p1->toJson()); $this->assertEquals($p1, $p2); }
/** * @depends testSerializationDeserialization * @param Payee $obj */ public function testGetters($obj) { $this->assertEquals($obj->getEmail(), "TestSample"); $this->assertEquals($obj->getMerchantId(), "TestSample"); $this->assertEquals($obj->getFirstName(), "TestSample"); $this->assertEquals($obj->getLastName(), "TestSample"); $this->assertEquals($obj->getAccountNumber(), "TestSample"); $this->assertEquals($obj->getPhone(), PhoneTest::getObject()); }
// ### Additional payment details // Use this optional field to set additional // payment information such as tax, shipping // charges etc. $details = new Details(); $details->setShipping(1.2)->setTax(1.3)->setSubtotal(17.5); // ### Amount // Lets you specify a payment amount. // You can also specify additional details // such as shipping, tax. $amount = new Amount(); $amount->setCurrency("USD")->setTotal(20)->setDetails($details); // ### Payee // Specify a payee with that user's email or merchant id // Merchant Id can be found at https://www.paypal.com/businessprofile/settings/ $payee = new Payee(); $payee->setEmail("*****@*****.**"); // ### Transaction // A transaction defines the contract of a // payment - what is the payment for and who // is fulfilling it. $transaction = new Transaction(); $transaction->setAmount($amount)->setItemList($itemList)->setDescription("Payment description")->setPayee($payee)->setInvoiceNumber(uniqid()); // ### Redirect urls // Set the urls that the buyer must be redirected to after // payment approval/ cancellation. $baseUrl = getBaseUrl(); $redirectUrls = new RedirectUrls(); $redirectUrls->setReturnUrl("{$baseUrl}/ExecutePayment.php?success=true")->setCancelUrl("{$baseUrl}/ExecutePayment.php?success=false"); // ### Payment // A Payment Resource; create one using
/** * @depends testSerializationDeserialization * @param Payee $obj */ public function testGetters($obj) { $this->assertEquals($obj->getEmail(), "TestSample"); $this->assertEquals($obj->getMerchantId(), "TestSample"); }