From f4378f69200a35597984d885137a8e28714d4653 Mon Sep 17 00:00:00 2001 From: Jay Patel Date: Tue, 24 Feb 2015 12:17:54 -0600 Subject: [PATCH] Added Tax in Invoice Samples - Improvement to Sample code demonstrating how to add tax to Invoice Item. --- sample/doc/assets/behavior.js | 221 +++++++++++++++++++++----- sample/doc/invoice/CreateInvoice.html | 11 +- sample/invoice/CreateInvoice.php | 14 ++ 3 files changed, 205 insertions(+), 41 deletions(-) diff --git a/sample/doc/assets/behavior.js b/sample/doc/assets/behavior.js index 1e7cc05..7073b32 100644 --- a/sample/doc/assets/behavior.js +++ b/sample/doc/assets/behavior.js @@ -156,18 +156,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "billing/ListPlans", "title": "ListPlans" }, - "depth": 2, - "outline": [ - { - "type": "heading", - "data": { - "level": 1, - "title": "Get List of Plan Sample", - "slug": "get-list-of-plan-sample" - }, - "depth": 1 - } - ] + "depth": 2 }, { "type": "file", "data": { @@ -321,7 +310,96 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "invoice/CreateInvoice", "title": "CreateInvoice" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Create Invoice Sample", + "slug": "create-invoice-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Invoice Info", + "slug": "invoice-info" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Merchant Info", + "slug": "merchant-info" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Address Information", + "slug": "address-information" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Billing Information", + "slug": "billing-information" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Items List", + "slug": "items-list" + }, + "depth": 3, + "children": [ + { + "type": "heading", + "data": { + "level": 4, + "title": "Tax Item", + "slug": "tax-item" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Tax Item", + "slug": "tax-item" + }, + "depth": 4 + } + ] + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Shipping Information", + "slug": "shipping-information" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Create Invoice", + "slug": "create-invoice" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -547,18 +625,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "lipp/GetUserInfo", "title": "GetUserInfo" }, - "depth": 2, - "outline": [ - { - "type": "heading", - "data": { - "level": 3, - "title": "Obtain Access Token From Refresh Token", - "slug": "obtain-access-token-from-refresh-token" - }, - "depth": 3 - } - ] + "depth": 2 }, { "type": "file", "data": { @@ -576,18 +643,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "lipp/ObtainUserConsent", "title": "ObtainUserConsent" }, - "depth": 2, - "outline": [ - { - "type": "heading", - "data": { - "level": 3, - "title": "Get User Consent URL", - "slug": "get-user-consent-url" - }, - "depth": 3 - } - ] + "depth": 2 }, { "type": "file", "data": { @@ -1487,7 +1543,56 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "payouts/CreateSinglePayout", "title": "CreateSinglePayout" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Create Single Synchronous Payout Sample", + "slug": "create-single-synchronous-payout-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "NOTE:", + "slug": "note" + }, + "depth": 3, + "children": [ + { + "type": "heading", + "data": { + "level": 4, + "title": "Batch Header Instance", + "slug": "batch-header-instance" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item", + "slug": "sender-item" + }, + "depth": 4 + } + ] + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Create Payout", + "slug": "create-payout" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -1569,7 +1674,45 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "sale/RefundSale", "title": "RefundSale" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Sale Refund Sample", + "slug": "sale-refund-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Refund amount", + "slug": "refund-amount" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Refund object", + "slug": "refund-object" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Sale", + "slug": "sale" + }, + "depth": 3 + } + ] + } + ] } ] }, { diff --git a/sample/doc/invoice/CreateInvoice.html b/sample/doc/invoice/CreateInvoice.html index a75c1ea..2791f9d 100644 --- a/sample/doc/invoice/CreateInvoice.html +++ b/sample/doc/invoice/CreateInvoice.html @@ -50,7 +50,10 @@ detailed breakdown of invoice

$items[0]->getUnitPrice() ->setCurrency("USD") - ->setValue(5);

Second Item

$items[1] = new InvoiceItem(); + ->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);

Second Item

$items[1] = new InvoiceItem(); $items[1] ->setName("Injection") ->setQuantity(5) @@ -58,7 +61,11 @@ detailed breakdown of invoice

$items[1]->getUnitPrice() ->setCurrency("USD") - ->setValue(5); + ->setValue(5);

Tax Item

+

You could provide Tax information to each item.

$tax2 = new \PayPal\Api\Tax(); +$tax2->setPercent(3)->setName("Local Tax on Injection"); +$items[1]->setTax($tax2); + $invoice->setItems($items); $invoice->getPaymentTerm() diff --git a/sample/invoice/CreateInvoice.php b/sample/invoice/CreateInvoice.php index 1f38547..6562d7f 100644 --- a/sample/invoice/CreateInvoice.php +++ b/sample/invoice/CreateInvoice.php @@ -70,6 +70,13 @@ $items[0] $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); + // Second Item $items[1] = new InvoiceItem(); $items[1] @@ -80,6 +87,13 @@ $items[1] $items[1]->getUnitPrice() ->setCurrency("USD") ->setValue(5); + +// #### Tax Item +// You could provide Tax information to each item. +$tax2 = new \PayPal\Api\Tax(); +$tax2->setPercent(3)->setName("Local Tax on Injection"); +$items[1]->setTax($tax2); + $invoice->setItems($items); $invoice->getPaymentTerm()