getBillingInfo() public method

The required invoice recipient email address and any optional billing information. One recipient is supported.
public getBillingInfo ( ) : BillingInfo[]
return BillingInfo[]
Exemplo n.º 1
0
 /**
  * @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");
 }
Exemplo n.º 2
0
$invoice = new Invoice();
// ### Invoice Info
// Fill in all the information that is
// required for invoice APIs
$invoice->setMerchantInfo(new MerchantInfo())->setBillingInfo(array(new BillingInfo()))->setNote("Medical Invoice 16 Jul, 2013 PST")->setPaymentTerm(new PaymentTerm())->setShippingInfo(new ShippingInfo());
// ### 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("*****@*****.**");
$billing[0]->setBusinessName("Jay Inc")->setAdditionalInfo("This is the billing Info")->setAddress(new InvoiceAddress());
$billing[0]->getAddress()->setLine1("1234 Main St.")->setCity("Portland")->setState("OR")->setPostalCode("97217")->setCountryCode("US");
// ### Items List
// You could provide the list of all items for
// detailed breakdown of invoice
$items = array();
$items[0] = new InvoiceItem();
$items[0]->setName("Sutures")->setQuantity(100)->setUnitPrice(new Currency());
$items[0]->getUnitPrice()->setCurrency("USD")->setValue(5);
// #### Tax Item
// You could provide Tax information to each item.
$tax = new \PayPal\Api\Tax();
$tax->setPercent(1)->setName("Local Tax on Sutures");
$items[0]->setTax($tax);
Exemplo n.º 3
0
 public function createInvoice($params = null)
 {
     if (!$params) {
         return false;
     }
     $invoice = new Invoice();
     // ### Invoice Info
     // Fill in all the information that is
     // required for invoice APIs
     $invoice->setMerchantInfo(new MerchantInfo())->setBillingInfo(array(new BillingInfo()));
     // ### Merchant Info
     // A resource representing merchant information that can be
     // used to identify merchant
     $owner_email = $this->_credentials['business_owner'];
     $invoice->getMerchantInfo()->setEmail($owner_email);
     // ### Billing Information
     // Set the email address for each billing
     $billing = $invoice->getBillingInfo();
     $billing[0]->setEmail($params['email']);
     $items = [];
     foreach ($params['items'] as $key => $item) {
         # code...
         $items[$key] = new InvoiceItem();
         $items[$key]->setName($item['name'])->setQuantity($item['quantity'])->setUnitPrice(new Currency());
         $items[$key]->getUnitPrice()->setCurrency($params['currency'])->setValue((double) $item['price']);
     }
     // ### Items List
     $invoice->setItems($items);
     $request = clone $invoice;
     try {
         $invoice->create($this->config);
     } catch (\Exception $ex) {
         return $ex;
     }
     return $invoice;
 }