Skip to content

Commit

Permalink
test checking the country of origin of a donation
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed May 7, 2024
1 parent db4fe8e commit 27fec00
Show file tree
Hide file tree
Showing 3 changed files with 486 additions and 5 deletions.
210 changes: 206 additions & 4 deletions tests/py/fixtures/TestPayinsPayPal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,26 @@ interactions:
method: POST
uri: https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E/capture
response:
body: {string: "{\"id\":\"91V21788MR556192E\",\"intent\":\"CAPTURE\",\"purchase_units\":[{\"reference_id\":\"1\",\"amount\":{\"currency_code\":\"EUR\",\"value\":\"10.00\"},\"payee\":{\"email_address\":\"[email protected]\",\"merchant_id\":\"JHLE5TP6LL2XG\"},\"description\":\"Liberapay
donation to creator_2 | 1,000 weeks of \u20AC0.01\",\"custom_id\":\"1\",\"payments\":{\"captures\":[{\"id\":\"17C68461PR5228043\",\"status\":\"PENDING\",\"status_details\":{\"reason\":\"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION\"},\"amount\":{\"currency_code\":\"EUR\",\"value\":\"10.00\"},\"final_capture\":true,\"seller_protection\":{\"status\":\"ELIGIBLE\",\"dispute_categories\":[\"ITEM_NOT_RECEIVED\",\"UNAUTHORIZED_TRANSACTION\"]},\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/17C68461PR5228043\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/17C68461PR5228043/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E\",\"rel\":\"up\",\"method\":\"GET\"}],\"create_time\":\"2019-02-13T19:16:21Z\",\"update_time\":\"2019-02-13T19:16:21Z\"}]}}],\"payer\":{\"name\":{\"given_name\":\"test\",\"surname\":\"buyer\"},\"email_address\":\"[email protected]\",\"payer_id\":\"6C9EQBCEQY4MA\",\"phone\":{\"phone_number\":{\"national_number\":\"045-924-8496\"}},\"address\":{\"country_code\":\"FR\"}},\"create_time\":\"2019-02-13T19:16:21Z\",\"update_time\":\"2019-02-13T19:16:21Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E\",\"rel\":\"self\",\"method\":\"GET\"}],\"status\":\"COMPLETED\"}"}
body: {string: "{\"id\":\"91V21788MR556192E\",\"intent\":\"CAPTURE\",\"purchase_units\"\
:[{\"reference_id\":\"1\",\"amount\":{\"currency_code\":\"EUR\",\"value\"\
:\"10.00\"},\"payee\":{\"email_address\":\"[email protected]\",\"merchant_id\"\
:\"JHLE5TP6LL2XG\"},\"description\":\"Liberapay donation to creator_2 | 1,000\
\ weeks of \u20AC0.01\",\"custom_id\":\"1\",\"payments\":{\"captures\":[{\"\
id\":\"17C68461PR5228043\",\"status\":\"PENDING\",\"status_details\":{\"reason\"\
:\"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION\"},\"amount\":{\"currency_code\"\
:\"EUR\",\"value\":\"10.00\"},\"final_capture\":true,\"seller_protection\"\
:{\"status\":\"ELIGIBLE\",\"dispute_categories\":[\"ITEM_NOT_RECEIVED\",\"\
UNAUTHORIZED_TRANSACTION\"]},\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/17C68461PR5228043\"\
,\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/17C68461PR5228043/refund\"\
,\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E\"\
,\"rel\":\"up\",\"method\":\"GET\"}],\"create_time\":\"2019-02-13T19:16:21Z\"\
,\"update_time\":\"2019-02-13T19:16:21Z\"}]}}],\"payer\":{\"name\":{\"given_name\"\
:\"test\",\"surname\":\"buyer\"},\"email_address\":\"[email protected]\"\
,\"payer_id\":\"6C9EQBCEQY4MA\",\"phone\":{\"phone_number\":{\"national_number\"\
:\"045-924-8496\"}},\"address\":{\"country_code\":\"FR\"}},\"create_time\"\
:\"2019-02-13T19:16:21Z\",\"update_time\":\"2019-02-13T19:16:21Z\",\"links\"\
:[{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E\"\
,\"rel\":\"self\",\"method\":\"GET\"}],\"status\":\"COMPLETED\"}"}
headers:
Connection: [close]
Content-Length: ['1474']
Expand Down Expand Up @@ -84,8 +102,26 @@ interactions:
method: GET
uri: https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E
response:
body: {string: "{\"id\":\"91V21788MR556192E\",\"intent\":\"CAPTURE\",\"purchase_units\":[{\"reference_id\":\"1\",\"amount\":{\"currency_code\":\"EUR\",\"value\":\"10.00\"},\"payee\":{\"email_address\":\"[email protected]\",\"merchant_id\":\"JHLE5TP6LL2XG\",\"display_data\":{\"brand_name\":\"Liberapay\"}},\"description\":\"Liberapay
donation to creator_2 | 1,000 weeks of \u20AC0.01\",\"custom_id\":\"1\",\"soft_descriptor\":\"Liberapay\",\"payments\":{\"captures\":[{\"id\":\"17C68461PR5228043\",\"status\":\"PENDING\",\"status_details\":{\"reason\":\"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION\"},\"amount\":{\"currency_code\":\"EUR\",\"value\":\"10.00\"},\"final_capture\":true,\"seller_protection\":{\"status\":\"ELIGIBLE\",\"dispute_categories\":[\"ITEM_NOT_RECEIVED\",\"UNAUTHORIZED_TRANSACTION\"]},\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/17C68461PR5228043\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/17C68461PR5228043/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E\",\"rel\":\"up\",\"method\":\"GET\"}],\"create_time\":\"2019-02-13T19:16:21Z\",\"update_time\":\"2019-02-13T19:16:21Z\"}]}}],\"payer\":{\"name\":{\"given_name\":\"test\",\"surname\":\"buyer\"},\"email_address\":\"[email protected]\",\"payer_id\":\"6C9EQBCEQY4MA\",\"address\":{\"country_code\":\"FR\"}},\"create_time\":\"2019-02-13T19:14:47Z\",\"update_time\":\"2019-02-13T19:16:21Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E\",\"rel\":\"self\",\"method\":\"GET\"}],\"status\":\"COMPLETED\"}"}
body: {string: "{\"id\":\"91V21788MR556192E\",\"intent\":\"CAPTURE\",\"purchase_units\"\
:[{\"reference_id\":\"1\",\"amount\":{\"currency_code\":\"EUR\",\"value\"\
:\"10.00\"},\"payee\":{\"email_address\":\"[email protected]\",\"merchant_id\"\
:\"JHLE5TP6LL2XG\",\"display_data\":{\"brand_name\":\"Liberapay\"}},\"description\"\
:\"Liberapay donation to creator_2 | 1,000 weeks of \u20AC0.01\",\"custom_id\"\
:\"1\",\"soft_descriptor\":\"Liberapay\",\"payments\":{\"captures\":[{\"id\"\
:\"17C68461PR5228043\",\"status\":\"PENDING\",\"status_details\":{\"reason\"\
:\"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION\"},\"amount\":{\"currency_code\"\
:\"EUR\",\"value\":\"10.00\"},\"final_capture\":true,\"seller_protection\"\
:{\"status\":\"ELIGIBLE\",\"dispute_categories\":[\"ITEM_NOT_RECEIVED\",\"\
UNAUTHORIZED_TRANSACTION\"]},\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/17C68461PR5228043\"\
,\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/17C68461PR5228043/refund\"\
,\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E\"\
,\"rel\":\"up\",\"method\":\"GET\"}],\"create_time\":\"2019-02-13T19:16:21Z\"\
,\"update_time\":\"2019-02-13T19:16:21Z\"}]}}],\"payer\":{\"name\":{\"given_name\"\
:\"test\",\"surname\":\"buyer\"},\"email_address\":\"[email protected]\"\
,\"payer_id\":\"6C9EQBCEQY4MA\",\"address\":{\"country_code\":\"FR\"}},\"\
create_time\":\"2019-02-13T19:14:47Z\",\"update_time\":\"2019-02-13T19:16:21Z\"\
,\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/91V21788MR556192E\"\
,\"rel\":\"self\",\"method\":\"GET\"}],\"status\":\"COMPLETED\"}"}
headers:
Connection: [close]
Content-Length: ['1486']
Expand All @@ -100,4 +136,170 @@ interactions:
Vary: [Authorization]
paypal-debug-id: [3d5f5d06b432b, 3d5f5d06b432b]
status: {code: 200, message: OK}
- request:
body: '{"intent": "CAPTURE", "application_context": {"brand_name": "Liberapay",
"cancel_url": "http://localhost/donor/giving/pay/paypal/1?cancel", "locale":
"en-US", "landing_page": "BILLING", "shipping_preference": "NO_SHIPPING", "user_action":
"PAY_NOW", "return_url": "http://localhost/donor/giving/pay/paypal/1"}, "purchase_units":
[{"amount": {"value": "10.00", "currency_code": "EUR"}, "custom_id": "1", "description":
"Liberapay donation to creator_2 | 1,000 weeks of \u20ac0.01", "payee": {"email_address":
"[email protected]"}, "reference_id": "1", "soft_descriptor": "Liberapay"}]}'
headers: {}
method: POST
uri: https://api.sandbox.paypal.com/v2/checkout/orders
response:
body: {string: '{"id":"FFFFFFFFFFFFFFFFF","status":"CREATED","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/FFFFFFFFFFFFFFFFF","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=FFFFFFFFFFFFFFFFF","rel":"approve","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/FFFFFFFFFFFFFFFFF","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/FFFFFFFFFFFFFFFFF/capture","rel":"capture","method":"POST"}]}'}
headers:
Access-Control-Expose-Headers: [Server-Timing]
Application_id: [APP-80W284485P519543T]
Cache-Control: ['max-age=0, no-cache, no-store, must-revalidate']
Caller_acct_num: [J6JDZYCYZPCXU]
Connection: [keep-alive]
Content-Length: ['501']
Content-Type: [application/json]
Date: ['Sun, 05 May 2024 09:52:01 GMT']
Paypal-Debug-Id: [0120dd42cdb2b]
Server-Timing: [traceparent;desc="00-00000000000000000000120dd42cdb2b-a4d6dd88cac2014d-01"]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Vary: [Accept-Encoding]
status: {code: 201, message: Created}
- request:
body: null
headers: {}
method: GET
uri: https://api.sandbox.paypal.com/v2/checkout/orders/FFFFFFFFFFFFFFFFF
response:
body: {string: "{\"id\":\"FFFFFFFFFFFFFFFFF\",\"intent\":\"CAPTURE\",\"status\"\
:\"APPROVED\",\"payment_source\":{\"paypal\":{\"email_address\":\"[email protected]\"\
,\"account_id\":\"6C9EQBCEQY4MA\",\"account_status\":\"VERIFIED\",\"name\"\
:{\"given_name\":\"test\",\"surname\":\"buyer\"},\"address\":{\"country_code\"\
:\"FI\"}}},\"purchase_units\":[{\"reference_id\":\"1\",\"amount\":{\"currency_code\"\
:\"EUR\",\"value\":\"10.00\"},\"payee\":{\"email_address\":\"[email protected]\"\
,\"display_data\":{\"brand_name\":\"Liberapay\"}},\"description\":\"Liberapay\
\ donation to creator_2 | 1,000 weeks of \u20AC0.01\",\"custom_id\":\"1\"\
,\"soft_descriptor\":\"Liberapay\"}],\"payer\":{\"name\":{\"given_name\":\"\
test\",\"surname\":\"buyer\"},\"email_address\":\"[email protected]\"\
,\"payer_id\":\"6C9EQBCEQY4MA\",\"address\":{\"country_code\":\"FI\"}},\"\
create_time\":\"2024-05-05T09:52:00Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/FFFFFFFFFFFFFFFFF\"\
,\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/FFFFFFFFFFFFFFFFF\"\
,\"rel\":\"update\",\"method\":\"PATCH\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/FFFFFFFFFFFFFFFFF/capture\"\
,\"rel\":\"capture\",\"method\":\"POST\"}]}"}
headers:
Access-Control-Expose-Headers: [Server-Timing]
Application_id: [APP-80W284485P519543T]
Cache-Control: ['max-age=0, no-cache, no-store, must-revalidate']
Caller_acct_num: [J6JDZYCYZPCXU]
Connection: [keep-alive]
Content-Length: ['1113']
Content-Type: [application/json]
Date: ['Sun, 05 May 2024 11:12:42 GMT']
Paypal-Debug-Id: [616f140566957]
Server-Timing: [traceparent;desc="00-0000000000000000000616f140566957-f6cc0fa8b57e0c06-01"]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: '{"intent": "CAPTURE", "application_context": {"brand_name": "Liberapay",
"cancel_url": "http://localhost/donor/giving/pay/paypal/1?cancel", "locale":
"en-US", "landing_page": "BILLING", "shipping_preference": "NO_SHIPPING", "user_action":
"PAY_NOW", "return_url": "http://localhost/donor/giving/pay/paypal/1"}, "purchase_units":
[{"amount": {"value": "10.00", "currency_code": "EUR"}, "custom_id": "1", "description":
"Liberapay donation to creator_2 | 1,000 weeks of \u20ac0.01", "payee": {"email_address":
"[email protected]"}, "reference_id": "1", "soft_descriptor": "Liberapay"}]}'
headers: {}
method: POST
uri: https://api.sandbox.paypal.com/v2/checkout/orders
response:
body: {string: '{"id":"8UK19239YC952053V","status":"CREATED","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=8UK19239YC952053V","rel":"approve","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V/capture","rel":"capture","method":"POST"}]}'}
headers:
Access-Control-Expose-Headers: [Server-Timing]
Application_id: [APP-80W284485P519543T]
Cache-Control: ['max-age=0, no-cache, no-store, must-revalidate']
Caller_acct_num: [J6JDZYCYZPCXU]
Connection: [keep-alive]
Content-Length: ['501']
Content-Type: [application/json]
Date: ['Sun, 05 May 2024 09:52:01 GMT']
Paypal-Debug-Id: [0120dd42cdb2b]
Server-Timing: [traceparent;desc="00-00000000000000000000120dd42cdb2b-a4d6dd88cac2014d-01"]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Vary: [Accept-Encoding]
status: {code: 201, message: Created}
- request:
body: null
headers: {}
method: GET
uri: https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V
response:
body: {string: "{\"id\":\"8UK19239YC952053V\",\"intent\":\"CAPTURE\",\"status\"\
:\"APPROVED\",\"payment_source\":{\"paypal\":{\"email_address\":\"[email protected]\"\
,\"account_id\":\"6C9EQBCEQY4MA\",\"account_status\":\"VERIFIED\",\"name\"\
:{\"given_name\":\"test\",\"surname\":\"buyer\"},\"address\":{\"country_code\"\
:\"FR\"}}},\"purchase_units\":[{\"reference_id\":\"1\",\"amount\":{\"currency_code\"\
:\"EUR\",\"value\":\"10.00\"},\"payee\":{\"email_address\":\"[email protected]\"\
,\"display_data\":{\"brand_name\":\"Liberapay\"}},\"description\":\"Liberapay\
\ donation to creator_2 | 1,000 weeks of \u20AC0.01\",\"custom_id\":\"1\"\
,\"soft_descriptor\":\"Liberapay\"}],\"payer\":{\"name\":{\"given_name\":\"\
test\",\"surname\":\"buyer\"},\"email_address\":\"[email protected]\"\
,\"payer_id\":\"6C9EQBCEQY4MA\",\"address\":{\"country_code\":\"FR\"}},\"\
create_time\":\"2024-05-05T09:52:00Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V\"\
,\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V\"\
,\"rel\":\"update\",\"method\":\"PATCH\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V/capture\"\
,\"rel\":\"capture\",\"method\":\"POST\"}]}"}
headers:
Access-Control-Expose-Headers: [Server-Timing]
Application_id: [APP-80W284485P519543T]
Cache-Control: ['max-age=0, no-cache, no-store, must-revalidate']
Caller_acct_num: [J6JDZYCYZPCXU]
Connection: [keep-alive]
Content-Length: ['1113']
Content-Type: [application/json]
Date: ['Sun, 05 May 2024 11:12:42 GMT']
Paypal-Debug-Id: [616f140566957]
Server-Timing: [traceparent;desc="00-0000000000000000000616f140566957-f6cc0fa8b57e0c06-01"]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: '{}'
headers: {}
method: POST
uri: https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V/capture
response:
body: {string: "{\"id\":\"8UK19239YC952053V\",\"intent\":\"CAPTURE\",\"status\"\
:\"COMPLETED\",\"payment_source\":{\"paypal\":{\"email_address\":\"[email protected]\"\
,\"account_id\":\"6C9EQBCEQY4MA\",\"account_status\":\"VERIFIED\",\"name\"\
:{\"given_name\":\"test\",\"surname\":\"buyer\"},\"address\":{\"country_code\"\
:\"FR\"}}},\"purchase_units\":[{\"reference_id\":\"1\",\"amount\":{\"currency_code\"\
:\"EUR\",\"value\":\"10.00\"},\"payee\":{\"email_address\":\"[email protected]\"\
,\"merchant_id\":\"JHLE5TP6LL2XG\"},\"description\":\"Liberapay donation to\
\ creator_2 | 1,000 weeks of \u20AC0.01\",\"custom_id\":\"1\",\"payments\"\
:{\"captures\":[{\"id\":\"6RP19274J6003302M\",\"status\":\"PENDING\",\"status_details\"\
:{\"reason\":\"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION\"},\"amount\":{\"\
currency_code\":\"EUR\",\"value\":\"10.00\"},\"final_capture\":true,\"seller_protection\"\
:{\"status\":\"ELIGIBLE\",\"dispute_categories\":[\"ITEM_NOT_RECEIVED\",\"\
UNAUTHORIZED_TRANSACTION\"]},\"custom_id\":\"1\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/6RP19274J6003302M\"\
,\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v2/payments/captures/6RP19274J6003302M/refund\"\
,\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V\"\
,\"rel\":\"up\",\"method\":\"GET\"}],\"create_time\":\"2024-05-05T11:12:43Z\"\
,\"update_time\":\"2024-05-05T11:12:43Z\"}]}}],\"payer\":{\"name\":{\"given_name\"\
:\"test\",\"surname\":\"buyer\"},\"email_address\":\"[email protected]\"\
,\"payer_id\":\"6C9EQBCEQY4MA\",\"address\":{\"country_code\":\"FR\"}},\"\
create_time\":\"2024-05-05T09:52:00Z\",\"update_time\":\"2024-05-05T11:12:43Z\"\
,\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v2/checkout/orders/8UK19239YC952053V\"\
,\"rel\":\"self\",\"method\":\"GET\"}]}"}
headers:
Access-Control-Expose-Headers: [Server-Timing]
Application_id: [APP-80W284485P519543T]
Cache-Control: ['max-age=0, no-cache, no-store, must-revalidate']
Caller_acct_num: [J6JDZYCYZPCXU]
Connection: [keep-alive]
Content-Length: ['1640']
Content-Type: [application/json]
Date: ['Sun, 05 May 2024 11:12:43 GMT']
Paypal-Debug-Id: [045a0cf469ece]
Server-Timing: [traceparent;desc="00-0000000000000000000045a0cf469ece-e82f294828b847b8-01"]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Vary: [Accept-Encoding]
status: {code: 201, message: Created}
version: 1
Loading

0 comments on commit 27fec00

Please sign in to comment.