🆙 Add cms i using 🆙

This commit is contained in:
Remco
2025-11-25 22:42:56 +01:00
parent 94704e0925
commit d44196149e
35591 changed files with 3601123 additions and 0 deletions
@@ -0,0 +1,115 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait BillingPlans
{
/**
* @return array
*/
private function createPlanParams(): array
{
return Utils::jsonDecode('{
"product_id": "PROD-XXCD1234QWER65782",
"name": "Video Streaming Service Plan",
"description": "Video Streaming Service basic plan",
"status": "ACTIVE",
"billing_cycles": [
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "TRIAL",
"sequence": 1,
"total_cycles": 2,
"pricing_scheme": {
"fixed_price": {
"value": "3",
"currency_code": "USD"
}
}
},
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "TRIAL",
"sequence": 2,
"total_cycles": 3,
"pricing_scheme": {
"fixed_price": {
"value": "6",
"currency_code": "USD"
}
}
},
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 3,
"total_cycles": 12,
"pricing_scheme": {
"fixed_price": {
"value": "10",
"currency_code": "USD"
}
}
}
],
"payment_preferences": {
"auto_bill_outstanding": true,
"setup_fee": {
"value": "10",
"currency_code": "USD"
},
"setup_fee_failure_action": "CONTINUE",
"payment_failure_threshold": 3
},
"taxes": {
"percentage": "10",
"inclusive": false
}
}', true);
}
/**
* @return array
*/
private function updatePlanParams(): array
{
return Utils::jsonDecode('[
{
"op": "replace",
"path": "/payment_preferences/payment_failure_threshold",
"value": 7
}
]', true);
}
/**
* @return array
*/
private function updatePlanPricingParams(): array
{
return Utils::jsonDecode('{
"pricing_schemes": [
{
"billing_cycle_sequence": 2,
"pricing_scheme": {
"fixed_price": {
"value": "50",
"currency_code": "USD"
}
}
}
]
}', true);
}
}
@@ -0,0 +1,37 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait CatalogProducts
{
/**
* @return array
*/
private function createProductParams(): array
{
return Utils::jsonDecode('{
"name": "Video Streaming Service",
"description": "Video streaming service",
"type": "SERVICE",
"category": "SOFTWARE",
"image_url": "https://example.com/streaming.jpg",
"home_url": "https://example.com/home"
}', true);
}
/**
* @return array
*/
private function updateProductParams(): array
{
return Utils::jsonDecode('[
{
"op": "replace",
"path": "/description",
"value": "Premium video streaming service"
}
]', true);
}
}
@@ -0,0 +1,27 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait Disputes
{
/**
* @return array
*/
protected function updateDisputeParams(): array
{
return Utils::jsonDecode('[
{
"op": "add",
"path": "/partner_actions/-",
"value": {
"id": "AMX-22345",
"name": "ACCEPT_DISPUTE",
"create_time": "2018-01-12T10:41:35.000Z",
"status": "PENDING"
}
}
]', true);
}
}
@@ -0,0 +1,40 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait DisputesActions
{
/**
* @return array
*/
protected function acceptDisputeClaimParams(): array
{
return Utils::jsonDecode('{
"note": "Full refund to the customer.",
"accept_claim_type": "REFUND"
}', true);
}
/**
* @return array
*/
protected function acceptDisputeResolutionParams(): array
{
return Utils::jsonDecode('{
"note": "I am ok with the refund offered."
}', true);
}
/**
* @return array
*/
protected function acknowledgeItemReturnedParams(): array
{
return Utils::jsonDecode('{
"note": "I have received the item back.",
"acknowledgement_type": "ITEM_RECEIVED"
}', true);
}
}
@@ -0,0 +1,51 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait Identity
{
private function mockCreateMerchantApplicationParams(): array
{
return Utils::jsonDecode('{
"redirect_uris": [
"https://example.com/callback",
"https://example.com/callback2"
],
"client_name": "AGGREGATOR",
"logo_uri": "https://example.com/logo.png",
"contacts": [
"facilitator@example.com",
"merchant@example.com"
],
"policy_uri": "https://example.com/policyuri",
"tos_uri": "https://example.com/tosuri",
"scope": "profile email address",
"token_endpoint_auth_method": "client_secret_basic",
"jwks_uri": "https://example.com/my_public_keys.jwks"
}', true);
}
private function mockSetAccountPropertiesParams(): array
{
return Utils::jsonDecode('{
"categories": [
{
"name": "PAYMENT",
"groups": [
{
"name": "AUTH_SETTLE",
"preferences": [
{
"name": "ENABLE_ENHANCED_AUTH_SETTLE",
"value": "true"
}
]
}
]
}
]
}', true);
}
}
@@ -0,0 +1,457 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait Invoices
{
/**
* @return array
*/
private function createInvoiceParams(): array
{
return Utils::jsonDecode('{
"detail": {
"invoice_number": "#123",
"reference": "deal-ref",
"invoice_date": "2018-11-12",
"currency_code": "USD",
"note": "Thank you for your business.",
"term": "No refunds after 30 days.",
"memo": "This is a long contract",
"payment_term": {
"term_type": "NET_10",
"due_date": "2018-11-22"
}
},
"invoicer": {
"name": {
"given_name": "David",
"surname": "Larusso"
},
"address": {
"address_line_1": "1234 First Street",
"address_line_2": "337673 Hillside Court",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "merchant@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4085551234",
"phone_type": "MOBILE"
}
],
"website": "www.test.com",
"tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy- Jb5SeuGj185MNNw6g",
"logo_url": "https://example.com/logo.PNG",
"additional_notes": "2-4"
},
"primary_recipients": [
{
"billing_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "bill-me@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4884551234",
"phone_type": "HOME"
}
],
"additional_info_value": "add-info"
},
"shipping_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
}
}
}
],
"items": [
{
"name": "Yoga Mat",
"description": "Elastic mat to practice yoga.",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "50.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
},
"discount": {
"percent": "5"
},
"unit_of_measure": "QUANTITY"
},
{
"name": "Yoga t-shirt",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
},
"discount": {
"amount": {
"currency_code": "USD",
"value": "5.00"
}
},
"unit_of_measure": "QUANTITY"
}
],
"configuration": {
"partial_payment": {
"allow_partial_payment": true,
"minimum_amount_due": {
"currency_code": "USD",
"value": "20.00"
}
},
"allow_tip": true,
"tax_calculated_after_discount": true,
"tax_inclusive": false,
"template_id": "TEMP-19V05281TU309413B"
},
"amount": {
"breakdown": {
"custom": {
"label": "Packing Charges",
"amount": {
"currency_code": "USD",
"value": "10.00"
}
},
"shipping": {
"amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
}
},
"discount": {
"invoice_discount": {
"percent": "5"
}
}
}
}
}', true);
}
/**
* @return array
*/
private function updateInvoiceParams(): array
{
return Utils::jsonDecode('{
"id": "INV2-C82X-JNN9-Y6S5-CNXW",
"status": "DRAFT",
"detail": {
"invoice_number": "#123",
"reference": "deal-refernce-update",
"invoice_date": "2018-11-12",
"currency_code": "USD",
"note": "Thank you for your business.",
"term": "No refunds after 30 days.",
"memo": "This is a long contract",
"payment_term": {
"term_type": "NET_10",
"due_date": "2018-11-22"
}
},
"invoicer": {
"name": {
"given_name": "David",
"surname": "Larusso"
},
"address": {
"address_line_1": "1234 First Street",
"address_line_2": "337673 Hillside Court",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "merchant@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4085551234",
"phone_type": "MOBILE"
}
],
"website": "www.test.com",
"tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
"logo_url": "https://example.com/logo.PNG",
"additional_notes": "2-4"
},
"primary_recipients": [
{
"billing_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "bill-me@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4884551234",
"phone_type": "HOME"
}
],
"additional_info_value": "add-info"
},
"shipping_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
}
}
}
],
"items": [
{
"name": "Yoga Mat",
"description": "Elastic mat to practice yoga.",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "50.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "3.27"
}
},
"discount": {
"percent": "5",
"amount": {
"currency_code": "USD",
"value": "2.5"
}
},
"unit_of_measure": "QUANTITY"
},
{
"name": "Yoga t-shirt",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "0.34"
}
},
"discount": {
"amount": {
"currency_code": "USD",
"value": "5.00"
}
},
"unit_of_measure": "QUANTITY"
}
],
"configuration": {
"partial_payment": {
"allow_partial_payment": true,
"minimum_amount_due": {
"currency_code": "USD",
"value": "20.00"
}
},
"allow_tip": true,
"tax_calculated_after_discount": true,
"tax_inclusive": false,
"template_id": "TEMP-19V05281TU309413B"
},
"amount": {
"currency_code": "USD",
"value": "74.21",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "60.00"
},
"custom": {
"label": "Packing Charges",
"amount": {
"currency_code": "USD",
"value": "10.00"
}
},
"shipping": {
"amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "0.73"
}
}
},
"discount": {
"item_discount": {
"currency_code": "USD",
"value": "-7.50"
},
"invoice_discount": {
"percent": "5",
"amount": {
"currency_code": "USD",
"value": "-2.63"
}
}
},
"tax_total": {
"currency_code": "USD",
"value": "4.34"
}
}
}
}', true);
}
/**
* @return array
*/
private function cancelInvoiceParams(): array
{
return Utils::jsonDecode('{
"subject": "Invoice Cancelled",
"note": "Cancelling the invoice",
"send_to_invoicer": true,
"send_to_recipient": true,
"additional_recipients": [
"user@example.com"
]
}', true);
}
/**
* @return array
*/
private function generateQRCodeInvoiceParams(): array
{
return Utils::jsonDecode('{
"width": 400,
"height": 400
}', true);
}
/**
* @return array
*/
private function registerInvoicePaymentParams(): array
{
return Utils::jsonDecode('{
"width": 400,
"height": 400
}', true);
}
/**
* @return array
*/
private function refundInvoicePaymentParams(): array
{
return Utils::jsonDecode('{
"method": "BANK_TRANSFER",
"refund_date": "2018-05-21",
"amount": {
"currency_code": "USD",
"value": "5.00"
}
}', true);
}
/**
* @return array
*/
private function sendInvoiceParams(): array
{
return Utils::jsonDecode('{
"subject": "Payment due for the invoice #ABC-123",
"note": "Please pay before the due date to avoid incurring late payment charges which will be adjusted in the next bill generated.",
"send_to_invoicer": true,
"additional_recipients": [
"customer-a@example.com",
"customer@example.com"
]
}', true);
}
/**
* @return array
*/
private function sendInvoiceReminderParams(): array
{
return Utils::jsonDecode('{
"subject": "Reminder: Payment due for the invoice #ABC-123",
"note": "Please pay before the due date to avoid incurring late payment charges which will be adjusted in the next bill generated.",
"send_to_invoicer": true,
"additional_recipients": [
"customer-a@example.com",
"customer@example.com"
]
}', true);
}
}
@@ -0,0 +1,31 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait InvoicesSearch
{
/**
* @return array
*/
private function invoiceSearchParams(): array
{
return Utils::jsonDecode('{
"total_amount_range": {
"lower_amount": {
"currency_code": "USD",
"value": "20.00"
},
"upper_amount": {
"currency_code": "USD",
"value": "50.00"
}
},
"invoice_date_range": {
"start": "2018-06-01",
"end": "2018-06-21"
}
}', true);
}
}
@@ -0,0 +1,468 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait InvoicesTemplates
{
/**
* @return array
*/
private function mockCreateInvoiceTemplateParams(): array
{
return Utils::jsonDecode('{
"default_template": true,
"template_info": {
"configuration": {
"tax_calculated_after_discount": true,
"tax_inclusive": false,
"allow_tip": true,
"partial_payment": {
"allow_partial_payment": true,
"minimum_amount_due": {
"currency_code": "USD",
"value": "20.00"
}
}
},
"detail": {
"reference": "deal-ref",
"note": "Thank you for your business.",
"currency_code": "USD",
"terms_and_conditions": "No refunds after 30 days.",
"memo": "This is a long contract",
"attachments": [
{
"id": "Screen Shot 2018-11-23 at 16.45.01.png",
"reference_url": "https://api.paypal.com/invoice/payerView/attachments/RkG9ggQbd4Mwm1tYdcF6uuixfFTFq32bBdbE1VbtQLdKSoS2ZOYpfjw9gPp7eTrZmVaFaDWzixHXm-OXWHbmigHigHzURDxJs8IIKqcqP8jawnBEZcraEAPVMULxf5iTyOSpAUc2ugW0PWdwDbM6mg-guFAUyj3Z98H7htWNjQY95jb9heOlcSXUe.sbDUR9smAszzzJoA1NXT6rEEegwQ&version=1&sig=JNODB0xEayW8txMQm6ZsIwDnd4eh3hd6ijiRLi4ipHE"
}
],
"payment_term": {
"term_type": "NET_10"
}
},
"invoicer": {
"name": {
"given_name": "David",
"surname": "Larusso"
},
"address": {
"address_line_1": "1234 First Street",
"address_line_2": "337673 Hillside Court",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "merchant@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4085551234",
"phone_type": "MOBILE"
}
],
"website": "www.test.com",
"tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
"logo_url": "https://example.com/logo.PNG",
"additional_notes": "2-4"
},
"primary_recipients": [
{
"billing_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "bill-me@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4884551234",
"phone_type": "MOBILE"
}
],
"additional_info": "add-info"
},
"shipping_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
}
}
}
],
"additional_recipients": [
"inform-me@example.com"
],
"items": [
{
"name": "Yoga Mat",
"description": "new watch",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "50.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
},
"discount": {
"percent": "5"
},
"unit_of_measure": "QUANTITY"
},
{
"name": "Yoga T Shirt",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
},
"discount": {
"amount": {
"currency_code": "USD",
"value": "5.00"
}
},
"unit_of_measure": "QUANTITY"
}
],
"amount": {
"currency_code": "USD",
"value": "74.21",
"breakdown": {
"custom": {
"label": "Packing Charges",
"amount": {
"currency_code": "USD",
"value": "10.00"
}
},
"shipping": {
"amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
}
},
"discount": {
"invoice_discount": {
"percent": "5"
}
}
}
}
},
"settings": {
"template_item_settings": [
{
"field_name": "items.date",
"display_preference": {
"hidden": true
}
},
{
"field_name": "items.discount",
"display_preference": {
"hidden": false
}
},
{
"field_name": "items.tax",
"display_preference": {
"hidden": false
}
},
{
"field_name": "items.description",
"display_preference": {
"hidden": false
}
},
{
"field_name": "items.quantity",
"display_preference": {
"hidden": true
}
}
],
"template_subtotal_settings": [
{
"field_name": "custom",
"display_preference": {
"hidden": false
}
},
{
"field_name": "discount",
"display_preference": {
"hidden": false
}
},
{
"field_name": "shipping",
"display_preference": {
"hidden": false
}
}
]
},
"unit_of_measure": "QUANTITY",
"standard_template": false
}', true);
}
/**
* @return array
*/
private function mockUpdateInvoiceTemplateParams(): array
{
return Utils::jsonDecode('{
"default_template": true,
"template_info": {
"configuration": {
"tax_calculated_after_discount": true,
"tax_inclusive": false,
"allow_tip": true,
"partial_payment": {
"allow_partial_payment": true,
"minimum_amount_due": {
"currency_code": "USD",
"value": "20.00"
}
}
},
"detail": {
"reference": "deal-reference-value",
"note": "Thank you for your business.",
"currency_code": "USD",
"terms_and_conditions": "No refunds after 30 days.",
"memo": "This is a long contract",
"attachments": [
{
"id": "Screen Shot 2018-11-23 at 16.45.01.png",
"reference_url": "https://example.com/invoice/payerView/attachments/RkG9ggQbd4Mwm1tYdcF6uuixfFTFq32bBdbE1VbtQLdKSoS2ZOYpfjw9gPp7eTrZmVaFaDWzixHXm-OXWHbmigHigHzURDxJs8IIKqcqP8jawnBEZcraEAPVMULxf5iTyOSpAUc2ugW0PWdwDbM6mg-guFAUyj3Z98H7htWNjQY95jb9heOlcSXUe.sbDUR9smAszzzJoA1NXT6rEEegwQ&version=1&sig=JNODB0xEayW8txMQm6ZsIwDnd4eh3hd6ijiRLi4ipHE"
}
],
"payment_term": {
"term_type": "NET_10"
}
},
"invoicer": {
"name": {
"given_name": "David",
"surname": "Larusso"
},
"address": {
"address_line_1": "1234 First Street",
"address_line_2": "337673 Hillside Court",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "merchant@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4085551234",
"phone_type": "MOBILE"
}
],
"website": "www.test.com",
"tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
"logo_url": "https://example.com/logo.PNG",
"additional_notes": "2-4"
},
"primary_recipients": [
{
"billing_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "bill-me@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4884551234",
"phone_type": "MOBILE"
}
],
"additional_info": "add-info"
},
"shipping_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
}
}
}
],
"additional_recipients": [
"inform-me@example.com"
],
"items": [
{
"name": "Yoga Mat",
"description": "new watch",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "50.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
},
"discount": {
"percent": "5"
},
"unit_of_measure": "QUANTITY"
},
{
"name": "Yoga T Shirt",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
},
"discount": {
"amount": {
"currency_code": "USD",
"value": "5.00"
}
},
"unit_of_measure": "QUANTITY"
}
],
"amount": {
"currency_code": "USD",
"value": "74.21",
"breakdown": {
"custom": {
"label": "Packing Charges",
"amount": {
"currency_code": "USD",
"value": "10.00"
}
},
"shipping": {
"amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25"
}
},
"discount": {
"invoice_discount": {
"percent": "5"
}
}
}
}
},
"settings": {
"template_item_settings": [
{
"field_name": "items.date",
"display_preference": {
"hidden": true
}
},
{
"field_name": "items.discount",
"display_preference": {
"hidden": false
}
},
{
"field_name": "items.tax",
"display_preference": {
"hidden": false
}
},
{
"field_name": "items.description",
"display_preference": {
"hidden": false
}
},
{
"field_name": "items.quantity",
"display_preference": {
"hidden": true
}
}
],
"template_subtotal_settings": [
{
"field_name": "custom",
"display_preference": {
"hidden": false
}
},
{
"field_name": "discount",
"display_preference": {
"hidden": false
}
},
{
"field_name": "shipping",
"display_preference": {
"hidden": false
}
}
]
},
"unit_of_measure": "QUANTITY",
"standard_template": false
}', true);
}
}
@@ -0,0 +1,47 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait Orders
{
/*
* @return array
*/
private function createOrderParams(): array
{
return Utils::jsonDecode('{
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "100.00"
}
}
]
}', true);
}
/*
* @return array
*/
private function updateOrderParams(): array
{
return Utils::jsonDecode('[
{
"op": "replace",
"path": "/purchase_units/@reference_id==\'PUHF\'/shipping/address",
"value": {
"address_line_1": "123 Townsend St",
"address_line_2": "Floor 6",
"admin_area_2": "San Francisco",
"admin_area_1": "CA",
"postal_code": "94107",
"country_code": "US"
}
}
]', true);
}
}
@@ -0,0 +1,291 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait PartnerReferrals
{
private function mockCreatePartnerReferralParams(): array
{
return Utils::jsonDecode('{
"individual_owners": [
{
"names": [
{
"prefix": "Mr.",
"given_name": "John",
"surname": "Doe",
"middle_name": "Middle",
"suffix": "Jr.",
"full_name": "John Middle Doe Jr.",
"type": "LEGAL"
}
],
"citizenship": "US",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "HOME"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692468839",
"extension_number": "1234",
"type": "MOBILE"
}
],
"birth_details": {
"date_of_birth": "1955-12-29"
},
"type": "PRIMARY"
}
],
"business_entity": {
"business_type": {
"type": "INDIVIDUAL",
"subtype": "ASSO_TYPE_INCORPORATED"
},
"business_industry": {
"category": "1004",
"mcc_code": "2025",
"subcategory": "8931"
},
"business_incorporation": {
"incorporation_country_code": "US",
"incorporation_date": "1986-12-29"
},
"names": [
{
"business_name": "Test Enterprise",
"type": "LEGAL_NAME"
}
],
"emails": [
{
"type": "CUSTOMER_SERVICE",
"email": "customerservice@example.com"
}
],
"website": "https://mystore.testenterprises.com",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "WORK"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692478833",
"extension_number": "1234",
"type": "CUSTOMER_SERVICE"
}
],
"beneficial_owners": {
"individual_beneficial_owners": [
{
"names": [
{
"prefix": "Mr.",
"given_name": "John",
"surname": "Doe",
"middle_name": "Middle",
"suffix": "Jr.",
"full_name": "John Middle Doe Jr.",
"type": "LEGAL"
}
],
"citizenship": "US",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "HOME"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692468839",
"extension_number": "1234",
"type": "MOBILE"
}
],
"birth_details": {
"date_of_birth": "1955-12-29"
},
"percentage_of_ownership": "50"
}
],
"business_beneficial_owners": [
{
"business_type": {
"type": "INDIVIDUAL",
"subtype": "ASSO_TYPE_INCORPORATED"
},
"business_industry": {
"category": "1004",
"mcc_code": "2025",
"subcategory": "8931"
},
"business_incorporation": {
"incorporation_country_code": "US",
"incorporation_date": "1986-12-29"
},
"names": [
{
"business_name": "Test Enterprise",
"type": "LEGAL_NAME"
}
],
"emails": [
{
"type": "CUSTOMER_SERVICE",
"email": "customerservice@example.com"
}
],
"website": "https://mystore.testenterprises.com",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "WORK"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692478833",
"extension_number": "1234",
"type": "CUSTOMER_SERVICE"
}
],
"percentage_of_ownership": "50"
}
]
},
"office_bearers": [
{
"names": [
{
"prefix": "Mr.",
"given_name": "John",
"surname": "Doe",
"middle_name": "Middle",
"suffix": "Jr.",
"full_name": "John Middle Doe Jr.",
"type": "LEGAL"
}
],
"citizenship": "US",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "HOME"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692468839",
"extension_number": "1234",
"type": "MOBILE"
}
],
"birth_details": {
"date_of_birth": "1955-12-29"
},
"role": "DIRECTOR"
}
],
"annual_sales_volume_range": {
"minimum_amount": {
"currency_code": "USD",
"value": "10000"
},
"maximum_amount": {
"currency_code": "USD",
"value": "50000"
}
},
"average_monthly_volume_range": {
"minimum_amount": {
"currency_code": "USD",
"value": "1000"
},
"maximum_amount": {
"currency_code": "USD",
"value": "50000"
}
},
"purpose_code": "P0104"
},
"email": "accountemail@example.com",
"preferred_language_code": "en-US",
"tracking_id": "testenterprices123122",
"partner_config_override": {
"partner_logo_url": "https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_111x69.jpg",
"return_url": "https://testenterprises.com/merchantonboarded",
"return_url_description": "the url to return the merchant after the paypal onboarding process.",
"action_renewal_url": "https://testenterprises.com/renew-exprired-url",
"show_add_credit_card": true
},
"operations": [
{
"operation": "BANK_ADDITION"
}
],
"financial_instruments": {
"banks": [
{
"nick_name": "Bank of America",
"account_number": "123405668293",
"account_type": "CHECKING",
"currency_code": "USD",
"identifiers": [
{
"type": "ROUTING_NUMBER_1",
"value": "123456789"
}
]
}
]
},
"legal_consents": [
{
"type": "SHARE_DATA_CONSENT",
"granted": true
}
],
"products": [
"EXPRESS_CHECKOUT"
]
}', true);
}
}
@@ -0,0 +1,37 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait PaymentAuthorizations
{
/**
* @return array
*/
private function mockCaptureAuthorizedPaymentParams(): array
{
return Utils::jsonDecode('{
"amount": {
"value": "10.99",
"currency_code": "USD"
},
"invoice_id": "INVOICE-123",
"note_to_payer": "Payment is due",
"final_capture": true
}', true);
}
/**
* @return array
*/
private function mockReAuthorizeAuthorizedPaymentParams(): array
{
return Utils::jsonDecode('{
"amount": {
"value": "10.99",
"currency_code": "USD"
}
}', true);
}
}
@@ -0,0 +1,23 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait PaymentCaptures
{
/**
* @return array
*/
private function mockRefundCapturedPaymentParams(): array
{
return Utils::jsonDecode('{
"amount": {
"value": "10.99",
"currency_code": "USD"
},
"invoice_id": "INVOICE-123",
"note_to_payer": "Defective product"
}', true);
}
}
@@ -0,0 +1,100 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait PaymentExperienceWebProfiles
{
/**
* @return array
*/
private function mockCreateWebProfileParams(): array
{
return Utils::jsonDecode('[
{
"id": "XP-GCUV-X35G-HNEY-5MJY",
"name": "exampleProfile",
"flow_config": {
"landing_page_type": "billing",
"bank_txn_pending_url": "https://example.com/flow_config/"
},
"input_fields": {
"no_shipping": 1,
"address_override": 1
},
"presentation": {
"logo_image": "https://example.com/logo_image/"
}
},
{
"id": "XP-A88A-LYLW-8Y3X-E5ER",
"name": "exampleProfile",
"flow_config": {
"landing_page_type": "billing",
"bank_txn_pending_url": "https://example.com/flow_config/"
},
"input_fields": {
"no_shipping": 1,
"address_override": 1
},
"presentation": {
"logo_image": "https://example.com/logo_image/"
}
},
{
"id": "XP-RFV4-PVD8-AGHJ-8E5J",
"name": "exampleProfile",
"flow_config": {
"bank_txn_pending_url": "https://example.com/flow_config/"
},
"input_fields": {
"no_shipping": 1,
"address_override": 1
},
"presentation": {
"logo_image": "https://example.com/logo_image/"
}
}
]', true);
}
/**
* @return array
*/
private function partiallyUpdateWebProfileParams(): array
{
return Utils::jsonDecode('[
{
"op": "add",
"path": "/presentation/brand_name",
"value": "new_brand_name"
},
{
"op": "remove",
"path": "/flow_config/landing_page_type"
}
]', true);
}
/**
* @return array
*/
private function updateWebProfileParams(): array
{
return Utils::jsonDecode('{
"name": "exampleProfile",
"presentation": {
"logo_image": "https://example.com/logo_image/"
},
"input_fields": {
"no_shipping": 1,
"address_override": 1
},
"flow_config": {
"landing_page_type": "billing",
"bank_txn_pending_url": "https://example.com/flow_config/"
}
}', true);
}
}
@@ -0,0 +1,77 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait PaymentMethodsTokens
{
/**
* @return array
*/
private function mockCreatePaymentSetupTokensParams(): array
{
return Utils::jsonDecode('{
"payment_source": {
"card": {
"number": "4111111111111111",
"expiry": "2027-02",
"name": "John Doe",
"billing_address": {
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_1": "CA",
"admin_area_2": "San Jose",
"postal_code": "95131",
"country_code": "US"
},
"experience_context": {
"brand_name": "YourBrandName",
"locale": "en-US",
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}
}
}', true);
}
/**
* @return array
*/
private function mockCreatePaymentSetupPayPalParams(): array
{
return Utils::jsonDecode('{
"payment_source": {
"paypal": {
"description": "Description for PayPal to be shown to PayPal payer",
"shipping": {
"name": {
"full_name": "Firstname Lastname"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
},
"permit_multiple_payment_tokens": false,
"usage_pattern": "IMMEDIATE",
"usage_type": "MERCHANT",
"customer_type": "CONSUMER",
"experience_context": {
"shipping_preference": "SET_PROVIDED_ADDRESS",
"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
"brand_name": "EXAMPLE INC",
"locale": "en-US",
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}
}
}', true);
}
}
@@ -0,0 +1,61 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait Payouts
{
/**
* @return array
*/
private function mockCreateBatchPayoutParams(): array
{
return Utils::jsonDecode('{
"sender_batch_header": {
"sender_batch_id": "Payouts_2018_100007",
"email_subject": "You have a payout!",
"email_message": "You have received a payout! Thanks for using our service!"
},
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": "9.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"sender_item_id": "201403140001",
"receiver": "receiver@example.com",
"alternate_notification_method": {
"phone": {
"country_code": "91",
"national_number": "9999988888"
}
},
"notification_language": "fr-FR"
},
{
"recipient_type": "PHONE",
"amount": {
"value": "112.34",
"currency": "USD"
},
"note": "Thanks for your support!",
"sender_item_id": "201403140002",
"receiver": "91-734-234-1234"
},
{
"recipient_type": "PAYPAL_ID",
"amount": {
"value": "5.32",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"sender_item_id": "201403140003",
"receiver": "G83JXTJ5EHCQ2"
}
]
}', true);
}
}
@@ -0,0 +1,38 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait ReferencedPayouts
{
/**
* @return array
*/
private function mockCreateReferencedBatchPayoutParams(): array
{
return Utils::jsonDecode('{
"referenced_payouts": [
{
"reference_id": "2KP03934U4415543C",
"reference_type": "TRANSACTION_ID"
},
{
"reference_id": "8TA4226978212399L",
"reference_type": "TRANSACTION_ID"
}
]
}', true);
}
/**
* @return array
*/
private function mockCreateReferencedBatchPayoutItemParams(): array
{
return Utils::jsonDecode('{
"reference_id": "CAPTURETXNID",
"reference_type": "TRANSACTION_ID"
}', true);
}
}
@@ -0,0 +1,156 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait Subscriptions
{
/**
* @return array
*/
private function mockCreateSubscriptionParams(): array
{
return Utils::jsonDecode('{
"plan_id": "P-5ML4271244454362WXNWU5NQ",
"start_time": "2018-11-01T00:00:00Z",
"quantity": "20",
"shipping_amount": {
"currency_code": "USD",
"value": "10.00"
},
"subscriber": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com",
"shipping_address": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
}
},
"application_context": {
"brand_name": "walmart",
"locale": "en-US",
"shipping_preference": "SET_PROVIDED_ADDRESS",
"user_action": "SUBSCRIBE_NOW",
"payment_method": {
"payer_selected": "PAYPAL",
"payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
},
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}', true);
}
/**
* @return array
*/
private function mockUpdateSubscriptionParams(): array
{
return Utils::jsonDecode('[
{
"op": "replace",
"path": "/billing_info/outstanding_balance",
"value": {
"currency_code": "USD",
"value": "50.00"
}
}
]', true);
}
/**
* @return array
*/
private function mockActivateSubscriptionParams()
{
return Utils::jsonDecode('{
"reason": "Reactivating the subscription"
}', true);
}
/**
* @return array
*/
private function mockCancelSubscriptionParams()
{
return Utils::jsonDecode('{
"reason": "Not satisfied with the service"
}', true);
}
/**
* @return array
*/
private function mockSuspendSubscriptionParams()
{
return Utils::jsonDecode('{
"reason": "Item out of stock"
}', true);
}
/**
* @return array
*/
private function mockCaptureSubscriptionPaymentParams()
{
return Utils::jsonDecode('{
"note": "Charging as the balance reached the limit",
"capture_type": "OUTSTANDING_BALANCE",
"amount": {
"currency_code": "USD",
"value": "100"
}
}', true);
}
/**
* @return array
*/
private function mockUpdateSubscriptionItemsParams()
{
return Utils::jsonDecode('{
"plan_id": "P-5ML4271244454362WXNWU5NQ",
"shipping_amount": {
"currency_code": "USD",
"value": "10.00"
},
"shipping_address": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
},
"application_context": {
"brand_name": "walmart",
"locale": "en-US",
"shipping_preference": "SET_PROVIDED_ADDRESS",
"payment_method": {
"payer_selected": "PAYPAL",
"payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
},
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}', true);
}
}
@@ -0,0 +1,44 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait Trackers
{
/**
* @return array
*/
private function mockUpdateTrackingDetailsParams(): array
{
return Utils::jsonDecode('{
"transaction_id": "8MC585209K746392H",
"tracking_number": "443844607820",
"status": "SHIPPED",
"carrier": "FEDEX"
}', true);
}
/**
* @return array
*/
private function mockCreateTrackinginBatchesParams(): array
{
return Utils::jsonDecode('{
"trackers": [
{
"transaction_id": "8MC585209K746392H",
"tracking_number": "443844607820",
"status": "SHIPPED",
"carrier": "FEDEX"
},
{
"transaction_id": "53Y56775AE587553X",
"tracking_number": "443844607821",
"status": "SHIPPED",
"carrier": "FEDEX"
}
]
}', true);
}
}
@@ -0,0 +1,120 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Requests;
use GuzzleHttp\Utils;
trait WebHooks
{
/**
* @return array
*/
private function mockCreateWebHookParams(): array
{
return Utils::jsonDecode('{
"url": "https://example.com/example_webhook",
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED"
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED"
}
]
}', true);
}
/**
* @return array
*/
private function mockUpdateWebHookParams(): array
{
return Utils::jsonDecode('[
{
"op": "replace",
"path": "/url",
"value": "https://example.com/example_webhook_2"
},
{
"op": "replace",
"path": "/event_types",
"value": [
{
"name": "PAYMENT.SALE.REFUNDED"
}
]
}
]', true);
}
/**
* @return array
*/
private function mockResendWebHookEventNotificationParams(): array
{
return Utils::jsonDecode('{
"webhook_ids": [
"12334456"
]
}', true);
}
/**
* @return array
*/
private function mockVerifyWebHookSignatureParams(): array
{
return Utils::jsonDecode('{
"transmission_id": "69cd13f0-d67a-11e5-baa3-778b53f4ae55",
"transmission_time": "2016-02-18T20:01:35Z",
"cert_url": "cert_url",
"auth_algo": "SHA256withRSA",
"transmission_sig": "lmI95Jx3Y9nhR5SJWlHVIWpg4AgFk7n9bCHSRxbrd8A9zrhdu2rMyFrmz+Zjh3s3boXB07VXCXUZy/UFzUlnGJn0wDugt7FlSvdKeIJenLRemUxYCPVoEZzg9VFNqOa48gMkvF+XTpxBeUx/kWy6B5cp7GkT2+pOowfRK7OaynuxUoKW3JcMWw272VKjLTtTAShncla7tGF+55rxyt2KNZIIqxNMJ48RDZheGU5w1npu9dZHnPgTXB9iomeVRoD8O/jhRpnKsGrDschyNdkeh81BJJMH4Ctc6lnCCquoP/GzCzz33MMsNdid7vL/NIWaCsekQpW26FpWPi/tfj8nLA==",
"webhook_id": "1JE4291016473214C",
"webhook_event": {
"id": "8PT597110X687430LKGECATA",
"create_time": "2013-06-25T21:41:28Z",
"resource_type": "authorization",
"event_type": "PAYMENT.AUTHORIZATION.CREATED",
"summary": "A payment authorization was created",
"resource": {
"id": "2DC87612EK520411B",
"create_time": "2013-06-25T21:39:15Z",
"update_time": "2013-06-25T21:39:17Z",
"state": "authorized",
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.47"
}
},
"parent_payment": "PAY-36246664YD343335CKHFA4AY",
"valid_until": "2013-07-24T21:39:15Z",
"links": [
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B/capture",
"rel": "capture",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B/void",
"rel": "void",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-36246664YD343335CKHFA4AY",
"rel": "parent_payment",
"method": "GET"
}
]
}
}
}', true);
}
}
@@ -0,0 +1,306 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait BillingPlans
{
/**
* @return array
*/
private function mockCreatePlansResponse(): array
{
return Utils::jsonDecode('{
"id": "P-5ML4271244454362WXNWU5NQ",
"product_id": "PROD-XXCD1234QWER65782",
"name": "Video Streaming Service Plan",
"description": "Video Streaming Service basic plan",
"status": "ACTIVE",
"billing_cycles": [
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "TRIAL",
"sequence": 1,
"total_cycles": 2,
"pricing_scheme": {
"fixed_price": {
"value": "3",
"currency_code": "USD"
},
"version": 1,
"create_time": "2020-05-27T12:13:51Z",
"update_time": "2020-05-27T12:13:51Z"
}
},
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "TRIAL",
"sequence": 2,
"total_cycles": 3,
"pricing_scheme": {
"fixed_price": {
"currency_code": "USD",
"value": "6"
},
"version": 1,
"create_time": "2020-05-27T12:13:51Z",
"update_time": "2020-05-27T12:13:51Z"
}
},
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 3,
"total_cycles": 12,
"pricing_scheme": {
"fixed_price": {
"currency_code": "USD",
"value": "10"
},
"version": 1,
"create_time": "2020-05-27T12:13:51Z",
"update_time": "2020-05-27T12:13:51Z"
}
}
],
"payment_preferences": {
"auto_bill_outstanding": true,
"setup_fee": {
"value": "10",
"currency_code": "USD"
},
"setup_fee_failure_action": "CONTINUE",
"payment_failure_threshold": 3
},
"taxes": {
"percentage": "10",
"inclusive": false
},
"create_time": "2020-05-27T12:13:51Z",
"update_time": "2020-05-27T12:13:51Z",
"links": [
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
"rel": "edit",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/deactivate",
"rel": "deactivate",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/update-pricing-schemes",
"rel": "edit",
"method": "POST"
}
]
}', true);
}
/**
* @return array
*/
private function mockListPlansResponse(): array
{
return Utils::jsonDecode('{
"total_items": 12,
"total_pages": 6,
"plans": [
{
"id": "P-5ML4271244454362WXNWU5NQ",
"product_id": "PROD-XXCD1234QWER65782",
"status": "ACTIVE",
"name": "Zoho Marketing Campaign Plan",
"description": "Zoho Marketing Campaign Plan",
"create_time": "2018-12-10T21:20:49Z",
"links": [
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
"rel": "self",
"method": "GET"
}
]
},
{
"id": "P-6LL4271454454362WXNWU5NQ",
"product_id": "PROD-XXCD1234QWER65782",
"status": "ACTIVE",
"name": "Zoho Marketing Campaign Basic Plan",
"description": "Zoho Marketing Campaign Plan",
"create_time": "2019-01-10T21:20:49Z",
"links": [
{
"href": "https://api.paypal.com/v1/billing/plans/P-6LL4271454454362WXNWU5NQ",
"rel": "self",
"method": "GET"
}
]
}
],
"links": [
{
"href": "https://api.paypal.com/v1/billing/plans?product_id=PROD-XXCD1234QWER65782&page_size=2&page=1",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/billing/plans?product_id=PROD-XXCD1234QWER65782&page_size=2&page=1",
"rel": "first",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/billing/plans?product_id=PROD-XXCD1234QWER65782&page_size=2&page=2",
"rel": "next",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/billing/plans?product_id=PROD-XXCD1234QWER65782&page_size=2&page=6",
"rel": "last",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockGetPlansResponse(): array
{
return Utils::jsonDecode('{
"id": "P-5ML4271244454362WXNWU5NQ",
"product_id": "PROD-XXCD1234QWER65782",
"name": "Basic Plan",
"description": "Basic Plan",
"status": "ACTIVE",
"billing_cycles": [
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "TRIAL",
"sequence": 1,
"total_cycles": 2,
"pricing_scheme": {
"fixed_price": {
"currency_code": "USD",
"value": "3"
},
"version": 1,
"create_time": "2020-05-27T12:13:51Z",
"update_time": "2020-05-27T12:13:51Z"
}
},
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "TRIAL",
"sequence": 2,
"total_cycles": 3,
"pricing_scheme": {
"fixed_price": {
"currency_code": "USD",
"value": "6"
},
"version": 1,
"create_time": "2020-05-27T12:13:51Z",
"update_time": "2020-05-27T12:13:51Z"
}
},
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 3,
"total_cycles": 12,
"pricing_scheme": {
"fixed_price": {
"value": "10",
"currency_code": "USD"
},
"status": "ACTIVE",
"version": 1,
"create_time": "2020-05-27T12:13:51Z",
"update_time": "2020-05-27T12:13:51Z"
}
}
],
"taxes": {
"percentage": "10",
"inclusive": false
},
"create_time": "2020-05-27T12:13:51Z",
"update_time": "2020-05-27T12:13:51Z",
"links": [
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
"rel": "edit",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/deactivate",
"rel": "deactivate",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/update-pricing-schemes",
"rel": "edit",
"method": "POST"
}
]
}', true);
}
/**
* @return array
*/
private function mockCreatePlansErrorResponse(): array
{
return Utils::jsonDecode('{
"error": {
"name" : "UNPROCESSABLE_ENTITY",
"message" : "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id" : "7a944631e76bf",
"details" : [
{
"issue" : "CURRENCY_NOT_SUPPORTED_FOR_RECEIVER",
"description" : "This currency cannot be accepted for this recipient\'s account."
}
],
"links" : [
{
"href" : "https://developer.paypal.com/docs/api/v1/billing/subscriptions#UNPROCESSABLE_ENTITY",
"rel" : "information_link",
"method" : "GET"
}
]
}
}', true);
}
}
@@ -0,0 +1,153 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait CatalogProducts
{
/**
* @return array
*/
private function mockCreateCatalogProductsResponse(): array
{
return Utils::jsonDecode('{
"id": "PROD-XYAB12ABSB7868434",
"name": "Video Streaming Service",
"description": "Video streaming service",
"type": "SERVICE",
"category": "SOFTWARE",
"image_url": "https://example.com/streaming.jpg",
"home_url": "https://example.com/home",
"create_time": "2020-01-10T21:20:49Z",
"update_time": "2020-01-10T21:20:49Z",
"links": [
{
"href": "https://api.paypal.com/v1/catalogs/products/72255d4849af8ed6e0df1173",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/catalogs/products/72255d4849af8ed6e0df1173",
"rel": "edit",
"method": "PATCH"
}
]
}', true);
}
/**
* @return array
*/
private function mockListCatalogProductsResponse(): array
{
return Utils::jsonDecode('{
"total_items": 20,
"total_pages": 1,
"products": [
{
"id": "72255d4849af8ed6e0df1173",
"name": "Video Streaming Service",
"description": "Video streaming service",
"create_time": "2018-12-10T21:20:49Z",
"links": [
{
"href": "https://api.paypal.com/v1/catalogs/products/72255d4849af8ed6e0df1173",
"rel": "self",
"method": "GET"
}
]
},
{
"id": "PROD-XYAB12ABSB7868434",
"name": "Video Streaming Service",
"description": "Audio streaming service",
"create_time": "2018-12-10T21:20:49Z",
"links": [
{
"href": "https://api.paypal.com/v1/catalogs/products/125d4849af8ed6e0df18",
"rel": "self",
"method": "GET"
}
]
}
],
"links": [
{
"href": "https://api.paypal.com/v1/catalogs/products?page_size=2&page=1",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/catalogs/products?page_size=2&page=2",
"rel": "next",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/catalogs/products?page_size=2&page=10",
"rel": "last",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockGetCatalogProductsResponse(): array
{
return Utils::jsonDecode('{
"id": "72255d4849af8ed6e0df1173",
"name": "Video Streaming Service",
"description": "Video streaming service",
"type": "SERVICE",
"category": "SOFTWARE",
"image_url": "https://example.com/streaming.jpg",
"home_url": "https://example.com/home",
"create_time": "2018-12-10T21:20:49Z",
"update_time": "2018-12-10T21:20:49Z",
"links": [
{
"href": "https://api.paypal.com/v1/catalogs/products/72255d4849af8ed6e0df1173",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/catalogs/products/72255d4849af8ed6e0df1173",
"rel": "edit",
"method": "PATCH"
}
]
}', true);
}
/**
* @return array
*/
private function mockGetCatalogProductsErrorResponse(): array
{
return Utils::jsonDecode('{
"error": {
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "b2aaac7fe91d1",
"details": [
{
"field": "\/type",
"location": "body",
"issue": "MISSING_REQUIRED_PARAMETER",
"description": "A required field is missing."
}
],
"links": [
{
"href": "https:\/\/developer.paypal.com\/docs\/api\/v1\/billing\/subscriptions#INVALID_REQUEST",
"rel": "information_link",
"method": "GET"
}
]
}
}', true);
}
}
@@ -0,0 +1,145 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait Disputes
{
/**
* @return array
*/
private function mockListDisputesResponse(): array
{
return Utils::jsonDecode('{
"items": [
{
"dispute_id": "PP-000-003-648-191",
"create_time": "2017-01-24T10:41:35.000Z",
"update_time": "2017-01-24T11:40:32.000Z",
"status": "WAITING_FOR_SELLER_RESPONSE",
"reason": "MERCHANDISE_OR_SERVICE_NOT_RECEIVED",
"dispute_state": "REQUIRED_OTHER_PARTY_ACTION",
"dispute_amount": {
"currency_code": "USD",
"value": "50.00"
},
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/customer/disputes/PP-000-003-648-191",
"rel": "self",
"method": "GET"
}
]
},
{
"dispute_id": "PP-000-003-648-175",
"create_time": "2017-01-24T10:37:23.000Z",
"update_time": "2017-01-24T11:32:32.000Z",
"status": "UNDER_REVIEW",
"reason": "UNAUTHORISED",
"dispute_amount": {
"currency_code": "USD",
"value": "20.00"
},
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/customer/disputes/PP-000-003-648-175",
"rel": "self",
"method": "GET"
}
]
}
],
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/customer/disputes",
"rel": "self",
"method": "GET"
},
{
"href": "https://api-m.sandbox.paypal.com/v1/customer/disputes",
"rel": "first",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockGetDisputesResponse(): array
{
return Utils::jsonDecode('{
"dispute_id": "PP-D-4012",
"create_time": "2019-04-11T04:18:00.000Z",
"update_time": "2019-04-21T04:19:08.000Z",
"disputed_transactions": [
{
"seller_transaction_id": "3BC38643YC807283D",
"create_time": "2019-04-11T04:16:58.000Z",
"transaction_status": "REVERSED",
"gross_amount": {
"currency_code": "USD",
"value": "192.00"
},
"buyer": {
"name": "Lupe Justin"
},
"seller": {
"email": "merchant@example.com",
"merchant_id": "5U29WL78XSAEL",
"name": "Lesley Paul"
}
}
],
"reason": "MERCHANDISE_OR_SERVICE_NOT_AS_DESCRIBED",
"status": "RESOLVED",
"dispute_amount": {
"currency_code": "USD",
"value": "96.00"
},
"dispute_outcome": {
"outcome_code": "RESOLVED_BUYER_FAVOUR",
"amount_refunded": {
"currency_code": "USD",
"value": "96.00"
}
},
"dispute_life_cycle_stage": "CHARGEBACK",
"dispute_channel": "INTERNAL",
"messages": [
{
"posted_by": "BUYER",
"time_posted": "2019-04-11T04:18:04.000Z",
"content": "SNAD case created through automation"
}
],
"extensions": {
"merchandize_dispute_properties": {
"issue_type": "SERVICE",
"service_details": {
"sub_reasons": [
"INCOMPLETE"
],
"purchase_url": "https://ebay.in"
}
}
},
"offer": {
"buyer_requested_amount": {
"currency_code": "USD",
"value": "96.00"
}
},
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/customer/disputes/PP-D-4012",
"rel": "self",
"method": "GET"
}
]
}', true);
}
}
@@ -0,0 +1,56 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait DisputesActions
{
/**
* @return array
*/
private function mockAcceptDisputesClaimResponse(): array
{
return Utils::jsonDecode('{
"links": [
{
"rel": "self",
"method": "GET",
"href": "https://api-m.sandbox.paypal.com/v1/customer/disputes/PP-D-27803"
}
]
}', true);
}
/**
* @return array
*/
private function mockAcceptDisputesOfferResolutionResponse(): array
{
return Utils::jsonDecode('{
"links": [
{
"rel": "self",
"method": "GET",
"href": "https://api-m.sandbox.paypal.com/v1/customer/disputes/PP-000-000-651-454"
}
]
}', true);
}
/**
* @return array
*/
private function mockAcknowledgeItemReturnedResponse(): array
{
return Utils::jsonDecode('{
"links": [
{
"rel": "self",
"method": "GET",
"href": "https://api-m.sandbox.paypal.com/v1/customer/disputes/PP-000-000-651-454"
}
]
}', true);
}
}
@@ -0,0 +1,182 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait Identity
{
private function mockShowProfileInfoResponse(): array
{
return Utils::jsonDecode('{
"address": {
"street_address": "7917394 Annursnac Hill Road Unit 0C",
"locality": "Ventura",
"region": "CA",
"postal_code": "93003",
"country": "US"
}
}', true);
}
private function mocklistUsersResponse(): array
{
return Utils::jsonDecode('{
"schemas": [
"http://example.com"
],
"startIndex": 1,
"itemsPerPage": 1,
"totalResults": 5000,
"Resources": [
{
"schemas": [
"http://example.com"
],
"externalId": "string",
"userName": "string",
"name": {
"familyName": "string",
"givenName": "string",
"middleName": "string",
"honorificPrefix": "string",
"honorificSuffix": "string"
},
"active": true,
"emails": [
{
"type": "work",
"primary": true,
"value": "string"
}
],
"phoneNumbers": [
{
"value": "string",
"type": "work",
"primary": true
}
],
"addresses": [
{
"streetAddress": "string",
"locality": "string",
"region": "string",
"postalCode": "string",
"type": "work",
"country": "string"
}
],
"entitlements": [
{
"value": "string"
}
],
"id": "string",
"meta": {
"resourceType": "User",
"location": "http://example.com",
"created": "string",
"lastModified": "string"
},
"preferredLanguage": "string",
"timezone": "string"
}
]
}', true);
}
private function mocklistUserResponse(): array
{
return Utils::jsonDecode('{
"schemas": [
"http://example.com"
],
"externalId": "string",
"userName": "string",
"name": {
"familyName": "string",
"givenName": "string",
"middleName": "string",
"honorificPrefix": "string",
"honorificSuffix": "string"
},
"active": true,
"emails": [
{
"type": "work",
"primary": true,
"value": "string"
}
],
"phoneNumbers": [
{
"value": "string",
"type": "work",
"primary": true
}
],
"addresses": [
{
"streetAddress": "string",
"locality": "string",
"region": "string",
"postalCode": "string",
"type": "work",
"country": "string"
}
],
"entitlements": [
{
"value": "string"
}
],
"id": "string",
"meta": {
"resourceType": "User",
"location": "http://example.com",
"created": "string",
"lastModified": "string"
},
"preferredLanguage": "string",
"timezone": "string"
}', true);
}
private function mockCreateMerchantApplicationResponse(): array
{
return Utils::jsonDecode('{
"client_id": "AeTeCqaPp7JZBfUUb2d21cQ2KqyQGVhonfiUOJu99kgLhFFSrE59ruvhLOT4K3NzQoErgsUH6MY9uRqD",
"client_secret": "cf136dc3c1fc93f31185e5885805d",
"client_id_issued_at": 2893256800,
"client_secret_expires_at": 2893276800,
"redirect_uris": [
"https://example.com/callback",
"https://example.com/callback2"
],
"grant_types": [
"authorization_code",
"refresh_token"
],
"client_name": "AGGREGATOR",
"logo_uri": "https://example.com/logo.png",
"contacts": [
"facilitator@example.com",
"merchant@example.com"
],
"policy_uri": "https://example.com/policyuri",
"tos_uri": "https://example.com/tosuri",
"scope": "profile email address",
"token_endpoint_auth_method": "client_secret_basic",
"jwks_uri": "https://example.com/my_public_keys.jwks"
}', true);
}
private function mockGetClientTokenResponse(): array
{
return Utils::jsonDecode('{
"client_token": "eyJicmFpbnRyZWUiOnsiYXV0aG9yaXphdGlvbkZpbmdlcnByaW50IjoiYjA0MWE2M2JlMTM4M2NlZGUxZTI3OWFlNDlhMWIyNzZlY2FjOTYzOWU2NjlhMGIzODQyYTdkMTY3NzcwYmY0OHxtZXJjaGFudF9pZD1yd3dua3FnMnhnNTZobTJuJnB1YmxpY19rZXk9czlic3BuaGtxMmYzaDk0NCZjcmVhdGVkX2F0PTIwMTgtMTEtMTRUMTE6MTg6MDAuMTU3WiIsInZlcnNpb24iOiIzLXBheXBhbCJ9LCJwYXlwYWwiOnsiYWNjZXNzVG9rZW4iOiJBMjFBQUhNVExyMmctVDlhSTJacUZHUmlFZ0ZFZGRHTGwxTzRlX0lvdk9ESVg2Q3pSdW5BVy02TzI2MjdiWUJ2cDNjQ0FNWi1lTFBNc2NDWnN0bDUyNHJyUGhUQklJNlBBIn19",
"expires_in": 3600
}', true);
}
}
@@ -0,0 +1,888 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait Invoices
{
/**
* @return array
*/
private function mockGenerateInvoiceNumberResponse(): array
{
return Utils::jsonDecode('{
"invoice_number": "ee0044"
}', true);
}
/**
* @return array
*/
private function mockCreateInvoicesResponse(): array
{
return Utils::jsonDecode('{
"id": "INV2-Z56S-5LLA-Q52L-CPZ5",
"status": "DRAFT",
"detail": {
"invoice_number": "#123",
"reference": "deal-ref",
"invoice_date": "2018-11-12",
"currency_code": "USD",
"note": "Thank you for your business.",
"term": "No refunds after 30 days.",
"memo": "This is a long contract",
"payment_term": {
"term_type": "NET_10",
"due_date": "2018-11-22"
},
"metadata": {
"create_time": "2018-11-12T08:00:20Z",
"recipient_view_url": "https://www.api.paypal.com/invoice/p#Z56S5LLAQ52LCPZ5",
"invoicer_view_url": "https://www.api.paypal.com/invoice/details/INV2-Z56S-5LLA-Q52L-CPZ5"
}
},
"invoicer": {
"name": {
"given_name": "David",
"surname": "Larusso"
},
"address": {
"address_line_1": "1234 First Street",
"address_line_2": "337673 Hillside Court",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "merchant@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4085551234",
"phone_type": "MOBILE"
}
],
"website": "https://example.com",
"tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
"logo_url": "https://example.com/logo.PNG",
"additional_notes": "2-4"
},
"primary_recipients": [
{
"billing_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "bill-me@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4884551234",
"phone_type": "HOME"
}
],
"additional_info_value": "add-info"
},
"shipping_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
}
}
}
],
"items": [
{
"name": "Yoga Mat",
"description": "Elastic mat to practice yoga.",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "50.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "3.27"
}
},
"discount": {
"percent": "5",
"amount": {
"currency_code": "USD",
"value": "2.5"
}
},
"unit_of_measure": "QUANTITY"
},
{
"name": "Yoga T Shirt",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "0.34"
}
},
"discount": {
"amount": {
"currency_code": "USD",
"value": "5.00"
}
},
"unit_of_measure": "QUANTITY"
}
],
"configuration": {
"partial_payment": {
"allow_partial_payment": true,
"minimum_amount_due": {
"currency_code": "USD",
"value": "20.00"
}
},
"allow_tip": true,
"tax_calculated_after_discount": true,
"tax_inclusive": false,
"template_id": "TEMP-19V05281TU309413B"
},
"amount": {
"currency_code": "USD",
"value": "74.21",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "60.00"
},
"custom": {
"label": "Packing Charges",
"amount": {
"currency_code": "USD",
"value": "10.00"
}
},
"shipping": {
"amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "0.73"
}
}
},
"discount": {
"item_discount": {
"currency_code": "USD",
"value": "-7.50"
},
"invoice_discount": {
"percent": "5",
"amount": {
"currency_code": "USD",
"value": "-2.63"
}
}
},
"tax_total": {
"currency_code": "USD",
"value": "4.34"
}
}
},
"due_amount": {
"currency_code": "USD",
"value": "74.21"
},
"links": [
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/send",
"rel": "send",
"method": "POST"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/update",
"rel": "replace",
"method": "PUT"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "delete",
"method": "DELETE"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/payments",
"rel": "record-payment",
"method": "POST"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/generate-qr-code",
"rel": "qr-code",
"method": "POST"
}
]
}', true);
}
/**
* @return array
*/
private function mockListInvoicesResponse(): array
{
return Utils::jsonDecode('{
"total_items": 2,
"total_pages": 1,
"items": [
{
"id": "INV2-Z56S-5LLA-Q52L-CPZ5",
"status": "DRAFT",
"detail": {
"invoice_number": "#123",
"reference": "deal-ref",
"invoice_date": "2018-11-12",
"currency_code": "USD",
"note": "Thank you for your business.",
"term": "No refunds after 30 days.",
"memo": "This is a long contract",
"payment_term": {
"term_type": "NET_10",
"due_date": "2018-11-22"
},
"metadata": {
"create_time": "2018-11-12T08:00:20Z",
"recipient_view_url": "https://www.paypal.com/invoice/p/#Z56S5LLAQ52LCPZ5",
"invoicer_view_url": "https://www.paypal.com/invoice/details/INV2-Z56S-5LLA-Q52L-CPZ5"
}
},
"invoicer": {
"email_address": "merchant@example.com"
},
"primary_recipients": [
{
"billing_info": {
"email_address": "bill-me@example.com"
}
}
],
"amount": {
"currency_code": "USD",
"value": "74.21"
},
"links": [
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/send",
"rel": "send",
"method": "POST"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "replace",
"method": "PUT"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "delete",
"method": "DELETE"
}
]
},
{
"id": "INV2-NP6M-C9A8-ZBDA-3TEX",
"status": "SCHEDULED",
"detail": {
"invoice_number": "0001",
"invoice_date": "2018-05-14",
"currency_code": "USD",
"payment_term": {
"due_date": "2018-05-15"
},
"metadata": {
"create_time": "2018-05-15T17:24:12Z"
}
},
"invoicer": {
"email_address": "merchant@example.com"
},
"primary_recipients": [
{
"billing_info": {
"email_address": "recipient@example.com"
}
}
],
"amount": {
"currency_code": "USD",
"value": "32.00"
},
"links": [
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-NP6M-C9A8-ZBDA-3TEX",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-NP6M-C9A8-ZBDA-3TEX",
"rel": "replace",
"method": "PUT"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-NP6M-C9A8-ZBDA-3TEX",
"rel": "delete",
"method": "DELETE"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-NP6M-C9A8-ZBDA-3TEX/payments",
"rel": "record-payment",
"method": "POST"
}
]
}
],
"links": [
{
"href": "https://api.paypal.com/v2/invoicing/invoices?page=1&page_size=20&total_required=false",
"rel": "self",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockUpdateInvoicesResponse(): array
{
return Utils::jsonDecode('{
"id": "INV2-C82X-JNN9-Y6S5-CNXW",
"status": "DRAFT",
"detail": {
"invoice_number": "#123",
"reference": "deal-refernce-update",
"invoice_date": "2018-11-12",
"currency_code": "USD",
"note": "Thank you for your business.",
"term": "No refunds after 30 days.",
"memo": "This is a long contract",
"payment_term": {
"term_type": "NET_10",
"due_date": "2018-11-22"
},
"metadata": {
"create_time": "2018-11-12T08:00:20Z",
"recipient_view_url": "https://www.api.paypal.com/invoice/p#Z56S5LLAQ52LCPZ5",
"invoicer_view_url": "https://www.api.paypal.com/invoice/details/INV2-Z56S-5LLA-Q52L-CPZ5"
}
},
"invoicer": {
"name": {
"given_name": "David",
"surname": "Larusso"
},
"address": {
"address_line_1": "1234 First Street",
"address_line_2": "337673 Hillside Court",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "merchant@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4085551234",
"phone_type": "MOBILE"
}
],
"website": "https://example.com",
"tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
"logo_url": "https://example.com/logo.PNG",
"additional_notes": "2-4"
},
"primary_recipients": [
{
"billing_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "bill-me@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4884551234",
"phone_type": "HOME"
}
],
"additional_info_value": "add-info"
},
"shipping_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
}
}
}
],
"items": [
{
"name": "Yoga Mat",
"description": "Elastic mat to practice yoga.",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "50.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "3.27"
}
},
"discount": {
"percent": "5",
"amount": {
"currency_code": "USD",
"value": "2.5"
}
},
"unit_of_measure": "QUANTITY"
},
{
"name": "Yoga t-shirt",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "0.34"
}
},
"discount": {
"amount": {
"currency_code": "USD",
"value": "5.00"
}
},
"unit_of_measure": "QUANTITY"
}
],
"configuration": {
"partial_payment": {
"allow_partial_payment": true,
"minimum_amount_due": {
"currency_code": "USD",
"value": "20.00"
}
},
"allow_tip": true,
"tax_calculated_after_discount": true,
"tax_inclusive": false,
"template_id": "TEMP-19V05281TU309413B"
},
"amount": {
"currency_code": "USD",
"value": "74.21",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "60.00"
},
"custom": {
"label": "Packing Charges",
"amount": {
"currency_code": "USD",
"value": "10.00"
}
},
"shipping": {
"amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "0.73"
}
}
},
"discount": {
"item_discount": {
"currency_code": "USD",
"value": "-7.50"
},
"invoice_discount": {
"percent": "5",
"amount": {
"currency_code": "USD",
"value": "-2.63"
}
}
},
"tax_total": {
"currency_code": "USD",
"value": "4.34"
}
}
},
"due_amount": {
"currency_code": "USD",
"value": "74.21"
},
"links": [
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/send",
"rel": "send",
"method": "POST"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/update",
"rel": "replace",
"method": "PUT"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "delete",
"method": "DELETE"
}
]
}', true);
}
/**
* @return array
*/
private function mockGetInvoicesResponse(): array
{
return Utils::jsonDecode('{
"id": "INV2-Z56S-5LLA-Q52L-CPZ5",
"status": "DRAFT",
"detail": {
"invoice_number": "#123",
"reference": "deal-ref",
"invoice_date": "2018-11-12",
"currency_code": "USD",
"note": "Thank you for your business.",
"term": "No refunds after 30 days.",
"memo": "This is a long contract",
"payment_term": {
"term_type": "NET_10",
"due_date": "2018-11-22"
},
"metadata": {
"create_time": "2018-11-12T08:00:20Z",
"recipient_view_url": "https://www.paypal.com/invoice/p/#Z56S5LLAQ52LCPZ5",
"invoicer_view_url": "https://www.paypal.com/invoice/details/INV2-Z56S-5LLA-Q52L-CPZ5"
}
},
"invoicer": {
"name": {
"given_name": "David",
"surname": "Larusso"
},
"address": {
"address_line_1": "1234 First Street",
"address_line_2": "337673 Hillside Court",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "merchant@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4085551234",
"phone_type": "MOBILE"
}
],
"website": "https://example.com",
"tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
"logo_url": "https://example.com/logo.PNG",
"additional_notes": "2-4"
},
"primary_recipients": [
{
"billing_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
},
"email_address": "bill-me@example.com",
"phones": [
{
"country_code": "001",
"national_number": "4884551234",
"phone_type": "HOME"
}
],
"additional_info_value": "add-info"
},
"shipping_info": {
"name": {
"given_name": "Stephanie",
"surname": "Meyers"
},
"address": {
"address_line_1": "1234 Main Street",
"admin_area_2": "Anytown",
"admin_area_1": "CA",
"postal_code": "98765",
"country_code": "US"
}
}
}
],
"items": [
{
"name": "Yoga Mat",
"description": "Elastic mat to practice yoga.",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "50.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "3.27"
}
},
"discount": {
"percent": "5",
"amount": {
"currency_code": "USD",
"value": "2.5"
}
},
"unit_of_measure": "QUANTITY"
},
{
"name": "Yoga T Shirt",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "0.34"
}
},
"discount": {
"amount": {
"currency_code": "USD",
"value": "5.00"
}
},
"unit_of_measure": "QUANTITY"
}
],
"configuration": {
"partial_payment": {
"allow_partial_payment": true,
"minimum_amount_due": {
"currency_code": "USD",
"value": "20.00"
}
},
"allow_tip": true,
"tax_calculated_after_discount": true,
"tax_inclusive": false,
"template_id": "TEMP-19V05281TU309413B"
},
"amount": {
"currency_code": "USD",
"value": "74.21",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "60.00"
},
"custom": {
"label": "Packing Charges",
"amount": {
"currency_code": "USD",
"value": "10.00"
}
},
"shipping": {
"amount": {
"currency_code": "USD",
"value": "10.00"
},
"tax": {
"name": "Sales Tax",
"percent": "7.25",
"amount": {
"currency_code": "USD",
"value": "0.73"
}
}
},
"discount": {
"item_discount": {
"currency_code": "USD",
"value": "-7.50"
},
"invoice_discount": {
"percent": "5",
"amount": {
"currency_code": "USD",
"value": "-2.63"
}
}
},
"tax_total": {
"currency_code": "USD",
"value": "4.34"
}
}
},
"due_amount": {
"currency_code": "USD",
"value": "74.21"
},
"links": [
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/send",
"rel": "send",
"method": "POST"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "replace",
"method": "PUT"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "delete",
"method": "DELETE"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/payments",
"rel": "record-payment",
"method": "POST"
},
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/generate-qr-code",
"rel": "qr-code",
"method": "POST"
}
]
}', true);
}
/**
* @return string
*/
private function mockGenerateInvoiceQRCodeResponse(): string
{
return '--95dbdbed-7536-4c24-b5ca-bcdbc0006612 Content-Disposition: form-data; name="image" Content-Type: application/octet-stream iVBORw0KGgoAAAANSUhEUgAAAJYAAACWAQAAAAAUekxPAAABxUlEQVR42u2WMY7kIBBFq0VA1n0BS1yDjCvZF7DxBdxXIuMaSFzAzgiQaz6t9mxLm1AbrCYYy4H1AlT1f9XHxH89lX7Z/2KJKN3CMIW6FCInYplLPtisoU6FTyHzti6RN5tPm+5ixrtTp0uP8g8s744eMS1yxvikNEOJz966GPTLaOL1fmjaxfAkaLCy2t2Hl10sPUIaNY1araFhCat3TbODDPkZ68Ii1sqfX62c1rzP62W8uWG0aiMaxSyvpS4hez2MzXkZg+FL4NNCwku/XtZ8g/Be550+Pe9jWj0x41rt1ngZyxzYa+NpmDjNMlYx1yhhs2glM8vY3IQ3qGWz9Tqvk7F3cGyYNd3KQDKGSWFGDjFNIZ8yhuWgR8gb5jR8+9bJ8rPUCd3oYbY4VcQqaWSYWRGcdnhnSS+D6lhKJIE5+JrTXtaquDtzuuypXrV0stRKwLAUzFodnYjxERP28ihtLw8WsbQE7JbxCD9SmxMxfsUYpiZ7lxYWMewltzuqKMz4n13tYi3vl6jW2FJQynBH+Za7Zie6sZRhNVXLTkqTmGUE5xSRu5dv3Qz3uYdj0bwkFLGWfxxoJMXx28tO9vu/9oPYF0bR/hBeOiwMAAAAAElFTkSuQmCC --95dbdbed-7536-4c24-b5ca-bcdbc0006612--';
}
/**
* @return array
*/
private function mockInvoiceRegisterPaymentResponse(): array
{
return Utils::jsonDecode('{
"payment_id": "EXTR-86F38350LX4353815"
}', true);
}
/**
* @return array
*/
private function mockInvoiceRefundPaymentResponse(): array
{
return Utils::jsonDecode('{
"refund_id": "EXTR-2LG703375E477444T"
}', true);
}
}
@@ -0,0 +1,71 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait InvoicesSearch
{
/**
* @return array
*/
private function mockSearchInvoicesResponse(): array
{
return Utils::jsonDecode('{
"total_items": 6,
"total_pages": 1,
"items": [
{
"id": "INV2-Z56S-5LLA-Q52L-CPZ5",
"status": "DRAFT",
"detail": {
"invoice_number": "#123",
"reference": "deal-ref",
"invoice_date": "2018-11-12",
"currency_code": "USD",
"note": "Thank you for your business.",
"term": "No refunds after 30 days.",
"memo": "This is a long contract",
"payment_term": {
"term_type": "NET_10",
"due_date": "2018-11-22"
},
"metadata": {
"create_time": "2018-11-12T08:00:20Z",
"recipient_view_url": "https://www.api.paypal.com/invoice/p#Z56S5LLAQ52LCPZ5",
"invoicer_view_url": "https://www.api.paypal.com/invoice/details/INV2-Z56S-5LLA-Q52L-CPZ5"
}
},
"invoicer": {
"email_address": "merchant@example.com"
},
"primary_recipients": [
{
"billing_info": {
"email_address": "bill-me@example.com"
}
}
],
"amount": {
"currency_code": "USD",
"value": "74.21"
},
"links": [
{
"href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
"rel": "self",
"method": "GET"
}
]
}
],
"links": [
{
"href": "https://api.paypal.com/v2/invoicing/invoices?page=2&page_size=10&total_required=true",
"rel": "next",
"method": "POST"
}
]
}', true);
}
}
@@ -0,0 +1,303 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait Orders
{
/**
* @return array
*/
public function mockCreateOrdersResponse(): array
{
return Utils::jsonDecode('{
"id": "5O190127TN364715T",
"status": "CREATED",
"links": [
{
"href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T",
"rel": "approve",
"method": "GET"
},
{
"href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T/capture",
"rel": "capture",
"method": "POST"
}
]
}', true);
}
/**
* @return empty
*/
public function mockUpdateOrdersResponse()
{
return '';
}
/**
* @return array
*/
public function mockOrderDetailsResponse(): array
{
return Utils::jsonDecode('{
"id": "5O190127TN364715T",
"status": "PAYER_ACTION_REQUIRED",
"intent": "CAPTURE",
"payment_source": {
"alipay": {
"name": "John Doe",
"country_code": "C2"
}
},
"purchase_units": [
{
"reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
"amount": {
"currency_code": "USD",
"value": "100.00"
},
"payee": {
"email_address": "payee@example.com"
}
}
],
"create_time": "2018-04-01T21:18:49Z",
"links": [
{
"href": "https://www.paypal.com/payment/alipay?token=5O190127TN364715T",
"rel": "payer-action",
"method": "GET"
},
{
"href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T",
"rel": "self",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
public function mockOrderPaymentAuthorizedResponse(): array
{
return Utils::jsonDecode('{
"id": "5O190127TN364715T",
"status": "COMPLETED",
"payer": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com",
"payer_id": "QYR5Z8XDVJNXQ"
},
"purchase_units": [
{
"reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
"shipping": {
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
},
"payments": {
"authorizations": [
{
"id": "0AW2184448108334S",
"status": "CREATED",
"amount": {
"currency_code": "USD",
"value": "100.00"
},
"seller_protection": {
"status": "ELIGIBLE",
"dispute_categories": [
"ITEM_NOT_RECEIVED",
"UNAUTHORIZED_TRANSACTION"
]
},
"expiration_time": "2018-05-01T21:20:49Z",
"create_time": "2018-04-01T21:20:49Z",
"update_time": "2018-04-01T21:20:49Z",
"links": [
{
"href": "https://api-m.paypal.com/v2/payments/authorizations/0AW2184448108334S",
"rel": "self",
"method": "GET"
},
{
"href": "https://api-m.paypal.com/v2/payments/authorizations/0AW2184448108334S/capture",
"rel": "capture",
"method": "POST"
},
{
"href": "https://api-m.paypal.com/v2/payments/authorizations/0AW2184448108334S/void",
"rel": "void",
"method": "POST"
},
{
"href": "https://api-m.paypal.com/v2/payments/authorizations/0AW2184448108334S/reauthorize",
"rel": "reauthorize",
"method": "POST"
}
]
}
]
}
}
],
"links": [
{
"href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T",
"rel": "self",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
public function mockOrderPaymentCapturedResponse(): array
{
return Utils::jsonDecode('{
"id": "5O190127TN364715T",
"status": "COMPLETED",
"payer": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com",
"payer_id": "QYR5Z8XDVJNXQ"
},
"purchase_units": [
{
"reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
"shipping": {
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
},
"payments": {
"captures": [
{
"id": "3C679366HH908993F",
"status": "COMPLETED",
"amount": {
"currency_code": "USD",
"value": "100.00"
},
"seller_protection": {
"status": "ELIGIBLE",
"dispute_categories": [
"ITEM_NOT_RECEIVED",
"UNAUTHORIZED_TRANSACTION"
]
},
"final_capture": true,
"disbursement_mode": "INSTANT",
"seller_receivable_breakdown": {
"gross_amount": {
"currency_code": "USD",
"value": "100.00"
},
"paypal_fee": {
"currency_code": "USD",
"value": "3.00"
},
"net_amount": {
"currency_code": "USD",
"value": "97.00"
}
},
"create_time": "2018-04-01T21:20:49Z",
"update_time": "2018-04-01T21:20:49Z",
"links": [
{
"href": "https://api-m.paypal.com/v2/payments/captures/3C679366HH908993F",
"rel": "self",
"method": "GET"
},
{
"href": "https://api-m.paypal.com/v2/payments/captures/3C679366HH908993F/refund",
"rel": "refund",
"method": "POST"
}
]
}
]
}
}
],
"links": [
{
"href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T",
"rel": "self",
"method": "GET"
}
]
}', true);
}
private function mockConfirmOrderResponse()
{
return Utils::jsonDecode('{
"id": "5O190127TN364715T",
"status": "PAYER_ACTION_REQUIRED",
"payment_source": {
"paypal": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com"
}
},
"payer": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com"
},
"links": [
{
"href": "https://api.paypal.com/v2/checkout/orders/5O190127TN364715T",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T",
"rel": "payer-action",
"method": "GET"
}
]
}', true);
}
}
@@ -0,0 +1,504 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait PartnerReferrals
{
private function mockCreatePartnerReferralsResponse(): array
{
return Utils::jsonDecode('{
"links": [
{
"href": "https://uri.paypal.com/v2/customer/partner-referrals/ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.paypal.com/merchantsignup/partner/onboardingentry?token=ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
"rel": "action_url",
"method": "GET"
}
]
}', true);
}
private function mockShowReferralDataResponse(): array
{
return Utils::jsonDecode('{
"partner_referral_id": "ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
"submitter_payer_id": "RFYUH2QQDGUQU",
"referral_data": {
"individual_owners": [
{
"names": [
{
"prefix": "Mr.",
"given_name": "John",
"surname": "Doe",
"middle_name": "Middle",
"suffix": "Jr.",
"full_name": "John Middle Doe Jr.",
"type": "LEGAL"
}
],
"citizenship": "US",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "HOME"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692468839",
"extension_number": "1234",
"type": "MOBILE"
}
],
"birth_details": {
"date_of_birth": "1955-12-29"
},
"type": "PRIMARY"
}
],
"business_entity": {
"business_type": {
"type": "INDIVIDUAL",
"subtype": "ASSO_TYPE_INCORPORATED"
},
"business_industry": {
"category": "1004",
"mcc_code": "2025",
"subcategory": "8931"
},
"business_incorporation": {
"incorporation_country_code": "US",
"incorporation_date": "1986-12-29"
},
"names": [
{
"business_name": "Test Enterprise",
"type": "LEGAL_NAME"
}
],
"emails": [
{
"type": "CUSTOMER_SERVICE",
"email": "customerservice@example.com"
}
],
"website": "https://mystore.testenterprises.com",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "WORK"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692478833",
"extension_number": "1234",
"type": "CUSTOMER_SERVICE"
}
],
"beneficial_owners": {
"individual_beneficial_owners": [
{
"names": [
{
"prefix": "Mr.",
"given_name": "John",
"surname": "Doe",
"middle_name": "Middle",
"suffix": "Jr.",
"full_name": "John Middle Doe Jr.",
"type": "LEGAL"
}
],
"citizenship": "US",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "HOME"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692468839",
"extension_number": "1234",
"type": "MOBILE"
}
],
"birth_details": {
"date_of_birth": "1955-12-29"
},
"percentage_of_ownership": "50"
}
],
"business_beneficial_owners": [
{
"business_type": {
"type": "INDIVIDUAL",
"subtype": "ASSO_TYPE_INCORPORATED"
},
"business_industry": {
"category": "1004",
"mcc_code": "2025",
"subcategory": "8931"
},
"business_incorporation": {
"incorporation_country_code": "US",
"incorporation_date": "1986-12-29"
},
"names": [
{
"business_name": "Test Enterprise",
"type": "LEGAL_NAME"
}
],
"emails": [
{
"type": "CUSTOMER_SERVICE",
"email": "customerservice@example.com"
}
],
"website": "https://mystore.testenterprises.com",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "WORK"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692478833",
"extension_number": "1234",
"type": "CUSTOMER_SERVICE"
}
],
"percentage_of_ownership": "50"
}
]
},
"office_bearers": [
{
"names": [
{
"prefix": "Mr.",
"given_name": "John",
"surname": "Doe",
"middle_name": "Middle",
"suffix": "Jr.",
"full_name": "John Middle Doe Jr.",
"type": "LEGAL"
}
],
"citizenship": "US",
"addresses": [
{
"address_line_1": "One Washington Square",
"address_line_2": "Apt 123",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95112",
"country_code": "US",
"type": "HOME"
}
],
"phones": [
{
"country_code": "1",
"national_number": "6692468839",
"extension_number": "1234",
"type": "MOBILE"
}
],
"birth_details": {
"date_of_birth": "1955-12-29"
},
"role": "DIRECTOR"
}
],
"annual_sales_volume_range": {
"minimum_amount": {
"currency_code": "USD",
"value": "10000"
},
"maximum_amount": {
"currency_code": "USD",
"value": "50000"
}
},
"average_monthly_volume_range": {
"minimum_amount": {
"currency_code": "USD",
"value": "1000"
},
"maximum_amount": {
"currency_code": "USD",
"value": "50000"
}
},
"purpose_code": "P0104"
},
"email": "accountemail@example.com",
"preferred_language_code": "en-US",
"tracking_id": "testenterprices123122",
"partner_config_override": {
"partner_logo_url": "https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_111x69.jpg",
"return_url": "https://testenterprises.com/merchantonboarded",
"return_url_description": "the url to return the merchant after the paypal onboarding process.",
"action_renewal_url": "https://testenterprises.com/renew-exprired-url",
"show_add_credit_card": true
},
"operations": [
{
"operation": "API_INTEGRATION",
"api_integration_preference": {
"classic_api_integration": {
"integration_type": "THIRD_PARTY",
"third_party_details": {
"permissions": [
"EXPRESS_CHECKOUT",
"REFUND",
"DIRECT_PAYMENT",
"AUTH_CAPTURE",
"BUTTON_MANAGER",
"ACCOUNT_BALANCE",
"TRANSACTION_DETAILS"
]
},
"first_party_details": "CERTIFICATE"
},
"rest_api_integration": {
"integration_method": "PAYPAL",
"integration_type": "THIRD_PARTY",
"third_party_details": {
"features": [
"PAYMENT",
"REFUND",
"PARTNER_FEE"
]
}
}
},
"billing_agreement": {
"description": "Billing Agreement Description Field",
"billing_experience_preference": {
"experience_id": "string",
"billing_context_set": true
},
"merchant_custom_data": "PatnerMERCHANT23124",
"approval_url": "wttps://www.paypal.com/agreements/approve?ba_token=BA-67944913LE886121E",
"ec_token": "EC-1S970363DB536864M"
}
}
],
"products": [
"EXPRESS_CHECKOUT"
],
"legal_consents": [
{
"type": "SHARE_DATA_CONSENT",
"granted": true
}
]
},
"links": [
{
"href": "https://uri.paypal.com/v2/customer/partner-referrals/ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.paypal.com/merchantsignup/partner/onboardingentry?token=ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
"rel": "action_url",
"method": "GET"
}
]
}', true);
}
private function mockListSellerTrackingInformationResponse(): array
{
return Utils::jsonDecode('{
"merchant_id": "8LQLM2ML4ZTYU",
"tracking_id": "merchantref1",
"links": [
{
"href": "v1/customer/partners/6LKMD2ML4NJYU",
"rel": "read",
"method": "GET",
"description": "Main partner resource."
}
]
}', true);
}
private function mockShowSellerStatusResponse(): array
{
return Utils::jsonDecode('{
"merchant_id": "8LQLM2ML4ZTYU",
"products": [
{
"name": "PAYFLOW_PRO",
"vetting_status": "APPROVED",
"status": "ACTIVE"
},
{
"name": "EXPRESS_CHECKOUT",
"status": "ACTIVE"
},
{
"name": "PPCP_STANDARD",
"vetting_status": "SUBSCRIBED",
"capabilities": [
"CUSTOM_CARD_PROCESSING",
"CARD_PROCESSING_VIRTUAL_TERMINAL",
"FRAUD_TOOL_ACCESS",
"AMEX_OPTBLUE",
"DEBIT_CARD_SWITCH",
"COMMERCIAL_ENTITY"
]
},
{
"name": "PPCP_CUSTOM",
"vetting_status": "IN_REVIEW",
"capabilities": []
}
],
"capabilities": [
{
"name": "CUSTOM_CARD_PROCESSING",
"status": "ACTIVE",
"limits": [
{
"type": "GENERAL"
}
]
},
{
"name": "CARD_PROCESSING_VIRTUAL_TERMINAL",
"status": "ACTIVE"
},
{
"name": "FRAUD_TOOL_ACCESS",
"status": "ACTIVE"
},
{
"name": "AMEX_OPTBLUE",
"status": "ACTIVE"
},
{
"name": "DEBIT_CARD_SWITCH",
"status": "ACTIVE"
},
{
"name": "COMMERCIAL_ENTITY",
"status": "ACTIVE"
}
],
"payments_receivable": true,
"primary_email": "seller@example.com",
"primary_email_confirmed": true,
"granted_permissions": [
"AIR_TRAVEL",
"INVOICING",
"RECURRING_PAYMENT_REPORT"
],
"api_credential": {
"signature": {
"api_user_name": "example_api1.gmail.com",
"api_password": "7QPZJL5PX2TT94RX",
"signature": "Ak0kqXY-wqI.w.dfyQrwACtkK4HcMNxGdvADyrIE8QLgZWyIDNJSDlQ1e"
}
},
"oauth_integrations": [
{
"integration_type": "OAUTH_THIRD_PARTY",
"oauth_third_party": [
{
"partner_client_id": "AafBGhBphJ66SHPtbCMTsH1q2HQC2lnf0ER0KWAVSsOqsAtVfnye5Vc8hAOC",
"merchant_client_id": "AafBGhBphJ66SHPtbCMTsH1q2HQC2lnf0ER0KWAVSsOqsAtVfnye5Vc8hAOC",
"scopes": [
"https://uri.paypal.com/services/payments/realtimepayment",
"https://uri.paypal.com/services/payments/payment/authcapture",
"https://uri.paypal.com/services/payments/refund"
]
},
{
"partner_client_id": "AafBGhBphJ66SHPtbCMTsH1q2HQC2lnf0ER0KWAVSsOqsAtVfnye5Vc8hAOC",
"merchant_client_id": "AafBGhBphJ66SHPtbCMTsH1q2HQC2lnf0ER0KWAVSsOqsAtVfnye5Vc8hAOC",
"scopes": [
"https://uri.paypal.com/services/payments/realtimepayment",
"https://uri.paypal.com/services/payments/payment/authcapture"
]
}
]
}
],
"limitations": [
{
"name": "MRCHT - Pending User Agreement",
"restrictions": [
"ACH IN",
"Withdraw Money",
"Remove Bank",
"Refunds to Buyer",
"Close Account",
"Send Money",
"Remove Card"
]
},
{
"name": "Seller-linked merchant",
"restrictions": [
"ACH IN",
"Send Money",
"Refunds to Buyer",
"Receive/Request Money",
"Remove Bank",
"Remove Card",
"Withdraw Money",
"Close Account"
]
}
]
}', true);
}
private function mockListMerchantCredentialsResponse(): array
{
return Utils::jsonDecode('{
"client_id": "Ab27r3fkrQezHdcPrn2b2SYzPEldXx2dWgv76btVfI-eYF8KRAd2WxXAZyb0ETygSNeHBthzlxjlQ_qw",
"client_secret": "EAcTvpnDHZf4icl_2MPnt2gRpOxHVtaQJChWU3PrRbYR4uyvUXV6h4DWQjm7XOfdnk_OrEEWdxY2eUG3",
"payer_id": "QVG98CUNMS2PY"
}', true);
}
}
@@ -0,0 +1,117 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait PaymentAuthorizations
{
/**
* @return array
*/
private function mockGetAuthorizedPaymentDetailsResponse(): array
{
return Utils::jsonDecode('{
"id": "0VF52814937998046",
"status": "AUTHORIZED",
"amount": {
"total": "10.99",
"currency": "USD"
},
"invoice_id": "INVOICE-123",
"seller_protection": {
"status": "ELIGIBLE",
"dispute_categories": [
"ITEM_NOT_RECEIVED",
"UNAUTHORIZED_TRANSACTION"
]
},
"expiration_time": "2017-10-10T23:23:45Z",
"create_time": "2017-09-11T23:23:45Z",
"update_time": "2017-09-11T23:23:45Z",
"links": [
{
"rel": "self",
"method": "GET",
"href": "https://api.paypal.com/v2/payments/authorizations/0VF52814937998046"
},
{
"rel": "capture",
"method": "POST",
"href": "https://api.paypal.com/v2/payments/authorizations/0VF52814937998046/capture"
},
{
"rel": "void",
"method": "POST",
"href": "https://api.paypal.com/v2/payments/authorizations/0VF52814937998046/void"
},
{
"rel": "reauthorize",
"method": "POST",
"href": "https://api.paypal.com/v2/payments/authorizations/0VF52814937998046/reauthorize"
}
]
}', true);
}
/**
* @return array
*/
private function mockCaptureAuthorizedPaymentResponse(): array
{
return Utils::jsonDecode('{
"id": "2GG279541U471931P",
"status": "COMPLETED",
"links": [
{
"rel": "self",
"method": "GET",
"href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P"
},
{
"rel": "refund",
"method": "POST",
"href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P/refund"
},
{
"rel": "up",
"method": "GET",
"href": "https://api.paypal.com/v2/payments/authorizations/0VF52814937998046"
}
]
}', true);
}
/**
* @return array
*/
private function mockReAuthorizeAuthorizedPaymentResponse(): array
{
return Utils::jsonDecode('{
"id": "8AA831015G517922L",
"status": "CREATED",
"links": [
{
"rel": "self",
"method": "GET",
"href": "https://api.paypal.com/v2/payments/authorizations/8AA831015G517922L"
},
{
"rel": "capture",
"method": "POST",
"href": "https://api.paypal.com/v2/payments/authorizations/8AA831015G517922L/capture"
},
{
"rel": "void",
"method": "POST",
"href": "https://api.paypal.com/v2/payments/authorizations/8AA831015G517922L/void"
},
{
"rel": "reauthorize",
"method": "POST",
"href": "https://api.paypal.com/v2/payments/authorizations/8AA831015G517922L/reauthorize"
}
]
}', true);
}
}
@@ -0,0 +1,89 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait PaymentCaptures
{
/**
* @return array
*/
private function mockGetCapturedPaymentDetailsResponse(): array
{
return Utils::jsonDecode('{
"id": "2GG279541U471931P",
"status": "COMPLETED",
"status_details": {},
"amount": {
"total": "10.99",
"currency": "USD"
},
"final_capture": true,
"seller_protection": {
"status": "ELIGIBLE",
"dispute_categories": [
"ITEM_NOT_RECEIVED",
"UNAUTHORIZED_TRANSACTION"
]
},
"seller_receivable_breakdown": {
"gross_amount": {
"total": "10.99",
"currency": "USD"
},
"paypal_fee": {
"value": "0.33",
"currency": "USD"
},
"net_amount": {
"value": "10.66",
"currency": "USD"
}
},
"invoice_id": "INVOICE-123",
"create_time": "2017-09-11T23:24:01Z",
"update_time": "2017-09-11T23:24:01Z",
"links": [
{
"href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://api.paypal.com/v2/payments/authorizations/0VF52814937998046",
"rel": "up",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockRefundCapturedPaymentResponse(): array
{
return Utils::jsonDecode('{
"id": "1JU08902781691411",
"status": "COMPLETED",
"links": [
{
"rel": "self",
"method": "GET",
"href": "https://api.paypal.com/v2/payments/refunds/1JU08902781691411"
},
{
"rel": "up",
"method": "GET",
"href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P"
}
]
}', true);
}
}
@@ -0,0 +1,85 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait PaymentExperienceWebProfiles
{
/**
* @return array
*/
private function mockListWebProfilesResponse(): array
{
return Utils::jsonDecode('[
{
"id": "XP-GCUV-X35G-HNEY-5MJY",
"name": "exampleProfile",
"flow_config": {
"landing_page_type": "billing",
"bank_txn_pending_url": "https://example.com/flow_config/"
},
"input_fields": {
"no_shipping": 1,
"address_override": 1
},
"presentation": {
"logo_image": "https://example.com/logo_image/"
}
},
{
"id": "XP-A88A-LYLW-8Y3X-E5ER",
"name": "exampleProfile",
"flow_config": {
"landing_page_type": "billing",
"bank_txn_pending_url": "https://example.com/flow_config/"
},
"input_fields": {
"no_shipping": 1,
"address_override": 1
},
"presentation": {
"logo_image": "https://example.com/logo_image/"
}
},
{
"id": "XP-RFV4-PVD8-AGHJ-8E5J",
"name": "exampleProfile",
"flow_config": {
"bank_txn_pending_url": "https://example.com/flow_config/"
},
"input_fields": {
"no_shipping": 1,
"address_override": 1
},
"presentation": {
"logo_image": "https://example.com/logo_image/"
}
}
]', true);
}
/**
* @return array
*/
private function mockWebProfileResponse(): array
{
return Utils::jsonDecode('{
"id": "XP-RFV4-PVD8-AGHJ-8E5J",
"name": "exampleProfile",
"temporary": false,
"presentation": {
"logo_image": "https://example.com/logo_image/"
},
"input_fields": {
"no_shipping": 1,
"address_override": 1
},
"flow_config": {
"landing_page_type": "billing",
"bank_txn_pending_url": "https://example.com/flow_config/",
"user_action": "commit"
}
}', true);
}
}
@@ -0,0 +1,368 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait PaymentMethodsTokens
{
/**
* @return array
*/
private function mockCreatePaymentMethodsTokenResponse(): array
{
return Utils::jsonDecode('{
"id": "8kk8451t",
"customer": {
"id": "customer_4029352050"
},
"payment_source": {
"card": {
"brand": "VISA",
"last_digits": "1111",
"expiry": "2027-02",
"name": "John Doe",
"billing_address": {
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
}
},
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk8451t",
"method": "GET",
"encType": "application/json"
},
{
"rel": "delete",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk8451t",
"method": "DELETE",
"encType": "application/json"
}
]
}', true);
}
/**
* @return array
*/
private function mockListPaymentMethodsTokensResponse(): array
{
return Utils::jsonDecode('{
"customer": {
"id": "customer_4029352050"
},
"payment_tokens": [
{
"id": "8kk8451t",
"customer": {
"id": "customer_4029352050"
},
"payment_source": {
"card": {
"name": "John Doe",
"brand": "VISA",
"last_digits": "1111",
"expiry": "2027-02",
"billing_address": {
"id": "kk",
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
}
},
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk8451t",
"method": "GET",
"encType": "application/json"
},
{
"rel": "delete",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk8451t",
"method": "DELETE",
"encType": "application/json"
}
]
},
{
"id": "fgh6561t",
"customer": {
"id": "customer_4029352050"
},
"payment_source": {
"paypal": {
"description": "Description for PayPal to be shown to PayPal payer",
"email_address": "john.doe@example.com",
"account_id": "VYYFH3WJ4JPJQ",
"shipping": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
},
"usage_pattern": "IMMEDIATE",
"usage_type": "MERCHANT",
"customer_type": "CONSUMER",
"name": {
"given_name": "John",
"surname": "Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
}
},
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/fgh6561t",
"method": "GET",
"encType": "application/json"
},
{
"rel": "delete",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/fgh6561t",
"method": "DELETE",
"encType": "application/json"
}
]
},
{
"id": "hg654s1t",
"customer": {
"id": "customer_4029352050"
},
"payment_source": {
"venmo": {
"description": "Description for Venmo to be shown to Venmo payer",
"shipping": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
},
"usage_pattern": "IMMEDIATE",
"usage_type": "MERCHANT",
"customer_type": "CONSUMER",
"email_address": "john.doe@example.com",
"user_name": "johndoe",
"name": {
"given_name": "John",
"surname": "Doe"
},
"account_id": "VYYFH3WJ4JPJQ",
"address": {
"address_line_1": "PayPal",
"address_line_2": "2211 North 1st Street",
"admin_area_1": "CA",
"admin_area_2": "San Jose",
"postal_code": "96112",
"country_code": "US"
}
}
},
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/hg654s1t",
"method": "GET",
"encType": "application/json"
},
{
"rel": "delete",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/hg654s1t",
"method": "DELETE",
"encType": "application/json"
}
]
},
{
"id": "8kk8457",
"payment_source": {
"apple_pay": {
"card": {
"name": "John Doe",
"last_digits": "1111",
"type": "CREDIT",
"brand": "VISA",
"billing_address": {
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_1": "CA",
"admin_area_2": "San Jose",
"postal_code": "95131",
"country_code": "US"
}
}
}
},
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk845",
"method": "GET"
},
{
"rel": "delete",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk845",
"method": "DELETE"
}
]
},
{
"id": "8kk8458",
"payment_source": {
"bank": {
"ach_debit": {
"last_digits": "9999",
"routing_number": "307075259",
"account_type": "CHECKING",
"ownership_type": "PERSONAL",
"account_holder_name": "John Doe",
"verification_status": "VERIFIED"
}
}
},
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk8458",
"method": "GET",
"encType": "application/json"
},
{
"rel": "delete",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/hg654s1t",
"method": "DELETE",
"encType": "application/json"
}
]
}
],
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens?customer_id=customer_4029352050&page=1&page_size=5&total_required=false",
"method": "GET",
"encType": "application/json"
},
{
"rel": "first",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens?customer_id=customer_4029352050&page=1&page_size=5&total_required=false",
"method": "GET",
"encType": "application/json"
},
{
"rel": "last",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens?customer_id=customer_4029352050&page=1&page_size=5&total_required=false",
"method": "GET",
"encType": "application/json"
}
]
}', true);
}
/**
* @return array
*/
private function mockCreatePaymentSetupTokenResponse(): array
{
return Utils::jsonDecode('{
"payment_source": {
"card": {
"number": "4111111111111111",
"expiry": "2027-02",
"name": "John Doe",
"billing_address": {
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_1": "CA",
"admin_area_2": "San Jose",
"postal_code": "95131",
"country_code": "US"
},
"experience_context": {
"brand_name": "YourBrandName",
"locale": "en-US",
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}
}
}', true);
}
/**
* @return array
*/
private function mockListPaymentSetupTokenResponse(): array
{
return Utils::jsonDecode('{
"id": "5C991763VB2781612",
"customer": {
"id": "customer_4029352050"
},
"status": "APPROVED",
"payment_source": {
"card": {
"last_digits": "1111",
"expiry": "2027-02",
"name": "John Doe",
"billing_address": {
"address_line_1": "2211 N First Street",
"address_line_2": "17.3.160",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
}
},
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/setup-tokens/5C991763VB2781612",
"method": "GET",
"encType": "application/json"
},
{
"rel": "confirm",
"href": "https://api-m.paypal.com/v3/vault/payment-token",
"method": "POST",
"encType": "application/json"
}
]
}', true);
}
}
@@ -0,0 +1,57 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait PaymentRefunds
{
/**
* @return array
*/
private function mockGetRefundDetailsResponse(): array
{
return Utils::jsonDecode('{
"id": "1JU08902781691411",
"amount": {
"value": "10.99",
"currency_code": "USD"
},
"status": "COMPLETED",
"note_to_payer": "Defective product",
"seller_payable_breakdown": {
"gross_amount": {
"value": "10.99",
"currency_code": "USD"
},
"paypal_fee": {
"value": "0",
"currency_code": "USD"
},
"net_amount": {
"value": "10.99",
"currency_code": "USD"
},
"total_refunded_amount": {
"value": "10.99",
"currency_code": "USD"
}
},
"invoice_id": "INVOICE-123",
"create_time": "2018-09-11T23:24:19Z",
"update_time": "2018-09-11T23:24:19Z",
"links": [
{
"rel": "self",
"method": "GET",
"href": "https://api.paypal.com/v2/payments/refunds/1JU08902781691411"
},
{
"rel": "up",
"method": "GET",
"href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P"
}
]
}', true);
}
}
@@ -0,0 +1,297 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait Payouts
{
/**
* @return array
*/
private function mockCreateBatchPayoutResponse(): array
{
return Utils::jsonDecode('{
"batch_header": {
"sender_batch_header": {
"sender_batch_id": "Payouts_2018_100008",
"email_subject": "You have a payout!",
"email_message": "You have received a payout! Thanks for using our service!"
},
"payout_batch_id": "5UXD2E8A7EBQJ",
"batch_status": "PENDING"
}
}', true);
}
/**
* @return array
*/
private function showBatchPayoutResponse(): array
{
return Utils::jsonDecode('{
"batch_header": {
"payout_batch_id": "FYXMPQTX4JC9N",
"batch_status": "PROCESSING",
"time_created": "2014-01-27T10:17:00Z",
"time_completed": "2014-01-27T11:17:39.00Z",
"sender_batch_header": {
"sender_batch_id": "Payouts_2018_100009",
"email_subject": "You have a payout!"
},
"amount": {
"value": "438.35",
"currency": "USD"
},
"fees": {
"value": "5.84",
"currency": "USD"
}
},
"items": [
{
"payout_item_id": "DUCD8GC3VUKVE",
"transaction_id": "6KA23440H1057442S",
"transaction_status": "SUCCESS",
"payout_batch_id": "FYXMPQTX4JC9N",
"payout_item_fee": {
"currency": "USD",
"value": "1.00"
},
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"value": "65.24",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"receiver": "receiver@example.com",
"sender_item_id": "14Feb_978"
},
"time_processed": "2014-01-27T10:18:32Z"
},
{
"payout_item_id": "LGMEPRKTK7FQA",
"transaction_id": "8K128187J1102003K",
"transaction_status": "SUCCESS",
"payout_batch_id": "FYXMPQTX4JC9N",
"payout_item_fee": {
"currency": "USD",
"value": "1.00"
},
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"value": "59.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"receiver": "receiver2@example.com",
"sender_item_id": "14Feb_321"
},
"time_processed": "2014-01-27T10:18:15Z"
},
{
"payout_item_id": "BQ8GT9VG64EFS",
"transaction_id": "57382391EC1682714",
"transaction_status": "SUCCESS",
"payout_batch_id": "FYXMPQTX4JC9N",
"payout_item_fee": {
"currency": "USD",
"value": "1.00"
},
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"value": "59.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"receiver": "receiver3@example.com",
"sender_item_id": "14Feb_239"
},
"time_processed": "2014-01-27T10:17:15Z"
},
{
"payout_item_id": "LHKZN4VT93L2Q",
"transaction_id": "1LG71547D1353984N",
"transaction_status": "SUCCESS",
"payout_batch_id": "FYXMPQTX4JC9N",
"payout_item_fee": {
"value": "USD",
"currency": "0.75"
},
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"value": "19.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"receiver": "receiver4@example.com",
"sender_item_id": "14Feb_235"
},
"time_processed": "2014-01-27T10:17:25Z"
},
{
"payout_item_id": "4ZF3VZHHTQJG6",
"transaction_id": "4BD48613EX3256543",
"transaction_status": "SUCCESS",
"payout_batch_id": "FYXMPQTX4JC9N",
"payout_item_fee": {
"currency": "USD",
"value": "0.75"
},
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"value": "9.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"receiver": "receiver@example.com",
"sender_item_id": "14Feb_234"
},
"time_processed": "2014-01-27T10:17:37Z"
},
{
"payout_item_id": "DTCJCQ6LMH8JQ",
"transaction_id": "25F63571CL9929422",
"transaction_status": "SUCCESS",
"payout_item_fee": {
"currency": "USD",
"value": "2.35"
},
"payout_batch_id": "FYXMPQTX4JC9N",
"payout_item": {
"recipient_type": "PHONE",
"amount": {
"value": "112.34",
"currency": "USD"
},
"note": "Thanks for your support!",
"receiver": "91-734-234-1234",
"sender_item_id": "14Feb_235"
},
"time_processed": "2014-01-27T10:17:52Z"
},
{
"payout_item_id": "GSBDQHUAUD44A",
"transaction_id": "53R03517P98080414",
"transaction_status": "SUCCESS",
"payout_batch_id": "FYXMPQTX4JC9N",
"payout_item_fee": {
"currency": "USD",
"value": "2.5"
},
"payout_item": {
"recipient_type": "PHONE",
"amount": {
"value": "5.32",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"receiver": "408X234-1234",
"sender_item_id": "14Feb_235"
},
"time_processed": "2014-01-27T10:17:41Z"
}
],
"links": [
{
"rel": "self",
"href": "https://api-m.sandbox.paypal.com/v1/payments/payouts/FYXMPQTX4JC9N?page_size=1000&page=1",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function showBatchPayoutItemResponse(): array
{
return Utils::jsonDecode('{
"payout_item_id": "8AELMXH8UB2P8",
"transaction_id": "0C413693MN970190K",
"activity_id": "0E158638XS0329106",
"transaction_status": "SUCCESS",
"payout_item_fee": {
"currency": "USD",
"value": "0.35"
},
"payout_batch_id": "Q8KVJG9TZTNN4",
"payout_item": {
"amount": {
"value": "9.87",
"currency": "USD"
},
"recipient_type": "EMAIL",
"note": "Thanks for your patronage!",
"receiver": "receiver@example.com",
"sender_item_id": "14Feb_234"
},
"time_processed": "2018-01-27T10:17:41Z",
"links": [
{
"rel": "self",
"href": "https://api-m.sandbox.paypal.com/v1/payments/payouts-item/8AELMXH8UB2P8",
"method": "GET"
},
{
"href": "https://api-m.sandbox.paypal.com/v1/payments/payouts/Q8KVJG9TZTNN4",
"rel": "batch",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockCancelUnclaimedBatchItemResponse(): array
{
return Utils::jsonDecode('{
"payout_item_id": "5KUDKLF8SDC7S",
"transaction_id": "1DG93452WK758815H",
"activity_id": "0E158638XS0329101",
"transaction_status": "RETURNED",
"payout_item_fee": {
"currency": "USD",
"value": "0.35"
},
"payout_batch_id": "CQMWKDQF5GFLL",
"sender_batch_id": "Payouts_2018_100006",
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"value": "9.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"receiver": "receiver@example.com",
"sender_item_id": "14Feb_234"
},
"time_processed": "2018-01-27T10:17:41Z",
"errors": {
"name": "RECEIVER_UNREGISTERED",
"message": "Receiver is unregistered",
"information_link": "https://developer.paypal.com/docs/api/payments.payouts-batch#errors"
},
"links": [
{
"rel": "self",
"href": "https://api-m.sandbox.paypal.com/v1/payments/payouts-item/5KUDKLF8SDC7S",
"method": "GET"
},
{
"rel": "batch",
"href": "https://api-m.sandbox.paypal.com/v1/payments/payouts/CQMWKDQF5GFLL",
"method": "GET"
}
]
}', true);
}
}
@@ -0,0 +1,135 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait ReferencedPayouts
{
/**
* @return array
*/
private function mockCreateReferencedBatchPayoutResponse(): array
{
return Utils::jsonDecode('{
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/payments/referenced-payouts/CDZEC5MJ8R5HY",
"rel": "self",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockShowReferencedBatchPayoutResponse(): array
{
return Utils::jsonDecode('{
"referenced_payouts": [
{
"item_id": "dVeQhMc5Ck5WPw2gWYDLzh3qM2Dp1XbRlZb9fDouzLzDhx1eMYYTFe3syHEKKx4=",
"processing_state": {
"status": "SUCCESS"
},
"reference_id": "2KP03934U4415543C",
"reference_type": "TRANSACTION_ID",
"payout_amount": {
"currency_code": "USD",
"value": "1.0"
},
"payout_destination": "KJDHGANDJ4DPZ",
"payout_transaction_id": "3KP03934U4415543D",
"disbursement_transaction_id": "4KP03934U4415543E",
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/payments/referenced-payouts-items/dVeQhMc5Ck5WPw2gWYDLzh3qM2Dp1XbRlZb9fDouzLzDhx1eMYYTFe3syHEKKx4=",
"rel": "self",
"method": "GET"
}
]
},
{
"item_id": "spK0ggOfijUiOUtbXBepp3h5tolruRWTl4aED-_6yz25POeNFABpkewSIxIXh4A=",
"processing_state": {
"status": "SUCCESS"
},
"reference_id": "8TA4226978212399L",
"reference_type": "TRANSACTION_ID",
"payout_amount": {
"currency_code": "USD",
"value": "1.0"
},
"payout_destination": "KJDHGANDJ4DPZ",
"payout_transaction_id": "4KP03934U4415543D",
"disbursement_transaction_id": "5KP03934U4415543E",
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/payments/referenced-payouts-items/spK0ggOfijUiOUtbXBepp3h5tolruRWTl4aED-_6yz25POeNFABpkewSIxIXh4A=",
"rel": "self",
"method": "GET"
}
]
}
],
"payout_directive": {
"destination": "CC-CDZEC5MJ8R5HY",
"type": "FINANCIAL_INSTRUMENT_ID"
},
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/payments/referenced-payouts/KHbwO28lWlXwi2IlToJ2IYNG4juFv6kpbFx4J9oQ5Hb24RSp96Dk5FudVHd6v4E=",
"rel": "self",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockCreateReferencedBatchPayoutItemResponse(): array
{
return Utils::jsonDecode('{
"item_id": "SOMEITEMID",
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/payments/referenced-payouts-items/SOMEITEMID",
"rel": "self",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockShowReferencedBatchPayoutItemResponse(): array
{
return Utils::jsonDecode('{
"item_id": "SOMEITEMID",
"processing_state": {
"status": "PROCESSING"
},
"reference_id": "CAPTURETXNID",
"reference_type": "TRANSACTION_ID",
"payout_amount": {
"currency_code": "USD",
"value": "2.0"
},
"payout_destination": "PAYERED",
"payout_transaction_id": "PAYOUTTXNID",
"links": [
{
"href": "https://api-m.paypal.com/v1/payments/referenced-payouts-items/SOMEITEMID",
"rel": "self",
"method": "GET"
}
]
}', true);
}
}
@@ -0,0 +1,194 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait Reporting
{
/**
* @return array
*/
private function mockListTransactionsResponse(): array
{
return Utils::jsonDecode('{
"transaction_details": [
{
"transaction_info": {
"paypal_account_id": "6STWC2LSUYYYE",
"transaction_id": "5TY05013RG002845M",
"transaction_event_code": "T0006",
"transaction_initiation_date": "2014-07-11T04:03:52+0000",
"transaction_updated_date": "2014-07-11T04:03:52+0000",
"transaction_amount": {
"currency_code": "USD",
"value": "465.00"
},
"fee_amount": {
"currency_code": "USD",
"value": "-13.79"
},
"insurance_amount": {
"currency_code": "USD",
"value": "15.00"
},
"shipping_amount": {
"currency_code": "USD",
"value": "30.00"
},
"shipping_discount_amount": {
"currency_code": "USD",
"value": "10.00"
},
"transaction_status": "S",
"transaction_subject": "Bill for your purchase",
"transaction_note": "Check out the latest sales",
"invoice_id": "Invoice-005",
"custom_field": "Thank you for your business",
"protection_eligibility": "01"
},
"payer_info": {
"account_id": "6STWC2LSUYYYE",
"email_address": "consumer@example.com",
"address_status": "Y",
"payer_status": "Y",
"payer_name": {
"given_name": "test",
"surname": "consumer",
"alternate_full_name": "test consumer"
},
"country_code": "US"
},
"shipping_info": {
"name": "Sowmith",
"address": {
"line1": "Eco Space, bellandur",
"line2": "OuterRingRoad",
"city": "Bangalore",
"country_code": "IN",
"postal_code": "560103"
}
},
"cart_info": {
"item_details": [
{
"item_code": "ItemCode-1",
"item_name": "Item1 - radio",
"item_description": "Radio",
"item_quantity": "2",
"item_unit_price": {
"currency_code": "USD",
"value": "50.00"
},
"item_amount": {
"currency_code": "USD",
"value": "100.00"
},
"tax_amounts": [
{
"tax_amount": {
"currency_code": "USD",
"value": "20.00"
}
}
],
"total_item_amount": {
"currency_code": "USD",
"value": "120.00"
},
"invoice_number": "Invoice-005"
},
{
"item_code": "ItemCode-2",
"item_name": "Item2 - Headset",
"item_description": "Headset",
"item_quantity": "3",
"item_unit_price": {
"currency_code": "USD",
"value": "100.00"
},
"item_amount": {
"currency_code": "USD",
"value": "300.00"
},
"tax_amounts": [
{
"tax_amount": {
"currency_code": "USD",
"value": "60.00"
}
}
],
"total_item_amount": {
"currency_code": "USD",
"value": "360.00"
},
"invoice_number": "Invoice-005"
},
{
"item_name": "3",
"item_quantity": "1",
"item_unit_price": {
"currency_code": "USD",
"value": "-50.00"
},
"item_amount": {
"currency_code": "USD",
"value": "-50.00"
},
"total_item_amount": {
"currency_code": "USD",
"value": "-50.00"
},
"invoice_number": "Invoice-005"
}
]
},
"store_info": {},
"auction_info": {},
"incentive_info": {}
}
],
"account_number": "XZXSPECPDZHZU",
"last_refreshed_datetime": "2017-01-02T06:59:59+0000",
"page": 1,
"total_items": 1,
"total_pages": 1,
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/reporting/transactions?start_date=2014-07-01T00:00:00-0700&end_date=2014-07-30T23:59:59-0700&transaction_id=5TY05013RG002845M&fields=all&page_size=100&page=1",
"rel": "self",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockListBalancesResponse(): array
{
return Utils::jsonDecode('{
"balance": {
"currency": "USD",
"primary": true,
"total_balance": {
"currency_code": "USD",
"value": "300.00"
},
"available_balance": {
"currency_code": "USD",
"value": "100.00"
},
"withheld_balance": {
"currency_code": "USD",
"value": "200.00"
}
},
"account_id": "QCXKLSS8GWT22",
"as_of_time": "2016-10-15T13:07:00Z",
"last_refresh_time": "2017-02-17T05:59:59Z"
}', true);
}
}
@@ -0,0 +1,274 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait Subscriptions
{
/**
* @return array
*/
private function mockCreateSubscriptionResponse(): array
{
return Utils::jsonDecode('{
"id": "I-BW452GLLEP1G",
"status": "APPROVAL_PENDING",
"status_update_time": "2018-12-10T21:20:49Z",
"plan_id": "P-5ML4271244454362WXNWU5NQ",
"start_time": "2018-11-01T00:00:00Z",
"quantity": "20",
"shipping_amount": {
"currency_code": "USD",
"value": "10.00"
},
"subscriber": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com",
"payer_id": "2J6QB8YJQSJRJ",
"shipping_address": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
}
},
"create_time": "2018-12-10T21:20:49Z",
"links": [
{
"href": "https://www.paypal.com/webapps/billing/subscriptions?ba_token=BA-2M539689T3856352J",
"rel": "approve",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G",
"rel": "edit",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G",
"rel": "self",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockGetSubscriptionDetailsResponse(): array
{
return Utils::jsonDecode('{
"id": "I-BW452GLLEP1G",
"plan_id": "P-5ML4271244454362WXNWU5NQ",
"start_time": "2019-04-10T07:00:00Z",
"quantity": "20",
"shipping_amount": {
"currency_code": "USD",
"value": "10.0"
},
"subscriber": {
"shipping_address": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
},
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com",
"payer_id": "2J6QB8YJQSJRJ"
},
"billing_info": {
"outstanding_balance": {
"currency_code": "USD",
"value": "1.0"
},
"cycle_executions": [
{
"tenure_type": "TRIAL",
"sequence": 1,
"cycles_completed": 0,
"cycles_remaining": 2,
"total_cycles": 2
},
{
"tenure_type": "TRIAL",
"sequence": 2,
"cycles_completed": 0,
"cycles_remaining": 3,
"total_cycles": 3
},
{
"tenure_type": "REGULAR",
"sequence": 3,
"cycles_completed": 0,
"cycles_remaining": 12,
"total_cycles": 12
}
],
"last_payment": {
"amount": {
"currency_code": "USD",
"value": "1.15"
},
"time": "2019-04-09T10:27:20Z"
},
"next_billing_time": "2019-04-10T10:00:00Z",
"failed_payments_count": 0
},
"create_time": "2019-04-09T10:26:04Z",
"update_time": "2019-04-09T10:27:27Z",
"links": [
{
"href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/cancel",
"rel": "cancel",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G",
"rel": "edit",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/suspend",
"rel": "suspend",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/capture",
"rel": "capture",
"method": "POST"
}
],
"status": "ACTIVE",
"status_update_time": "2019-04-09T10:27:27Z"
}', true);
}
/**
* @return array
*/
private function mockUpdateSubscriptionItemsResponse(): array
{
return Utils::jsonDecode('{
"plan_id": "P-5ML4271244454362WXNWU5NQ",
"effective_time": "2018-11-01T00:00:00Z",
"shipping_amount": {
"currency_code": "USD",
"value": "10.00"
},
"shipping_address": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
},
"links": [
{
"href": "https://www.paypal.com/webapps/billing/subscriptions/update?ba_token=BA-2M539689T3856352J",
"rel": "approve",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockListSubscriptionTransactionsResponse(): array
{
return Utils::jsonDecode('{
"transactions": [
{
"id": "TRFGHNJKOIIOJKL",
"status": "COMPLETED",
"payer_email": "customer@example.com",
"payer_name": {
"given_name": "John",
"surname": "Doe"
},
"amount_with_breakdown": {
"gross_amount": {
"currency_code": "USD",
"value": "10.00"
},
"fee_amount": {
"currency_code": "USD",
"value": "1.00"
},
"net_amount": {
"currency_code": "USD",
"value": "9.00"
}
},
"time": "2018-03-16T07:40:20.940Z"
},
{
"id": "VDFG45345FFGS",
"status": "COMPLETED",
"payer_email": "customer2@example.com",
"payer_name": {
"given_name": "Jhonny",
"surname": "Cat"
},
"amount_with_breakdown": {
"gross_amount": {
"currency_code": "USD",
"value": "15.00"
},
"fee_amount": {
"currency_code": "USD",
"value": "1.00"
},
"net_amount": {
"currency_code": "USD",
"value": "14.00"
}
},
"time": "2018-08-21T07:50:20.940Z"
}
],
"links": [
{
"href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/transactions?start_time=2018-01-21T07:50:20.940Z&end_time=2018-08-21T07:50:20.940Z",
"rel": "self",
"method": "GET"
}
]
}', true);
}
}
@@ -0,0 +1,102 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait Trackers
{
/**
* @return array
*/
private function mockGetTrackingDetailsResponse(): array
{
return Utils::jsonDecode('{
"transaction_id": "8MC585209K746392H",
"tracking_number": "443844607820",
"status": "SHIPPED",
"carrier": "FEDEX",
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",
"rel": "self"
},
{
"href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",
"rel": "replace",
"method": "PUT"
},
{
"href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch",
"rel": "create",
"method": "POST"
}
]
}', true);
}
/**
* @return array
*/
private function mockCreateTrackinginBatchesResponse(): array
{
return Utils::jsonDecode('{
"tracker_identifiers": [
{
"transaction_id": "8MC585209K746392H",
"tracking_number": "443844607820",
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",
"rel": "self",
"method": "GET"
},
{
"href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",
"rel": "replace",
"method": "PUT"
}
]
},
{
"transaction_id": "53Y56775AE587553X",
"tracking_number": "443844607821",
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/53Y56775AE587553X-443844607821",
"rel": "self",
"method": "GET"
},
{
"href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/53Y56775AE587553X-443844607821",
"rel": "replace",
"method": "PUT"
}
]
}
],
"errors": [
{
"name": "RESOURCE_NOT_FOUND",
"debug_id": "46735c7461f3d",
"message": "The specified resource does not exist.",
"details": [
{
"field": "/trackers/0/transaction_id",
"value": "8MC585309K746392H",
"location": "body",
"issue": "INVALID_TRANSACTION_ID"
}
]
}
],
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch",
"rel": "self",
"method": "POST"
}
]
}', true);
}
}
@@ -0,0 +1,534 @@
<?php
namespace Srmklive\PayPal\Tests\Mocks\Responses;
use GuzzleHttp\Utils;
trait WebHooks
{
/**
* @return array
*/
private function mockCreateWebHookResponse(): array
{
return Utils::jsonDecode('{
"id": "0EH40505U7160970P",
"url": "https://example.com/example_webhook",
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED",
"description": "A payment authorization was created."
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED",
"description": "A payment authorization was voided."
}
],
"links": [
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "delete",
"method": "DELETE"
}
]
}', true);
}
/**
* @return array
*/
private function mockListWebHookResponse(): array
{
return Utils::jsonDecode('{
"webhooks": [
{
"id": "40Y916089Y8324740",
"url": "https://example.com/example_webhook",
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED",
"description": "A payment authorization was created."
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED",
"description": "A payment authorization was voided."
}
],
"links": [
{
"href": "https://api.paypal.com/v1/notifications/webhooks/40Y916089Y8324740",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/40Y916089Y8324740",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/40Y916089Y8324740",
"rel": "delete",
"method": "DELETE"
}
]
},
{
"id": "0EH40505U7160970P",
"url": "https://example.com/another_example_webhook",
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED",
"description": "A payment authorization was created."
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED",
"description": "A payment authorization was voided."
}
],
"links": [
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "delete",
"method": "DELETE"
}
]
}
]
}', true);
}
/**
* @return array
*/
private function mockUpdateWebHookResponse(): array
{
return Utils::jsonDecode('{
"id": "0EH40505U7160970P",
"url": "https://example.com/example_webhook_2",
"event_types": [
{
"name": "PAYMENT.SALE.REFUNDED",
"description": "A sale payment was refunded."
}
],
"links": [
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "delete",
"method": "DELETE"
}
]
}', true);
}
/**
* @return array
*/
private function mockGetWebHookResponse(): array
{
return Utils::jsonDecode('{
"id": "0EH40505U7160970P",
"url": "https://example.com/example_webhook",
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED",
"description": "A payment authorization was created.",
"status": "ENABLED"
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED",
"description": "A payment authorization was voided.",
"status": "ENABLED"
}
],
"links": [
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks/0EH40505U7160970P",
"rel": "delete",
"method": "DELETE"
}
]
}', true);
}
/**
* @return array
*/
private function mockListWebHookEventsResponse(): array
{
return Utils::jsonDecode('{
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED",
"description": "A payment authorization was created.",
"status": "ENABLED"
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED",
"description": "A payment authorization was voided.",
"status": "ENABLED"
},
{
"name": "RISK.DISPUTE.CREATED",
"description": "A dispute was filed against a transaction.",
"status": "DEPRECATED"
}
]
}', true);
}
/**
* @return array
*/
private function mockListWebHookEventsTypesResponse(): array
{
return Utils::jsonDecode('{
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED",
"description": "A payment authorization was created.",
"status": "ENABLED",
"service": "amqpaymentwebhookd",
"owner": "Webhooks",
"contact": "livesupport@example.com"
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED",
"description": "A payment authorization was voided.",
"status": "ENABLED",
"service": "amqpaymentwebhookd",
"owner": "Webhooks",
"contact": "livesupport@example.com"
},
{
"name": "PAYMENT.CAPTURE.COMPLETED",
"description": "A capture payment was completed.",
"status": "ENABLED",
"service": "amqpaymentwebhookd",
"owner": "Webhooks",
"contact": "livesupport@example.com"
}
]
}', true);
}
/**
* @return array
*/
private function mockWebHookEventsListResponse(): array
{
return Utils::jsonDecode('{
"events": [
{
"id": "8PT597110X687430LKGECATA",
"create_time": "2013-06-25T21:41:28Z",
"resource_type": "authorization",
"event_version": "1.0",
"event_type": "PAYMENT.AUTHORIZATION.CREATED",
"summary": "A payment authorization was created",
"resource_version": "1.0",
"resource": {
"id": "2DC87612EK520411B",
"create_time": "2013-06-25T21:39:15Z",
"update_time": "2013-06-25T21:39:17Z",
"state": "authorized",
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.47"
}
},
"parent_payment": "PAY-36246664YD343335CKHFA4AY",
"valid_until": "2013-07-24T21:39:15Z",
"links": [
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B/capture",
"rel": "capture",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B/void",
"rel": "void",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-36246664YD343335CKHFA4AY",
"rel": "parent_payment",
"method": "GET"
}
]
},
"links": [
{
"href": "https://api.paypal.com/v1/notfications/webhooks-events/8PT597110X687430LKGECATA",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notfications/webhooks-events/8PT597110X687430LKGECATA/resend",
"rel": "resend",
"method": "POST"
}
]
},
{
"id": "HTSPGS710X687430LKGECATA",
"create_time": "2013-06-25T21:41:28Z",
"resource_type": "authorization",
"event_version": "1.0",
"event_type": "PAYMENT.AUTHORIZATION.CREATED",
"summary": "A payment authorization was created",
"resource_version": "1.0",
"resource": {
"id": "HATH7S72EK520411B",
"create_time": "2013-06-25T21:39:15Z",
"update_time": "2013-06-25T21:39:17Z",
"state": "authorized",
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.47"
}
},
"parent_payment": "PAY-ALDSFJ64YD343335CKHFA4AY",
"valid_until": "2013-07-24T21:39:15Z",
"links": [
{
"href": "https://api.paypal.com/v1/payments/authorization/HATH7S72EK520411B",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/HATH7S72EK520411B/capture",
"rel": "capture",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/HATH7S72EK520411B/void",
"rel": "void",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-HATH7S72EK520411B",
"rel": "parent_payment",
"method": "GET"
}
]
},
"links": [
{
"href": "https://api.paypal.com/v1/notfications/webhooks-events/HTSPGS710X687430LKGECATA",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notfications/webhooks-events/HTSPGS710X687430LKGECATA/resend",
"rel": "resend",
"method": "POST"
}
]
}
],
"count": 2,
"links": [
{
"href": "https://api.paypal.com/v1/notifications/webhooks-events/?start_time=2014-08-04T12:46:47-07:00&amp;end_time=2014-09-18T12:46:47-07:00&amp;page_size=2&amp;move_to=next&amp;index_time=2014-09-17T23:07:35Z&amp;index_id=3",
"rel": "next",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notifications/webhooks-events/?start_time=2014-08-04T12:46:47-07:00&amp;end_time=2014-09-18T12:46:47-07:00&amp;page_size=2&amp;move_to=previous&amp;index_time=2014-09-17T23:07:35Z&amp;index_id=0",
"rel": "previous",
"method": "GET"
}
]
}', true);
}
/**
* @return array
*/
private function mockGetWebHookEventResponse(): array
{
return Utils::jsonDecode('{
"id": "8PT597110X687430LKGECATA",
"create_time": "2013-06-25T21:41:28Z",
"resource_type": "authorization",
"event_version": "1.0",
"event_type": "PAYMENT.AUTHORIZATION.CREATED",
"summary": "A payment authorization was created",
"resource_version": "1.0",
"resource": {
"id": "2DC87612EK520411B",
"create_time": "2013-06-25T21:39:15Z",
"update_time": "2013-06-25T21:39:17Z",
"state": "authorized",
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.47"
}
},
"parent_payment": "PAY-36246664YD343335CKHFA4AY",
"valid_until": "2013-07-24T21:39:15Z",
"links": [
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B/capture",
"rel": "capture",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B/void",
"rel": "void",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-36246664YD343335CKHFA4AY",
"rel": "parent_payment",
"method": "GET"
}
]
},
"links": [
{
"href": "https://api.paypal.com/v1/notfications/webhooks-events/8PT597110X687430LKGECATA",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notfications/webhooks-events/8PT597110X687430LKGECATA/resend",
"rel": "resend",
"method": "POST"
}
]
}', true);
}
/**
* @return array
*/
private function mockResendWebHookEventNotificationResponse(): array
{
return Utils::jsonDecode('{
"id": "8PT597110X687430LKGECATA",
"create_time": "2013-06-25T21:41:28Z",
"resource_type": "authorization",
"event_version": "1.0",
"event_type": "PAYMENT.AUTHORIZATION.CREATED",
"summary": "A payment authorization was created",
"resource_version": "1.0",
"resource": {
"id": "2DC87612EK520411B",
"create_time": "2013-06-25T21:39:15Z",
"update_time": "2013-06-25T21:39:17Z",
"state": "authorized",
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.47"
}
},
"parent_payment": "PAY-36246664YD343335CKHFA4AY",
"valid_until": "2013-07-24T21:39:15Z",
"links": [
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B/capture",
"rel": "capture",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/authorization/2DC87612EK520411B/void",
"rel": "void",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-36246664YD343335CKHFA4AY",
"rel": "parent_payment",
"method": "GET"
}
]
},
"links": [
{
"href": "https://api.paypal.com/v1/notfications/webhooks-events/8PT597110X687430LKGECATA",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/notfications/webhooks-events/8PT597110X687430LKGECATA/resend",
"rel": "resend",
"method": "POST"
}
]
}', true);
}
/**
* @return array
*/
private function mockVerifyWebHookSignatureResponse(): array
{
return Utils::jsonDecode('{
"verification_status": "SUCCESS"
}', true);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:619ee24c6d20e1087214ee3012db6273f6454925b610b3cdc855d9c0776f04ea
size 32490
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

@@ -0,0 +1 @@
This is a sample.
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:040873716d7524beef0403afa8d7f7e3b741320dbd17dd631ed9c552d4db56f4
size 11534336