/** * @depends testSerializationDeserialization * @param Invoice $obj */ public function testGetters($obj) { $this->assertEquals($obj->getId(), "TestSample"); $this->assertEquals($obj->getNumber(), "TestSample"); $this->assertEquals($obj->getUri(), "TestSample"); $this->assertEquals($obj->getStatus(), "TestSample"); $this->assertEquals($obj->getMerchantInfo(), MerchantInfoTest::getObject()); $this->assertEquals($obj->getBillingInfo(), BillingInfoTest::getObject()); $this->assertEquals($obj->getShippingInfo(), ShippingInfoTest::getObject()); $this->assertEquals($obj->getItems(), InvoiceItemTest::getObject()); $this->assertEquals($obj->getInvoiceDate(), "TestSample"); $this->assertEquals($obj->getPaymentTerm(), PaymentTermTest::getObject()); $this->assertEquals($obj->getDiscount(), CostTest::getObject()); $this->assertEquals($obj->getShippingCost(), ShippingCostTest::getObject()); $this->assertEquals($obj->getCustom(), CustomAmountTest::getObject()); $this->assertEquals($obj->getTaxCalculatedAfterDiscount(), true); $this->assertEquals($obj->getTaxInclusive(), true); $this->assertEquals($obj->getTerms(), "TestSample"); $this->assertEquals($obj->getNote(), "TestSample"); $this->assertEquals($obj->getMerchantMemo(), "TestSample"); $this->assertEquals($obj->getLogoUrl(), "http://www.google.com"); $this->assertEquals($obj->getTotalAmount(), CurrencyTest::getObject()); $this->assertEquals($obj->getPayments(), PaymentDetailTest::getObject()); $this->assertEquals($obj->getRefunds(), RefundDetailTest::getObject()); $this->assertEquals($obj->getMetadata(), MetadataTest::getObject()); $this->assertEquals($obj->getAdditionalData(), "TestSample"); }
// ### Merchant Info // A resource representing merchant information that can be // used to identify merchant $invoice->getMerchantInfo()->setEmail("*****@*****.**")->setFirstName("Dennis")->setLastName("Doctor")->setbusinessName("Medical Professionals, LLC")->setPhone(new Phone())->setAddress(new Address()); $invoice->getMerchantInfo()->getPhone()->setCountryCode("001")->setNationalNumber("5032141716"); // ### Address Information // The address used for creating the invoice $invoice->getMerchantInfo()->getAddress()->setLine1("1234 Main St.")->setCity("Portland")->setState("OR")->setPostalCode("97217")->setCountryCode("US"); // ### Billing Information // Set the email address for each billing $billing = $invoice->getBillingInfo(); $billing[0]->setEmail("*****@*****.**"); // ### Items List // You could provide the list of all items for // detailed breakdown of invoice $items = $invoice->getItems(); $items[0]->setName("Sutures")->setQuantity(100)->setUnitPrice(new Currency()); $items[0]->getUnitPrice()->setCurrency("USD")->setValue(5); $invoice->getPaymentTerm()->setTermType("NET_45"); // ### Shipping Information $invoice->getShippingInfo()->setFirstName("Sally")->setLastName("Patient")->setBusinessName("Not applicable")->setPhone(new Phone())->setAddress(new Address()); $invoice->getShippingInfo()->getPhone()->setCountryCode("001")->setNationalNumber("5039871234"); $invoice->getShippingInfo()->getAddress()->setLine1("1234 Main St.")->setCity("Portland")->setState("OR")->setPostalCode("97217")->setCountryCode("US"); // For Sample Purposes Only. $request = clone $invoice; try { // ### Create Invoice // Create an invoice by calling the invoice->create() method // with a valid ApiContext (See bootstrap.php for more on `ApiContext`) $invoice->create($apiContext); } catch (Exception $ex) {