forked from LiveCarta/PayPal-PHP-SDK
Unit Tests and Functional Tests for Invoicing
- Updated Unit Tests for PPModels used by Invoicing - Updated Functional Tests - Updated Samples for quick changes.
This commit is contained in:
252
tests/PayPal/Test/Functional/Api/InvoiceFunctionalTest.php
Normal file
252
tests/PayPal/Test/Functional/Api/InvoiceFunctionalTest.php
Normal file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Functional\Api;
|
||||
use PayPal\Api\CancelNotification;
|
||||
use PayPal\Api\Invoice;
|
||||
use PayPal\Api\Notification;
|
||||
use PayPal\Api\PaymentDetail;
|
||||
use PayPal\Api\RefundDetail;
|
||||
use PayPal\Api\Search;
|
||||
|
||||
/**
|
||||
* Class Invoice
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public static $obj;
|
||||
|
||||
public $operation;
|
||||
|
||||
public $response;
|
||||
|
||||
public $mode = 'mock';
|
||||
|
||||
public $mockPPRestCall;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$className = $this->getClassName();
|
||||
$testName = $this->getName();
|
||||
$this->setupTest($className, $testName);
|
||||
}
|
||||
|
||||
public function setupTest($className, $testName)
|
||||
{
|
||||
$operationString = file_get_contents(__DIR__ . "/../resources/$className/$testName.json");
|
||||
$this->operation = json_decode($operationString, true);
|
||||
$this->response = true;
|
||||
if (array_key_exists('body', $this->operation['response'])) {
|
||||
$this->response = json_encode($this->operation['response']['body']);
|
||||
}
|
||||
|
||||
$this->mode = getenv('REST_MODE') ? getenv('REST_MODE') : 'mock';
|
||||
if ($this->mode != 'sandbox') {
|
||||
|
||||
// Mock PPRest Caller if mode set to mock
|
||||
$this->mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
$this->response
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns just the classname of the test you are executing. It removes the namespaces.
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return join('', array_slice(explode('\\', get_class($this)), -1));
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$obj = new Invoice($request);
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
self::$obj = $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testGet($invoice)
|
||||
{
|
||||
$result = Invoice::get($invoice->getId(), null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($invoice->getId(), $result->getId());
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testSend($invoice)
|
||||
{
|
||||
$result = $invoice->send(null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSend
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testUpdate($invoice)
|
||||
{
|
||||
$this->markTestSkipped('Skipped as the fix is on the way. #PPTIPS-1932');
|
||||
$result = $invoice->update(null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($invoice->getId(), $result->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSend
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testGetAll($invoice)
|
||||
{
|
||||
$result = Invoice::getAll(array('page_size' => '20', 'total_count_required' => 'true'), null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertNotNull($result->getTotalCount());
|
||||
$totalPages = ceil($result->getTotalCount()/20);
|
||||
$found = false;
|
||||
$foundObject = null;
|
||||
do {
|
||||
foreach ($result->getInvoices() as $obj) {
|
||||
if ($obj->getId() == $invoice->getId()) {
|
||||
$found = true;
|
||||
$foundObject = $obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
$result = Invoice::getAll(array('page' => --$totalPages, 'page_size' => '20', 'total_required' => 'yes'), null, $this->mockPPRestCall);
|
||||
|
||||
}
|
||||
} while ($totalPages > 0 && $found == false);
|
||||
$this->assertTrue($found, "The Created Invoice was not found in the get list");
|
||||
$this->assertEquals($invoice->getId(), $foundObject->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSend
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testSearch($invoice)
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$search = new Search($request);
|
||||
$result = Invoice::search($search, null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertNotNull($result->getTotalCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSend
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testRemind($invoice)
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$notification = new Notification($request);
|
||||
$result = $invoice->remind($notification, null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSend
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testCancel($invoice)
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$notification = new CancelNotification($request);
|
||||
$result = $invoice->cancel($notification, null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSend
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testQRCode($invoice)
|
||||
{
|
||||
$result = Invoice::qrCode($invoice->getId(), array(), null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertNotNull($result->getImage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSend
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testRecordPayment($invoice)
|
||||
{
|
||||
$this->setupTest($this->getClassName(), 'testCreate');
|
||||
$invoice = $this->testCreate($invoice);
|
||||
$this->setupTest($this->getClassName(), 'testSend');
|
||||
$invoice = $this->testSend($invoice);
|
||||
$this->setupTest($this->getClassName(), 'testRecordPayment');
|
||||
$request = $this->operation['request']['body'];
|
||||
$paymentDetail = new PaymentDetail($request);
|
||||
$result = $invoice->recordPayment($paymentDetail, null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @depends testRecordPayment
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testRecordRefund($invoice)
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$refundDetail = new RefundDetail($request);
|
||||
$result = $invoice->recordRefund($refundDetail, null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->setupTest($this->getClassName(), 'testDelete');
|
||||
$invoice = $this->testDelete($invoice);
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testGet
|
||||
* @param $invoice Invoice
|
||||
* @return Invoice
|
||||
*/
|
||||
public function testDelete($invoice)
|
||||
{
|
||||
$this->setupTest($this->getClassName(), 'testCreate');
|
||||
$invoice = $this->testCreate($invoice);
|
||||
$this->setupTest($this->getClassName(), 'testDelete');
|
||||
$result = $invoice->delete(null, $this->mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"operationId": "invoice.cancel",
|
||||
"title": "Cancel an invoice",
|
||||
"description": "Cancel an invoice",
|
||||
"runnable": true,
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-WW57-VFCD-X5H4-XTUP/cancel",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {
|
||||
"subject": "Past due",
|
||||
"note": "Canceling invoice",
|
||||
"send_to_merchant": true,
|
||||
"send_to_payer": true
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"headers": {},
|
||||
"status": ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
{
|
||||
"operationId": "invoice.create",
|
||||
"title": "Create an invoice",
|
||||
"description": "Create an invoice",
|
||||
"runnable": true,
|
||||
"user": {
|
||||
"scopes": [
|
||||
"https://uri.paypal.com/services/invoicing"
|
||||
]
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "stage2managed",
|
||||
"clientSecret": "secret",
|
||||
"path": "/v1/oauth2/token"
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {"merchant_info": {
|
||||
"email": "jaypatel512-facilitator@hotmail.com",
|
||||
"first_name": "Dennis",
|
||||
"last_name": "Doctor",
|
||||
"business_name": "Medical Professionals, LLC",
|
||||
"phone": {
|
||||
"country_code": "001",
|
||||
"national_number": "5032141716"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Main St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97217",
|
||||
"country_code": "US"
|
||||
}
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "example@example.com"
|
||||
}
|
||||
],
|
||||
"items": [
|
||||
{
|
||||
"name": "Sutures",
|
||||
"quantity": 100,
|
||||
"unit_price": {
|
||||
"currency": "USD",
|
||||
"value": "5.00"
|
||||
}
|
||||
}
|
||||
],
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"payment_term": {
|
||||
"term_type": "NET_45"
|
||||
},
|
||||
"shipping_info": {
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable",
|
||||
"phone": {
|
||||
"country_code": "001",
|
||||
"national_number": "5039871234"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Main St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97217",
|
||||
"country_code": "US"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": "201 Created",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"id": "INV2-RF6D-L66T-D7H2-CRU7",
|
||||
"number": "ABCD4971",
|
||||
"status": "DRAFT",
|
||||
"merchant_info": {
|
||||
"email": "ppaas_default@paypal.com",
|
||||
"first_name": "Dennis",
|
||||
"last_name": "Doctor",
|
||||
"business_name": "Medical Professionals, LLC",
|
||||
"phone": {
|
||||
"country_code": "1",
|
||||
"national_number": "5032141234"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Main St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97217",
|
||||
"country_code": "US"
|
||||
}
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "email@example.com"
|
||||
}
|
||||
],
|
||||
"shipping_info": {
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable",
|
||||
"phone": {
|
||||
"country_code": "1",
|
||||
"national_number": "5039871234"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Broad St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97216",
|
||||
"country_code": "US"
|
||||
}
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"name": "Sutures",
|
||||
"quantity": 100,
|
||||
"unit_price": {
|
||||
"currency": "USD",
|
||||
"value": "5.00"
|
||||
}
|
||||
}
|
||||
],
|
||||
"invoice_date": "2014-02-27 PST",
|
||||
"payment_term": {
|
||||
"term_type": "NET_45",
|
||||
"due_date": "2015-04-13 PDT"
|
||||
},
|
||||
"tax_calculated_after_discount": false,
|
||||
"tax_inclusive": false,
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"total_amount": {
|
||||
"currency": "USD",
|
||||
"value": "500.00"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"description": "Delete an invoice",
|
||||
"title": "Delete an invoice",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.delete",
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-92MG-CNXV-ND7G-P3D2",
|
||||
"method": "DELETE",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"description": "Get the invoice resource for the given identifier.",
|
||||
"title": "Get invoice details",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.get",
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-RF6D-L66T-D7H2-CRU7",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"id": "INV2-RF6D-L66T-D7H2-CRU7",
|
||||
"number": "0002",
|
||||
"status": "DRAFT",
|
||||
"merchant_info": {
|
||||
"email": "ppaas_default@paypal.com",
|
||||
"first_name": "Dennis",
|
||||
"last_name": "Doctor",
|
||||
"business_name": "Medical Professionals, LLC",
|
||||
"phone": {
|
||||
"country_code": "1",
|
||||
"national_number": "5032141716"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Main St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97217",
|
||||
"country_code": "US"
|
||||
}
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "example@example.com"
|
||||
}
|
||||
],
|
||||
"shipping_info": {
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable",
|
||||
"phone": {
|
||||
"country_code": "1",
|
||||
"national_number": "5039871234"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Broad St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97216",
|
||||
"country_code": "US"
|
||||
}
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"name": "Sutures",
|
||||
"quantity": 100,
|
||||
"unit_price": {
|
||||
"currency": "USD",
|
||||
"value": "5.00"
|
||||
}
|
||||
}
|
||||
],
|
||||
"invoice_date": "2014-03-24 PDT",
|
||||
"payment_term": {
|
||||
"term_type": "NET_45",
|
||||
"due_date": "2014-05-08 PDT"
|
||||
},
|
||||
"tax_calculated_after_discount": false,
|
||||
"tax_inclusive": false,
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"total_amount": {
|
||||
"currency": "USD",
|
||||
"value": "500.00"
|
||||
},
|
||||
"metadata": {
|
||||
"created_date": "2014-03-24 12:11:52 PDT"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
{
|
||||
"description": "get all invoices",
|
||||
"title": "get all invoices",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.get_all",
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices?page=0&page_size=10&total_count_required=true",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"total_count": 5,
|
||||
"invoices": [
|
||||
{
|
||||
"id": "INV2-2NB5-UJ7A-YSUJ-ABCD",
|
||||
"number": "9879878979003791",
|
||||
"status": "DRAFT",
|
||||
"merchant_info": {
|
||||
"email": "sample@sample.com"
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "example@example.com"
|
||||
}
|
||||
],
|
||||
"shipping_info": {
|
||||
"email": "example@example.com",
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable"
|
||||
},
|
||||
"invoice_date": "2014-02-27 PST",
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"total_amount": {
|
||||
"currency": "USD",
|
||||
"value": "0.00"
|
||||
},
|
||||
"metadata": {
|
||||
"created_date": "2014-02-27 23:55:58 PST"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "INV2-5AYC-UE5K-XXEG-ABCD",
|
||||
"number": "9879878979003790",
|
||||
"status": "DRAFT",
|
||||
"merchant_info": {
|
||||
"email": "sample@sample.com"
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "example@example.com"
|
||||
}
|
||||
],
|
||||
"shipping_info": {
|
||||
"email": "example@example.com",
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable"
|
||||
},
|
||||
"invoice_date": "2014-02-27 PST",
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"total_amount": {
|
||||
"currency": "USD",
|
||||
"value": "0.00"
|
||||
},
|
||||
"metadata": {
|
||||
"created_date": "2014-02-27 19:41:56 PST"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "INV2-C4QH-KEKM-C5QE-ABCD",
|
||||
"number": "9879878979003789",
|
||||
"status": "DRAFT",
|
||||
"merchant_info": {
|
||||
"email": "sample@sample.com"
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "example@example.com"
|
||||
}
|
||||
],
|
||||
"shipping_info": {
|
||||
"email": "example@example.com",
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable"
|
||||
},
|
||||
"invoice_date": "2014-02-27 PST",
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"total_amount": {
|
||||
"currency": "USD",
|
||||
"value": "0.00"
|
||||
},
|
||||
"metadata": {
|
||||
"created_date": "2014-02-27 15:34:11 PST"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "INV2-RF6D-L66T-D7H2-CRU7",
|
||||
"number": "9879878979003788",
|
||||
"status": "DRAFT",
|
||||
"merchant_info": {
|
||||
"email": "sample@sample.com"
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "example@example.com"
|
||||
}
|
||||
],
|
||||
"shipping_info": {
|
||||
"email": "example@example.com",
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable"
|
||||
},
|
||||
"invoice_date": "2014-02-27 PST",
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"total_amount": {
|
||||
"currency": "USD",
|
||||
"value": "12.00"
|
||||
},
|
||||
"metadata": {
|
||||
"created_date": "2014-02-27 15:34:01 PST"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"description": "Generates QR code for the Invoice URL identified by invoice_id.",
|
||||
"title": "Get QR code",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.qr_code",
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-S6FG-ZZCK-VXMM-8KKP/qr-code",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"image": "iVBORw0KGgoAA......XUDM"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"description": "Record a payment for an invoice.",
|
||||
"title": "Record a payment for an invoice.",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.record-payment",
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-T4UQ-VW4W-K7N7-XM2R/record-payment",
|
||||
"method": "POST",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"method": "CASH",
|
||||
"date": "2014-07-06 03:30:00 PST",
|
||||
"note": "Cash received."
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"description": "Record a refund for an invoice.",
|
||||
"title": "Record a refund for an invoice.",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.record-refund",
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-T4UQ-VW4W-K7N7-XM2R/record-refund",
|
||||
"method": "POST",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"date" : "2013-11-10 14:00:00 PST",
|
||||
"note" : "Refunded by cash!"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"description": "Reminds the payer to pay the invoice.",
|
||||
"title": "Reminds the payer to pay the invoice.",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.remind",
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-T4UQ-VW4W-K7N7-XM2R/remind",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {
|
||||
"subject": "Past due",
|
||||
"note": "Please pay soon",
|
||||
"send_to_merchant": true
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"description": "Search for invoice resources.",
|
||||
"title": "Search for invoice resources.",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.search",
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/search/",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {
|
||||
"page": 0,
|
||||
"page_size": 3,
|
||||
"total_count_required": true
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"total_count": 1,
|
||||
"invoices": [
|
||||
{
|
||||
"id": "INV2-RF6D-L66T-D7H2-CRU7",
|
||||
"number": "0001",
|
||||
"status": "SENT",
|
||||
"merchant_info": {
|
||||
"email": "dennis@sample.com"
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "sally-patient@example.com"
|
||||
}
|
||||
],
|
||||
"shipping_info": {
|
||||
"email": "sally-patient@example.com"
|
||||
},
|
||||
"invoice_date": "2012-05-09 PST",
|
||||
"payment_term": {
|
||||
"due_date": "2012-05-24 PST"
|
||||
},
|
||||
"total_amount": {
|
||||
"currency": "USD",
|
||||
"value": "250"
|
||||
},
|
||||
"metadata": {
|
||||
"created_date": "2012-05-09 04:48:57 PST"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"description": "Sends a legitimate invoice to the payer.",
|
||||
"title": "Sends a legitimate invoice to the payer.",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.send",
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-EHNV-LJ5S-A7DZ-V6NJ/send",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
{
|
||||
"description": "Full update of the invoice resource for the given identifier.",
|
||||
"title": "Full update of the invoice resource for the given identifier.",
|
||||
"runnable": true,
|
||||
"operationId": "invoice.update",
|
||||
"user": {
|
||||
"scopes": []
|
||||
},
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"clientId": "",
|
||||
"clientSecret": "",
|
||||
"path": ""
|
||||
},
|
||||
"login": {},
|
||||
"openIdConnect": {}
|
||||
},
|
||||
"request": {
|
||||
"path": "v1/invoicing/invoices/INV2-8UZ6-Q3DK-VZXV-SXQB",
|
||||
"method": "PUT",
|
||||
"headers": {
|
||||
"X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
|
||||
},
|
||||
"body": {
|
||||
"merchant_info": {
|
||||
"email": "ppaas_default@paypal.com",
|
||||
"first_name": "Dennis",
|
||||
"last_name": "Doctor",
|
||||
"business_name": "Medical Professionals, LLC",
|
||||
"phone": {
|
||||
"country_code": "001",
|
||||
"national_number": "5032141716"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Main St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97217",
|
||||
"country_code": "US"
|
||||
}
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "example@example.com"
|
||||
}
|
||||
],
|
||||
"items": [
|
||||
{
|
||||
"name": "Sutures",
|
||||
"quantity": 100,
|
||||
"unit_price": {
|
||||
"currency": "USD",
|
||||
"value": "5"
|
||||
}
|
||||
}
|
||||
],
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"payment_term": {
|
||||
"term_type": "NET_45"
|
||||
},
|
||||
"shipping_info": {
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable",
|
||||
"phone": {
|
||||
"country_code": "001",
|
||||
"national_number": "5039871234"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Broad St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97216",
|
||||
"country_code": "US"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": "",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"id": "INV2-8UZ6-Q3DK-VZXV-SXQB",
|
||||
"number": "0014",
|
||||
"status": "DRAFT",
|
||||
"merchant_info": {
|
||||
"email": "ppaas_default@paypal.com",
|
||||
"first_name": "Dennis",
|
||||
"last_name": "Doctor",
|
||||
"business_name": "Medical Professionals, LLC",
|
||||
"phone": {
|
||||
"country_code": "1",
|
||||
"national_number": "5032141716"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Main St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97217",
|
||||
"country_code": "US"
|
||||
}
|
||||
},
|
||||
"billing_info": [
|
||||
{
|
||||
"email": "example@example.com"
|
||||
}
|
||||
],
|
||||
"shipping_info": {
|
||||
"first_name": "Sally",
|
||||
"last_name": "Patient",
|
||||
"business_name": "Not applicable",
|
||||
"phone": {
|
||||
"country_code": "1",
|
||||
"national_number": "5039871234"
|
||||
},
|
||||
"address": {
|
||||
"line1": "1234 Broad St.",
|
||||
"city": "Portland",
|
||||
"state": "OR",
|
||||
"postal_code": "97216",
|
||||
"country_code": "US"
|
||||
}
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"name": "Sutures",
|
||||
"quantity": 100,
|
||||
"unit_price": {
|
||||
"currency": "USD",
|
||||
"value": "5.00"
|
||||
}
|
||||
}
|
||||
],
|
||||
"invoice_date": "2014-03-24 PDT",
|
||||
"payment_term": {
|
||||
"term_type": "NET_45",
|
||||
"due_date": "2014-05-08 PDT"
|
||||
},
|
||||
"tax_calculated_after_discount": false,
|
||||
"tax_inclusive": false,
|
||||
"note": "Medical Invoice 16 Jul, 2013 PST",
|
||||
"total_amount": {
|
||||
"currency": "USD",
|
||||
"value": "500.00"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user