workarea-paypal 2.0.9 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.json +2 -1
- data/.gitignore +16 -11
- data/CHANGELOG.md +79 -0
- data/README.md +105 -6
- data/Rakefile +4 -5
- data/UPGRADE.md +46 -0
- data/app/assets/javascripts/workarea/storefront/paypal/config.js.erb +44 -0
- data/app/assets/javascripts/workarea/storefront/paypal/modules/paypal_buttons.js +71 -0
- data/app/assets/javascripts/workarea/storefront/paypal/modules/paypal_hosted_fields.js +96 -0
- data/app/assets/javascripts/workarea/storefront/paypal/modules/update_checkout_submit_text.js +11 -5
- data/app/assets/javascripts/workarea/storefront/paypal/templates/paypal_fields.jst.ejs +43 -0
- data/app/controllers/workarea/storefront/checkout/place_order_controller.decorator +6 -4
- data/app/controllers/workarea/storefront/paypal_controller.rb +32 -26
- data/app/helpers/workarea/storefront/paypal_helper.rb +38 -0
- data/app/models/workarea/payment.decorator +17 -3
- data/app/models/workarea/payment/authorize/paypal.rb +13 -13
- data/app/models/workarea/payment/capture/paypal.rb +10 -20
- data/app/models/workarea/payment/null_address.rb +37 -0
- data/app/models/workarea/payment/purchase/paypal.rb +1 -25
- data/app/models/workarea/payment/refund/paypal.rb +3 -6
- data/app/models/workarea/payment/tender/paypal.rb +14 -2
- data/app/services/workarea/paypal/approve_order.rb +104 -0
- data/app/services/workarea/paypal/create_order.rb +177 -0
- data/app/services/workarea/paypal/update_order.rb +44 -0
- data/app/views/workarea/admin/orders/tenders/_paypal.html.haml +5 -2
- data/app/views/workarea/api/orders/tenders/_paypal.json.jbuilder +7 -1
- data/app/views/workarea/storefront/carts/_paypal_checkout.html.haml +6 -1
- data/app/views/workarea/storefront/checkouts/_paypal_payment.html.haml +16 -5
- data/app/views/workarea/storefront/order_mailer/tenders/_paypal.html.haml +5 -3
- data/app/views/workarea/storefront/orders/tenders/_paypal.html.haml +9 -2
- data/app/views/workarea/storefront/paypal/_paypal_sdk.html.haml +1 -0
- data/app/workers/workarea/paypal/handle_webhook_event.rb +64 -0
- data/config/initializers/append_points.rb +17 -5
- data/config/initializers/fields.rb +27 -0
- data/config/initializers/workarea.rb +41 -5
- data/config/locales/en.yml +14 -4
- data/config/routes.rb +3 -2
- data/lib/tasks/workarea/create_webhooks.rake +29 -0
- data/lib/workarea/paypal.rb +22 -18
- data/lib/workarea/paypal/engine.rb +4 -0
- data/lib/workarea/paypal/gateway.rb +200 -0
- data/lib/workarea/paypal/requests/create_webhook.rb +21 -0
- data/lib/workarea/paypal/requests/delete_webhook.rb +17 -0
- data/lib/workarea/paypal/requests/generate_token.rb +21 -0
- data/lib/workarea/paypal/requests/list_webhooks.rb +17 -0
- data/lib/workarea/paypal/version.rb +1 -1
- data/package.json +9 -0
- data/test/dummy/config/initializers/workarea.rb +1 -1
- data/test/factories/workarea/capture_completed_webhook.json +70 -0
- data/test/factories/workarea/capture_denied_webhook.json +68 -0
- data/test/factories/workarea/paypal.rb +34 -0
- data/test/helpers/workarea/storefront/paypal_helper_test.rb +35 -0
- data/test/integration/workarea/storefront/paypal_integration_test.rb +104 -294
- data/test/integration/workarea/storefront/paypal_place_order_integration_test.rb +42 -0
- data/test/lib/workarea/paypal/gateway_test.rb +236 -0
- data/test/models/workarea/payment/authorize/paypal_test.rb +57 -46
- data/test/models/workarea/payment/capture/paypal_test.rb +9 -51
- data/test/models/workarea/payment/null_address_test.rb +53 -0
- data/test/models/workarea/payment/refund/paypal_test.rb +39 -38
- data/test/models/workarea/paypal_payment_test.rb +65 -0
- data/test/models/workarea/search/paypal_order_text_test.rb +14 -0
- data/test/services/workarea/paypal/approve_order_test.rb +35 -0
- data/test/services/workarea/paypal/create_order_test.rb +127 -0
- data/test/services/workarea/paypal/update_order_test.rb +73 -0
- data/test/support/workarea/paypal_setup.rb +49 -0
- data/test/system/workarea/storefront/cart_system_test.decorator +1 -1
- data/test/system/workarea/storefront/logged_in_checkout_system_test.decorator +1 -1
- data/test/vcr_cassettes/paypal_approve_order.yml +106 -0
- data/test/vcr_cassettes/paypal_create_order.yml +110 -0
- data/test/vcr_cassettes/paypal_gateway_create_order.yml +105 -0
- data/test/vcr_cassettes/paypal_gateway_generate_token.yml +103 -0
- data/test/vcr_cassettes/paypal_gateway_get_order.yml +103 -0
- data/test/vcr_cassettes/paypal_gateway_update_order.yml +199 -0
- data/test/vcr_cassettes/paypal_gateway_webhooks.yml +403 -0
- data/test/vcr_cassettes/paypal_update_order.yml +204 -0
- data/test/workers/workarea/paypal/handle_webhook_event_test.rb +60 -0
- data/workarea-paypal.gemspec +2 -1
- metadata +65 -14
- data/app/services/workarea/paypal/setup.rb +0 -114
- data/app/services/workarea/paypal/update.rb +0 -69
- data/app/views/workarea/storefront/checkouts/_paypal_error.html.haml +0 -6
- data/app/views/workarea/storefront/order_mailer/tenders/_paypal.text.haml +0 -2
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/integration/workarea/storefront/place_order_integration_test.decorator +0 -11
- data/test/models/workarea/payment/purchase/paypal_test.rb +0 -94
- data/test/models/workarea/payment_test.decorator +0 -34
- data/test/models/workarea/search/admin/order_test.decorator +0 -32
- data/test/services/workarea/paypal/setup_test.rb +0 -120
- data/test/services/workarea/paypal/update_test.rb +0 -221
@@ -0,0 +1,49 @@
|
|
1
|
+
module Workarea
|
2
|
+
module PaypalSetup
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
setup :set_paypal_credentials
|
7
|
+
teardown :reset_paypal_credentials
|
8
|
+
end
|
9
|
+
|
10
|
+
def set_paypal_credentials
|
11
|
+
@env_paypal_client_id = ENV['WORKAREA_PAYPAL_CLIENT_ID']
|
12
|
+
@env_paypal_client_secret = ENV['WORKAREA_PAYPAL_CLIENT_SECRET']
|
13
|
+
|
14
|
+
# If you need to re-record any VCR cassettes, you will need to replace
|
15
|
+
# these will real credentials, then update the OAuth request's
|
16
|
+
# basic auth header to use these credentials, base64 encoded 'ID:SECRET',
|
17
|
+
# in the recorded request to prevent committing real credentials.
|
18
|
+
#
|
19
|
+
ENV['WORKAREA_PAYPAL_CLIENT_ID'] = 'FAKE_PAYPAL_CLIENT_ID'
|
20
|
+
ENV['WORKAREA_PAYPAL_CLIENT_SECRET'] = 'FAKE_PAYPAL_CLIENT_SECRET'
|
21
|
+
end
|
22
|
+
|
23
|
+
def reset_paypal_credentials
|
24
|
+
ENV['WORKAREA_PAYPAL_CLIENT_ID'] = @env_paypal_client_id
|
25
|
+
ENV['WORKAREA_PAYPAL_CLIENT_SECRET'] = @env_paypal_client_secret
|
26
|
+
end
|
27
|
+
|
28
|
+
def checkout
|
29
|
+
@order ||= begin
|
30
|
+
create_product(variants: [{ sku: 'SKU', regular: 5.to_m }])
|
31
|
+
create_tax_category(name: 'Sales Tax', code: '001')
|
32
|
+
Pricing::Sku.find('SKU').update!(tax_code: '001')
|
33
|
+
|
34
|
+
order = create_order(id: 'PAYPAL_TEST', email: 'test@workarea.com')
|
35
|
+
order.add_item(
|
36
|
+
{ sku: 'SKU', quantity: 2 }.merge(OrderItemDetails.find('SKU').to_h)
|
37
|
+
)
|
38
|
+
|
39
|
+
Checkout.new(order).tap do |checkout|
|
40
|
+
checkout.update(
|
41
|
+
shipping_address: factory_defaults(:shipping_address),
|
42
|
+
billing_address: factory_defaults(:billing_address),
|
43
|
+
shipping_service: create_shipping_service(name: 'Ground').name
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -8,7 +8,7 @@ module Workarea
|
|
8
8
|
assert(page.has_content?(t('workarea.storefront.flash_messages.cart_item_added')))
|
9
9
|
|
10
10
|
visit storefront.cart_path
|
11
|
-
assert(
|
11
|
+
assert(page.has_selector?('#paypal-button-container', visible: false))
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
module Workarea
|
4
4
|
decorate Storefront::LoggedInCheckoutSystemTest, with: :paypal do
|
5
5
|
def test_paypal_option_in_checkout
|
6
|
-
assert(page.has_css?('#
|
6
|
+
assert(page.has_css?('#paypal-button-container', visible: false))
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.sandbox.paypal.com/v1/oauth2/token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: grant_type=client_credentials
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
Authorization:
|
13
|
+
- Basic RkFLRV9QQVlQQUxfQ0xJRU5UX0lEOkZBS0VfUEFZUEFMX0NMSUVOVF9TRUNS\nRVQ=
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip
|
16
|
+
Sdk-Name:
|
17
|
+
- Checkout SDK
|
18
|
+
Sdk-Version:
|
19
|
+
- 1.0.3
|
20
|
+
Sdk-Tech-Stack:
|
21
|
+
- Ruby2.6.3
|
22
|
+
Api-Integration-Type:
|
23
|
+
- PAYPALSDK
|
24
|
+
User-Agent:
|
25
|
+
- PayPalSDK/rest-sdk-ruby 1.0.3 (paypal-checkout-sdk 1.0.3; ruby 2.6.3p62-x86_64-darwin18;OpenSSL
|
26
|
+
1.0.2s 28 May 2019)
|
27
|
+
Accept:
|
28
|
+
- "*/*"
|
29
|
+
response:
|
30
|
+
status:
|
31
|
+
code: 200
|
32
|
+
message: OK
|
33
|
+
headers:
|
34
|
+
Cache-Control:
|
35
|
+
- max-age=0, no-cache, no-store, must-revalidate
|
36
|
+
Content-Length:
|
37
|
+
- '918'
|
38
|
+
Content-Type:
|
39
|
+
- application/json
|
40
|
+
Date:
|
41
|
+
- Wed, 29 Jan 2020 18:24:56 GMT
|
42
|
+
Paypal-Debug-Id:
|
43
|
+
- 5d1cf521e0d53
|
44
|
+
X-Paypal-Token-Service:
|
45
|
+
- IAAS
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: '{"scope":"https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer
|
49
|
+
https://uri.paypal.com/services/payments/realtimepayment https://uri.paypal.com/services/disputes/update-seller
|
50
|
+
https://uri.paypal.com/services/payments/payment/authcapture openid https://uri.paypal.com/services/disputes/read-seller
|
51
|
+
https://uri.paypal.com/services/payments/refund https://api.paypal.com/v1/vault/credit-card
|
52
|
+
https://api.paypal.com/v1/payments/.* https://uri.paypal.com/payments/payouts
|
53
|
+
https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions
|
54
|
+
https://uri.paypal.com/services/applications/webhooks","access_token":"A21AAH8JBaCq97a9fIWYVjR13RiayfAPxcb-o5l9hZ57HACn0JwaefBkRcSfh9rEwmZR6JozBLLU2MsRYTuFsZ91mOZR9jFMQ","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":32146,"nonce":"2020-01-29T18:20:43ZDKF3VcEmtOhEC5S6ZO80QnoxtZ-lP5lrj73RBoqrBwI"}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Wed, 29 Jan 2020 18:24:57 GMT
|
57
|
+
- request:
|
58
|
+
method: get
|
59
|
+
uri: https://api.sandbox.paypal.com/v2/checkout/orders/6DJ616473D999571D
|
60
|
+
body:
|
61
|
+
encoding: US-ASCII
|
62
|
+
string: ''
|
63
|
+
headers:
|
64
|
+
Content-Type:
|
65
|
+
- application/json
|
66
|
+
Authorization:
|
67
|
+
- Bearer A21AAH8JBaCq97a9fIWYVjR13RiayfAPxcb-o5l9hZ57HACn0JwaefBkRcSfh9rEwmZR6JozBLLU2MsRYTuFsZ91mOZR9jFMQ
|
68
|
+
Accept-Encoding:
|
69
|
+
- gzip
|
70
|
+
Sdk-Name:
|
71
|
+
- Checkout SDK
|
72
|
+
Sdk-Version:
|
73
|
+
- 1.0.3
|
74
|
+
Sdk-Tech-Stack:
|
75
|
+
- Ruby2.6.3
|
76
|
+
Api-Integration-Type:
|
77
|
+
- PAYPALSDK
|
78
|
+
User-Agent:
|
79
|
+
- PayPalSDK/rest-sdk-ruby 1.0.3 (paypal-checkout-sdk 1.0.3; ruby 2.6.3p62-x86_64-darwin18;OpenSSL
|
80
|
+
1.0.2s 28 May 2019)
|
81
|
+
Accept:
|
82
|
+
- "*/*"
|
83
|
+
response:
|
84
|
+
status:
|
85
|
+
code: 200
|
86
|
+
message: OK
|
87
|
+
headers:
|
88
|
+
Cache-Control:
|
89
|
+
- max-age=0, no-cache, no-store, must-revalidate
|
90
|
+
Content-Length:
|
91
|
+
- '1382'
|
92
|
+
Content-Type:
|
93
|
+
- application/json
|
94
|
+
Date:
|
95
|
+
- Wed, 29 Jan 2020 18:24:57 GMT
|
96
|
+
Paypal-Debug-Id:
|
97
|
+
- e89624b2772bb
|
98
|
+
body:
|
99
|
+
encoding: UTF-8
|
100
|
+
string: '{"id":"6DJ616473D999571D","intent":"CAPTURE","purchase_units":[{"reference_id":"default","amount":{"currency_code":"USD","value":"11.60","breakdown":{"item_total":{"currency_code":"USD","value":"10.00"},"shipping":{"currency_code":"USD","value":"1.00"},"tax_total":{"currency_code":"USD","value":"0.60"},"shipping_discount":{"currency_code":"USD","value":"0.00"}}},"payee":{"email_address":"sb-43jrhs896881@business.example.com","merchant_id":"M3XMHZJKTFK88","display_data":{"brand_name":"Workarea
|
101
|
+
Paypal Plugin"}},"custom_id":"PAYPAL_TEST","items":[{"name":"Test Product","unit_amount":{"currency_code":"USD","value":"5.00"},"tax":{"currency_code":"USD","value":"0.30"},"quantity":"2","description":"","sku":"SKU","category":"PHYSICAL_GOODS"}],"shipping":{"method":"Ground","name":{"full_name":"Ben
|
102
|
+
Crouse"},"address":{"address_line_1":"22 S. 3rd St.","address_line_2":"Second
|
103
|
+
Floor","admin_area_2":"Philadelphia","admin_area_1":"PA","postal_code":"19106","country_code":"US"}}}],"payer":{"email_address":"test@workarea.com","payer_id":"123456","address":{"country_code":"US"}},"create_time":"2020-01-29T18:20:45Z","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/6DJ616473D999571D","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=6DJ616473D999571D","rel":"approve","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/6DJ616473D999571D/capture","rel":"capture","method":"POST"}],"status":"APPROVED"}'
|
104
|
+
http_version:
|
105
|
+
recorded_at: Wed, 29 Jan 2020 18:24:57 GMT
|
106
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,110 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.sandbox.paypal.com/v1/oauth2/token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: grant_type=client_credentials
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
Authorization:
|
13
|
+
- Basic RkFLRV9QQVlQQUxfQ0xJRU5UX0lEOkZBS0VfUEFZUEFMX0NMSUVOVF9TRUNS\nRVQ=
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip
|
16
|
+
Sdk-Name:
|
17
|
+
- Checkout SDK
|
18
|
+
Sdk-Version:
|
19
|
+
- 1.0.3
|
20
|
+
Sdk-Tech-Stack:
|
21
|
+
- Ruby2.6.3
|
22
|
+
Api-Integration-Type:
|
23
|
+
- PAYPALSDK
|
24
|
+
User-Agent:
|
25
|
+
- PayPalSDK/rest-sdk-ruby 1.0.3 (paypal-checkout-sdk 1.0.3; ruby 2.6.3p62-x86_64-darwin18;OpenSSL
|
26
|
+
1.0.2s 28 May 2019)
|
27
|
+
Accept:
|
28
|
+
- "*/*"
|
29
|
+
response:
|
30
|
+
status:
|
31
|
+
code: 200
|
32
|
+
message: OK
|
33
|
+
headers:
|
34
|
+
Cache-Control:
|
35
|
+
- max-age=0, no-cache, no-store, must-revalidate
|
36
|
+
Content-Length:
|
37
|
+
- '918'
|
38
|
+
Content-Type:
|
39
|
+
- application/json
|
40
|
+
Date:
|
41
|
+
- Wed, 29 Jan 2020 18:20:43 GMT
|
42
|
+
Paypal-Debug-Id:
|
43
|
+
- e008f15321bc3
|
44
|
+
X-Paypal-Token-Service:
|
45
|
+
- IAAS
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: '{"scope":"https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer
|
49
|
+
https://uri.paypal.com/services/payments/realtimepayment https://uri.paypal.com/services/disputes/update-seller
|
50
|
+
https://uri.paypal.com/services/payments/payment/authcapture openid https://uri.paypal.com/services/disputes/read-seller
|
51
|
+
https://uri.paypal.com/services/payments/refund https://api.paypal.com/v1/vault/credit-card
|
52
|
+
https://api.paypal.com/v1/payments/.* https://uri.paypal.com/payments/payouts
|
53
|
+
https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions
|
54
|
+
https://uri.paypal.com/services/applications/webhooks","access_token":"A21AAH8JBaCq97a9fIWYVjR13RiayfAPxcb-o5l9hZ57HACn0JwaefBkRcSfh9rEwmZR6JozBLLU2MsRYTuFsZ91mOZR9jFMQ","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":32400,"nonce":"2020-01-29T18:20:43ZDKF3VcEmtOhEC5S6ZO80QnoxtZ-lP5lrj73RBoqrBwI"}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Wed, 29 Jan 2020 18:20:43 GMT
|
57
|
+
- request:
|
58
|
+
method: post
|
59
|
+
uri: https://api.sandbox.paypal.com/v2/checkout/orders
|
60
|
+
body:
|
61
|
+
encoding: UTF-8
|
62
|
+
string: '{"intent":"CAPTURE","application_context":{"brand_name":"Workarea Paypal
|
63
|
+
Plugin","locale":"en","landing_page":"BILLING","shipping_preference":"SET_PROVIDED_ADDRESS","user_action":"CONTINUE"},"payer":{"email_address":"test@workarea.com","name":{"given_name":"Ben","surname":"Crouse"},"address":{"address_line_1":"22
|
64
|
+
S. 3rd St.","address_line_2":"Second Floor","admin_area_2":"Philadelphia","admin_area_1":"PA","postal_code":"19106","country_code":"US"}},"purchase_units":[{"custom_id":"PAYPAL_TEST","amount":{"currency_code":"USD","value":"11.60","breakdown":{"item_total":{"currency_code":"USD","value":"10.00"},"shipping":{"currency_code":"USD","value":"1.00"},"tax_total":{"currency_code":"USD","value":"0.60"},"discount":{"currency_code":"USD","value":"0.00"},"shipping_discount":{"currency_code":"USD","value":"0.00"}}},"items":[{"name":"Test
|
65
|
+
Product","description":"","sku":"SKU","unit_amount":{"currency_code":"USD","value":"5.00"},"tax":{"currency_code":"USD","value":"0.30"},"quantity":2,"category":"PHYSICAL_GOODS"}],"shipping":{"method":"Ground","name":{"full_name":"Ben
|
66
|
+
Crouse"},"address":{"address_line_1":"22 S. 3rd St.","address_line_2":"Second
|
67
|
+
Floor","admin_area_2":"Philadelphia","admin_area_1":"PA","postal_code":"19106","country_code":"US"}}}]}'
|
68
|
+
headers:
|
69
|
+
Content-Type:
|
70
|
+
- application/json
|
71
|
+
Paypal-Partner-Attribution-Id:
|
72
|
+
- Workarea_SP
|
73
|
+
Authorization:
|
74
|
+
- Bearer A21AAH8JBaCq97a9fIWYVjR13RiayfAPxcb-o5l9hZ57HACn0JwaefBkRcSfh9rEwmZR6JozBLLU2MsRYTuFsZ91mOZR9jFMQ
|
75
|
+
Accept-Encoding:
|
76
|
+
- gzip
|
77
|
+
Sdk-Name:
|
78
|
+
- Checkout SDK
|
79
|
+
Sdk-Version:
|
80
|
+
- 1.0.3
|
81
|
+
Sdk-Tech-Stack:
|
82
|
+
- Ruby2.6.3
|
83
|
+
Api-Integration-Type:
|
84
|
+
- PAYPALSDK
|
85
|
+
User-Agent:
|
86
|
+
- PayPalSDK/rest-sdk-ruby 1.0.3 (paypal-checkout-sdk 1.0.3; ruby 2.6.3p62-x86_64-darwin18;OpenSSL
|
87
|
+
1.0.2s 28 May 2019)
|
88
|
+
Accept:
|
89
|
+
- "*/*"
|
90
|
+
response:
|
91
|
+
status:
|
92
|
+
code: 201
|
93
|
+
message: Created
|
94
|
+
headers:
|
95
|
+
Cache-Control:
|
96
|
+
- max-age=0, no-cache, no-store, must-revalidate
|
97
|
+
Content-Length:
|
98
|
+
- '501'
|
99
|
+
Content-Type:
|
100
|
+
- application/json
|
101
|
+
Date:
|
102
|
+
- Wed, 29 Jan 2020 18:20:45 GMT
|
103
|
+
Paypal-Debug-Id:
|
104
|
+
- 23bb091dfbf39
|
105
|
+
body:
|
106
|
+
encoding: UTF-8
|
107
|
+
string: '{"id":"6DJ616473D999571D","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/6DJ616473D999571D","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=6DJ616473D999571D","rel":"approve","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/6DJ616473D999571D","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/6DJ616473D999571D/capture","rel":"capture","method":"POST"}],"status":"CREATED"}'
|
108
|
+
http_version:
|
109
|
+
recorded_at: Wed, 29 Jan 2020 18:20:45 GMT
|
110
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,105 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.sandbox.paypal.com/v1/oauth2/token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: grant_type=client_credentials
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
Authorization:
|
13
|
+
- Basic RkFLRV9QQVlQQUxfQ0xJRU5UX0lEOkZBS0VfUEFZUEFMX0NMSUVOVF9TRUNS\nRVQ=
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip
|
16
|
+
Sdk-Name:
|
17
|
+
- Checkout SDK
|
18
|
+
Sdk-Version:
|
19
|
+
- 1.0.3
|
20
|
+
Sdk-Tech-Stack:
|
21
|
+
- Ruby2.6.3
|
22
|
+
Api-Integration-Type:
|
23
|
+
- PAYPALSDK
|
24
|
+
User-Agent:
|
25
|
+
- PayPalSDK/rest-sdk-ruby 1.0.3 (paypal-checkout-sdk 1.0.3; ruby 2.6.3p62-x86_64-darwin18;OpenSSL
|
26
|
+
1.0.2s 28 May 2019)
|
27
|
+
Accept:
|
28
|
+
- "*/*"
|
29
|
+
response:
|
30
|
+
status:
|
31
|
+
code: 200
|
32
|
+
message: OK
|
33
|
+
headers:
|
34
|
+
Cache-Control:
|
35
|
+
- max-age=0, no-cache, no-store, must-revalidate
|
36
|
+
Content-Length:
|
37
|
+
- '918'
|
38
|
+
Content-Type:
|
39
|
+
- application/json
|
40
|
+
Date:
|
41
|
+
- Wed, 29 Jan 2020 14:49:42 GMT
|
42
|
+
Paypal-Debug-Id:
|
43
|
+
- b76410a37e149
|
44
|
+
X-Paypal-Token-Service:
|
45
|
+
- IAAS
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: '{"scope":"https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer
|
49
|
+
https://uri.paypal.com/services/payments/realtimepayment https://uri.paypal.com/services/disputes/update-seller
|
50
|
+
https://uri.paypal.com/services/payments/payment/authcapture openid https://uri.paypal.com/services/disputes/read-seller
|
51
|
+
https://uri.paypal.com/services/payments/refund https://api.paypal.com/v1/vault/credit-card
|
52
|
+
https://api.paypal.com/v1/payments/.* https://uri.paypal.com/payments/payouts
|
53
|
+
https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions
|
54
|
+
https://uri.paypal.com/services/applications/webhooks","access_token":"A21AAEQe49FiVXiExO3v7exrXi-z5BAM4wSeASef6xs6RrkPBHK5Kj9oW3RVniFGVumUb7r0t3JsrQ9YgIb1t2dc5Wir9JX2Q","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":31976,"nonce":"2020-01-29T14:42:38ZZBfHYcc1UUfvaZaZI0Ce_NpO4WsOSs51kiBnYtgbiAQ"}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Wed, 29 Jan 2020 14:49:42 GMT
|
57
|
+
- request:
|
58
|
+
method: post
|
59
|
+
uri: https://api.sandbox.paypal.com/v2/checkout/orders
|
60
|
+
body:
|
61
|
+
encoding: UTF-8
|
62
|
+
string: '{"intent":"CAPTURE","purchase_units":[{"amount":{"currency_code":"USD","value":"100.00"}}]}'
|
63
|
+
headers:
|
64
|
+
Content-Type:
|
65
|
+
- application/json
|
66
|
+
Paypal-Partner-Attribution-Id:
|
67
|
+
- Workarea_SP
|
68
|
+
Authorization:
|
69
|
+
- Bearer A21AAEQe49FiVXiExO3v7exrXi-z5BAM4wSeASef6xs6RrkPBHK5Kj9oW3RVniFGVumUb7r0t3JsrQ9YgIb1t2dc5Wir9JX2Q
|
70
|
+
Accept-Encoding:
|
71
|
+
- gzip
|
72
|
+
Sdk-Name:
|
73
|
+
- Checkout SDK
|
74
|
+
Sdk-Version:
|
75
|
+
- 1.0.3
|
76
|
+
Sdk-Tech-Stack:
|
77
|
+
- Ruby2.6.3
|
78
|
+
Api-Integration-Type:
|
79
|
+
- PAYPALSDK
|
80
|
+
User-Agent:
|
81
|
+
- PayPalSDK/rest-sdk-ruby 1.0.3 (paypal-checkout-sdk 1.0.3; ruby 2.6.3p62-x86_64-darwin18;OpenSSL
|
82
|
+
1.0.2s 28 May 2019)
|
83
|
+
Accept:
|
84
|
+
- "*/*"
|
85
|
+
response:
|
86
|
+
status:
|
87
|
+
code: 201
|
88
|
+
message: Created
|
89
|
+
headers:
|
90
|
+
Cache-Control:
|
91
|
+
- max-age=0, no-cache, no-store, must-revalidate
|
92
|
+
Content-Length:
|
93
|
+
- '501'
|
94
|
+
Content-Type:
|
95
|
+
- application/json
|
96
|
+
Date:
|
97
|
+
- Wed, 29 Jan 2020 14:49:43 GMT
|
98
|
+
Paypal-Debug-Id:
|
99
|
+
- 996335fff28f0
|
100
|
+
body:
|
101
|
+
encoding: UTF-8
|
102
|
+
string: '{"id":"5AN04236N2178502U","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/5AN04236N2178502U","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=5AN04236N2178502U","rel":"approve","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/5AN04236N2178502U","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/5AN04236N2178502U/capture","rel":"capture","method":"POST"}],"status":"CREATED"}'
|
103
|
+
http_version:
|
104
|
+
recorded_at: Wed, 29 Jan 2020 14:49:44 GMT
|
105
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,103 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.sandbox.paypal.com/v1/oauth2/token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: grant_type=client_credentials
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
Authorization:
|
13
|
+
- Basic RkFLRV9QQVlQQUxfQ0xJRU5UX0lEOkZBS0VfUEFZUEFMX0NMSUVOVF9TRUNS\nRVQ=
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip
|
16
|
+
Sdk-Name:
|
17
|
+
- Checkout SDK
|
18
|
+
Sdk-Version:
|
19
|
+
- 1.0.3
|
20
|
+
Sdk-Tech-Stack:
|
21
|
+
- Ruby2.6.3
|
22
|
+
Api-Integration-Type:
|
23
|
+
- PAYPALSDK
|
24
|
+
User-Agent:
|
25
|
+
- PayPalSDK/rest-sdk-ruby 1.0.3 (paypal-checkout-sdk 1.0.3; ruby 2.6.3p62-x86_64-darwin18;OpenSSL
|
26
|
+
1.0.2s 28 May 2019)
|
27
|
+
Accept:
|
28
|
+
- "*/*"
|
29
|
+
response:
|
30
|
+
status:
|
31
|
+
code: 200
|
32
|
+
message: OK
|
33
|
+
headers:
|
34
|
+
Cache-Control:
|
35
|
+
- max-age=0, no-cache, no-store, must-revalidate
|
36
|
+
Content-Length:
|
37
|
+
- '918'
|
38
|
+
Content-Type:
|
39
|
+
- application/json
|
40
|
+
Date:
|
41
|
+
- Wed, 29 Jan 2020 14:42:38 GMT
|
42
|
+
Paypal-Debug-Id:
|
43
|
+
- 19a4a9e474c41
|
44
|
+
X-Paypal-Token-Service:
|
45
|
+
- IAAS
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: '{"scope":"https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer
|
49
|
+
https://uri.paypal.com/services/payments/realtimepayment https://uri.paypal.com/services/disputes/update-seller
|
50
|
+
https://uri.paypal.com/services/payments/payment/authcapture openid https://uri.paypal.com/services/disputes/read-seller
|
51
|
+
https://uri.paypal.com/services/payments/refund https://api.paypal.com/v1/vault/credit-card
|
52
|
+
https://api.paypal.com/v1/payments/.* https://uri.paypal.com/payments/payouts
|
53
|
+
https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions
|
54
|
+
https://uri.paypal.com/services/applications/webhooks","access_token":"A21AAEQe49FiVXiExO3v7exrXi-z5BAM4wSeASef6xs6RrkPBHK5Kj9oW3RVniFGVumUb7r0t3JsrQ9YgIb1t2dc5Wir9JX2Q","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":32400,"nonce":"2020-01-29T14:42:38ZZBfHYcc1UUfvaZaZI0Ce_NpO4WsOSs51kiBnYtgbiAQ"}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Wed, 29 Jan 2020 14:42:38 GMT
|
57
|
+
- request:
|
58
|
+
method: post
|
59
|
+
uri: https://api.sandbox.paypal.com/v1/identity/generate-token
|
60
|
+
body:
|
61
|
+
encoding: US-ASCII
|
62
|
+
string: ''
|
63
|
+
headers:
|
64
|
+
Content-Type:
|
65
|
+
- application/json
|
66
|
+
Authorization:
|
67
|
+
- Bearer A21AAEQe49FiVXiExO3v7exrXi-z5BAM4wSeASef6xs6RrkPBHK5Kj9oW3RVniFGVumUb7r0t3JsrQ9YgIb1t2dc5Wir9JX2Q
|
68
|
+
Accept-Encoding:
|
69
|
+
- gzip
|
70
|
+
Sdk-Name:
|
71
|
+
- Checkout SDK
|
72
|
+
Sdk-Version:
|
73
|
+
- 1.0.3
|
74
|
+
Sdk-Tech-Stack:
|
75
|
+
- Ruby2.6.3
|
76
|
+
Api-Integration-Type:
|
77
|
+
- PAYPALSDK
|
78
|
+
User-Agent:
|
79
|
+
- PayPalSDK/rest-sdk-ruby 1.0.3 (paypal-checkout-sdk 1.0.3; ruby 2.6.3p62-x86_64-darwin18;OpenSSL
|
80
|
+
1.0.2s 28 May 2019)
|
81
|
+
Accept:
|
82
|
+
- "*/*"
|
83
|
+
response:
|
84
|
+
status:
|
85
|
+
code: 200
|
86
|
+
message: OK
|
87
|
+
headers:
|
88
|
+
Cache-Control:
|
89
|
+
- max-age=0, no-cache, no-store, must-revalidate
|
90
|
+
Content-Length:
|
91
|
+
- '501'
|
92
|
+
Content-Type:
|
93
|
+
- application/json
|
94
|
+
Date:
|
95
|
+
- Wed, 29 Jan 2020 14:42:38 GMT
|
96
|
+
Paypal-Debug-Id:
|
97
|
+
- a70045172c605
|
98
|
+
body:
|
99
|
+
encoding: UTF-8
|
100
|
+
string: '{"client_token":"eyJicmFpbnRyZWUiOnsiYXV0aG9yaXphdGlvbkZpbmdlcnByaW50IjoiZjE2N2E1NjI5OGQ3NzMzYjI1YTc2MThhZmE2NDMyYjg3MWRjM2Q4ZDFiNjllZTIyNzRkMGI3ZjZjNTFjODMzMnxtZXJjaGFudF9pZD1yd3dua3FnMnhnNTZobTJuJnB1YmxpY19rZXk9NjNrdm4zN3Z0MjlxYjRkZiZjcmVhdGVkX2F0PTIwMjAtMDEtMjlUMTQ6NDI6MzkuMTQ5WiIsInZlcnNpb24iOiIzLXBheXBhbCJ9LCJwYXlwYWwiOnsiYWNjZXNzVG9rZW4iOiJBMjFBQUVhNEJCVG1LVkJVY2czODZuU2FXUXRHSDVmcnJFNVd6c3hlTm5heUo3SUlIU1VqbGIxOTF5STA0THZqWGY4cW1hUXlfaDNtM2tLdzAxYXIzU1JmeDdmQXQ4VE5RIn19","expires_in":3600}'
|
101
|
+
http_version:
|
102
|
+
recorded_at: Wed, 29 Jan 2020 14:42:39 GMT
|
103
|
+
recorded_with: VCR 2.9.3
|