| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <?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);
- }
- }
|