solidus_afterpay 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +41 -0
- data/.gem_release.yml +5 -0
- data/.github/stale.yml +17 -0
- data/.github_changelog_generator +2 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.rubocop.yml +14 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +33 -0
- data/LICENSE +202 -0
- data/README.md +175 -0
- data/Rakefile +6 -0
- data/app/assets/javascripts/solidus_afterpay/afterpay_checkout.js +131 -0
- data/app/assets/javascripts/spree/backend/solidus_afterpay.js +2 -0
- data/app/assets/javascripts/spree/frontend/solidus_afterpay.js +4 -0
- data/app/assets/stylesheets/spree/backend/solidus_afterpay.css +4 -0
- data/app/assets/stylesheets/spree/frontend/solidus_afterpay.css +4 -0
- data/app/controllers/solidus_afterpay/base_controller.rb +30 -0
- data/app/controllers/solidus_afterpay/callbacks_controller.rb +71 -0
- data/app/controllers/solidus_afterpay/checkouts_controller.rb +47 -0
- data/app/decorators/controllers/solidus_afterpay/spree/checkout_controller_decorator.rb +13 -0
- data/app/decorators/models/solidus_afterpay/spree/order_decorator.rb +15 -0
- data/app/helpers/solidus_afterpay/afterpay_helper.rb +15 -0
- data/app/models/solidus_afterpay/gateway.rb +157 -0
- data/app/models/solidus_afterpay/order_component_builder.rb +97 -0
- data/app/models/solidus_afterpay/payment_method.rb +56 -0
- data/app/models/solidus_afterpay/payment_source.rb +23 -0
- data/app/models/solidus_afterpay/user_agent_generator.rb +35 -0
- data/app/views/solidus_afterpay/_afterpay_javascript.html.erb +5 -0
- data/app/views/spree/admin/payments/source_forms/_afterpay.html.erb +1 -0
- data/app/views/spree/admin/payments/source_views/_afterpay.html.erb +0 -0
- data/app/views/spree/api/payments/source_views/_afterpay.json.jbuilder +3 -0
- data/app/views/spree/checkout/payment/_afterpay.html.erb +9 -0
- data/app/views/spree/shared/_afterpay_messaging.html.erb +13 -0
- data/bin/console +17 -0
- data/bin/rails +7 -0
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +16 -0
- data/bin/rake +7 -0
- data/bin/sandbox +86 -0
- data/bin/setup +8 -0
- data/codecov.yml +2 -0
- data/config/locales/en.yml +12 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20210813142725_create_solidus_afterpay_payment_sources.rb +12 -0
- data/lib/generators/solidus_afterpay/install/install_generator.rb +43 -0
- data/lib/generators/solidus_afterpay/install/templates/initializer.rb +5 -0
- data/lib/solidus_afterpay/configuration.rb +25 -0
- data/lib/solidus_afterpay/engine.rb +25 -0
- data/lib/solidus_afterpay/testing_support/factories.rb +20 -0
- data/lib/solidus_afterpay/version.rb +5 -0
- data/lib/solidus_afterpay.rb +5 -0
- data/solidus_afterpay.gemspec +38 -0
- data/spec/fixtures/vcr_casettes/create_checkout/invalid.yml +65 -0
- data/spec/fixtures/vcr_casettes/create_checkout/valid.yml +64 -0
- data/spec/fixtures/vcr_casettes/credit/invalid.yml +61 -0
- data/spec/fixtures/vcr_casettes/credit/valid.yml +63 -0
- data/spec/fixtures/vcr_casettes/deferred/authorize/declined_payment.yml +120 -0
- data/spec/fixtures/vcr_casettes/deferred/authorize/invalid.yml +61 -0
- data/spec/fixtures/vcr_casettes/deferred/authorize/valid.yml +120 -0
- data/spec/fixtures/vcr_casettes/deferred/capture/invalid.yml +61 -0
- data/spec/fixtures/vcr_casettes/deferred/capture/valid.yml +140 -0
- data/spec/fixtures/vcr_casettes/deferred/void/invalid.yml +61 -0
- data/spec/fixtures/vcr_casettes/deferred/void/valid.yml +137 -0
- data/spec/fixtures/vcr_casettes/find_payment/invalid.yml +61 -0
- data/spec/fixtures/vcr_casettes/find_payment/valid.yml +140 -0
- data/spec/fixtures/vcr_casettes/immediate/capture/declined_payment.yml +120 -0
- data/spec/fixtures/vcr_casettes/immediate/capture/invalid.yml +61 -0
- data/spec/fixtures/vcr_casettes/immediate/capture/valid.yml +134 -0
- data/spec/fixtures/vcr_casettes/retrieve_configuration/valid.yml +67 -0
- data/spec/helpers/solidus_afterpay/afterpay_helper_spec.rb +23 -0
- data/spec/models/solidus_afterpay/gateway_spec.rb +418 -0
- data/spec/models/solidus_afterpay/order_component_builder_spec.rb +137 -0
- data/spec/models/solidus_afterpay/payment_method_spec.rb +143 -0
- data/spec/models/solidus_afterpay/payment_source_spec.rb +61 -0
- data/spec/models/solidus_afterpay/user_agent_generator_spec.rb +22 -0
- data/spec/models/spree/order_spec.rb +158 -0
- data/spec/requests/solidus_afterpay/callbacks_controller_spec.rb +127 -0
- data/spec/requests/solidus_afterpay/checkouts_controller_spec.rb +190 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/auth.rb +15 -0
- data/spec/support/preferences.rb +33 -0
- data/spec/support/vcr.rb +18 -0
- metadata +249 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://global-api-sandbox.afterpay.com/v2/payments/INVALID_RESPONSE_CODE/void
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"token":null,"merchantReference":null,"amount":{"amount":"10.0","currency":"USD"}}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- SolidusAfterpay/0.0.1 (Solidus/3.0.1; Ruby/2.6.6; Merchant/100101481) https://
|
12
|
+
Authorization:
|
13
|
+
- Basic <ENCODED_AUTH_HEADER>
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 404
|
23
|
+
message: Not Found
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Tue, 31 Aug 2021 10:19:45 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- nvru4vd2rc77r254b3aklc2uxm
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '5'
|
37
|
+
Cf-Cache-Status:
|
38
|
+
- DYNAMIC
|
39
|
+
Expect-Ct:
|
40
|
+
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
|
41
|
+
Set-Cookie:
|
42
|
+
- __cf_bm=99d225d764ed10363fa918c8805988dd7bef9b4b-1630405185-1800-ATek5+ile0BoSnL/K9enQU+J/hrmRE6pScNBdRkQHOoB2NS0O/y9otYoCa0v8FD1OZFovIrCpRQpqe8qQXd+cpid2ttFkOYjrTpKRDBaAiGf;
|
43
|
+
path=/; expires=Tue, 31-Aug-21 10:49:45 GMT; domain=.afterpay.com; HttpOnly;
|
44
|
+
Secure; SameSite=None
|
45
|
+
Strict-Transport-Security:
|
46
|
+
- max-age=31536000; includeSubDomains; preload
|
47
|
+
Server:
|
48
|
+
- cloudflare
|
49
|
+
Cf-Ray:
|
50
|
+
- 687585b5fba0cd26-FCO
|
51
|
+
body:
|
52
|
+
encoding: ASCII-8BIT
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"errorCode" : "not_found",
|
56
|
+
"errorId" : "6867bf55cc14fa09",
|
57
|
+
"message" : "Afterpay payment ID not found.",
|
58
|
+
"httpStatusCode" : 404
|
59
|
+
}
|
60
|
+
recorded_at: Tue, 31 Aug 2021 10:19:45 GMT
|
61
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,137 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://global-api-sandbox.afterpay.com/v2/payments/100101785223/void
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"token":null,"merchantReference":null,"amount":{"amount":"10.0","currency":"USD"}}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- SolidusAfterpay/0.0.1 (Solidus/3.0.1; Ruby/2.6.6; Merchant/100101481) https://
|
12
|
+
Authorization:
|
13
|
+
- Basic <ENCODED_AUTH_HEADER>
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Tue, 31 Aug 2021 10:22:03 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Content-Length:
|
30
|
+
- '1993'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- 3djladyckq4eyixzpg25kpstqu
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '59'
|
37
|
+
Cf-Cache-Status:
|
38
|
+
- DYNAMIC
|
39
|
+
Expect-Ct:
|
40
|
+
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
|
41
|
+
Set-Cookie:
|
42
|
+
- __cf_bm=fccd84a710b94b8835e58821b8d3c0ad1a209709-1630405323-1800-AYRVwW5QoB3nL1+7aXeNkU5GPWIIR9p7HJ8Xb+bPGzsIxsn4/9+CICpHFq0kc8GfVcOqp4DVI8LmsaGeOmIX8vwPlIuoLaZxsJHCFx18Vmje;
|
43
|
+
path=/; expires=Tue, 31-Aug-21 10:52:03 GMT; domain=.afterpay.com; HttpOnly;
|
44
|
+
Secure; SameSite=None
|
45
|
+
Strict-Transport-Security:
|
46
|
+
- max-age=31536000; includeSubDomains; preload
|
47
|
+
Server:
|
48
|
+
- cloudflare
|
49
|
+
Cf-Ray:
|
50
|
+
- 68758912f9d66f64-FCO
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"id" : "100101785223",
|
56
|
+
"token" : "002.e247pp0rcn2fp1qvkfga4dtnnjk1858p389alt6738j5flm9",
|
57
|
+
"status" : "APPROVED",
|
58
|
+
"created" : "2021-08-31T10:21:04.482Z",
|
59
|
+
"originalAmount" : {
|
60
|
+
"amount" : "26.24",
|
61
|
+
"currency" : "USD"
|
62
|
+
},
|
63
|
+
"openToCaptureAmount" : {
|
64
|
+
"amount" : "16.24",
|
65
|
+
"currency" : "USD"
|
66
|
+
},
|
67
|
+
"paymentState" : "AUTH_APPROVED",
|
68
|
+
"merchantReference" : "R435232519",
|
69
|
+
"refunds" : [ {
|
70
|
+
"amount" : {
|
71
|
+
"amount" : "10.00",
|
72
|
+
"currency" : "USD"
|
73
|
+
},
|
74
|
+
"refundId" : "1948421",
|
75
|
+
"refundedAt" : "2021-08-31T10:22:02.911Z"
|
76
|
+
} ],
|
77
|
+
"orderDetails" : {
|
78
|
+
"consumer" : {
|
79
|
+
"phoneNumber" : "",
|
80
|
+
"givenNames" : "Christian",
|
81
|
+
"surname" : "Rimondi",
|
82
|
+
"email" : "admin@example.com"
|
83
|
+
},
|
84
|
+
"billing" : {
|
85
|
+
"name" : "Christian Rimondi",
|
86
|
+
"line1" : "1313 Broadway",
|
87
|
+
"line2" : "",
|
88
|
+
"area1" : "New York",
|
89
|
+
"region" : "NY",
|
90
|
+
"postcode" : "10001",
|
91
|
+
"phoneNumber" : "12524264421"
|
92
|
+
},
|
93
|
+
"shipping" : {
|
94
|
+
"name" : "Christian Rimondi",
|
95
|
+
"line1" : "1313 Broadway",
|
96
|
+
"line2" : "",
|
97
|
+
"area1" : "New York",
|
98
|
+
"region" : "NY",
|
99
|
+
"postcode" : "10001",
|
100
|
+
"phoneNumber" : "12524264421"
|
101
|
+
},
|
102
|
+
"courier" : { },
|
103
|
+
"items" : [ {
|
104
|
+
"name" : "Solidus T-Shirt",
|
105
|
+
"sku" : "SOL-00003",
|
106
|
+
"quantity" : 1,
|
107
|
+
"price" : {
|
108
|
+
"amount" : "19.99",
|
109
|
+
"currency" : "USD"
|
110
|
+
}
|
111
|
+
} ],
|
112
|
+
"discounts" : [ ]
|
113
|
+
},
|
114
|
+
"events" : [ {
|
115
|
+
"id" : "1xUMc5a8zg55pFQOS3AIRh8Aozs",
|
116
|
+
"created" : "2021-08-31T10:21:29.045Z",
|
117
|
+
"expires" : "2021-09-07T10:21:29.044Z",
|
118
|
+
"type" : "AUTH_APPROVED",
|
119
|
+
"amount" : {
|
120
|
+
"amount" : "26.24",
|
121
|
+
"currency" : "USD"
|
122
|
+
},
|
123
|
+
"paymentEventMerchantReference" : null
|
124
|
+
}, {
|
125
|
+
"id" : "1xUMgHuj1jjX1bYsQRYhUjVK9Gz",
|
126
|
+
"created" : "2021-08-31T10:22:02.927Z",
|
127
|
+
"expires" : null,
|
128
|
+
"type" : "VOIDED",
|
129
|
+
"amount" : {
|
130
|
+
"amount" : "10.00",
|
131
|
+
"currency" : "USD"
|
132
|
+
},
|
133
|
+
"paymentEventMerchantReference" : null
|
134
|
+
} ]
|
135
|
+
}
|
136
|
+
recorded_at: Tue, 31 Aug 2021 10:22:03 GMT
|
137
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://global-api-sandbox.afterpay.com/v2/payments/INVALID_ORDER_ID
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- SolidusAfterpay/0.0.1 (Solidus/3.0.1; Ruby/2.6.6; Merchant/100101481) https://
|
12
|
+
Authorization:
|
13
|
+
- Basic <ENCODED_AUTH_HEADER>
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 404
|
21
|
+
message: Not Found
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Tue, 31 Aug 2021 10:29:43 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '139'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Cache-Control:
|
32
|
+
- private, no-cache, no-store, no-transform, must-revalidate, max-age=0
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- kaml4u6rplasbgh7a7b5rjlb54
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '1'
|
37
|
+
Cf-Cache-Status:
|
38
|
+
- DYNAMIC
|
39
|
+
Expect-Ct:
|
40
|
+
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
|
41
|
+
Set-Cookie:
|
42
|
+
- __cf_bm=2a8d27b96b99f883d4c875d2738ef2bd439b2889-1630405783-1800-AcWs6EMnepVy0P/+XUdUdhOi5Bn2+V/vkl8GaDDbbJ8EOVHxNLgQqx/HCdoUvJX7wLItvtmnSqeSU48gKjoBGlRDOJswbXnI3DJf7wKcjU5h;
|
43
|
+
path=/; expires=Tue, 31-Aug-21 10:59:43 GMT; domain=.afterpay.com; HttpOnly;
|
44
|
+
Secure; SameSite=None
|
45
|
+
Strict-Transport-Security:
|
46
|
+
- max-age=31536000; includeSubDomains; preload
|
47
|
+
Server:
|
48
|
+
- cloudflare
|
49
|
+
Cf-Ray:
|
50
|
+
- 6875944f0808cd32-FCO
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"errorCode" : "not_found",
|
56
|
+
"errorId" : "ede919d5808edf1d",
|
57
|
+
"message" : "Afterpay payment ID not found.",
|
58
|
+
"httpStatusCode" : 404
|
59
|
+
}
|
60
|
+
recorded_at: Tue, 31 Aug 2021 10:29:43 GMT
|
61
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,140 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://global-api-sandbox.afterpay.com/v2/payments/100101785223
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- SolidusAfterpay/0.0.1 (Solidus/3.0.1; Ruby/2.6.6; Merchant/100101481) https://
|
12
|
+
Authorization:
|
13
|
+
- Basic <ENCODED_AUTH_HEADER>
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Tue, 31 Aug 2021 10:31:19 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '707'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Cache-Control:
|
32
|
+
- private, no-cache, no-store, no-transform, must-revalidate, max-age=0
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- xeul5ivqioaj5y4ejzttwad7z4
|
35
|
+
Vary:
|
36
|
+
- Accept-Encoding
|
37
|
+
X-Envoy-Upstream-Service-Time:
|
38
|
+
- '45'
|
39
|
+
Cf-Cache-Status:
|
40
|
+
- DYNAMIC
|
41
|
+
Expect-Ct:
|
42
|
+
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
|
43
|
+
Set-Cookie:
|
44
|
+
- __cf_bm=30cababe501d5e9120d02db9b623356df46461b9-1630405879-1800-AVBJk56ZgyTE8bHojNTP/qdQ0bXBD3tFiPBoSBU+t5mXm5oYqrWfzPQ2k28mScIwJ8iNCAyxwLj0qlr7J2hVXtRXToJ3yqevxO1/hGt5dJC/;
|
45
|
+
path=/; expires=Tue, 31-Aug-21 11:01:19 GMT; domain=.afterpay.com; HttpOnly;
|
46
|
+
Secure; SameSite=None
|
47
|
+
Strict-Transport-Security:
|
48
|
+
- max-age=31536000; includeSubDomains; preload
|
49
|
+
Server:
|
50
|
+
- cloudflare
|
51
|
+
Cf-Ray:
|
52
|
+
- 687596aa68a66f1c-FCO
|
53
|
+
body:
|
54
|
+
encoding: ASCII-8BIT
|
55
|
+
string: |-
|
56
|
+
{
|
57
|
+
"id" : "100101785223",
|
58
|
+
"token" : "002.e247pp0rcn2fp1qvkfga4dtnnjk1858p389alt6738j5flm9",
|
59
|
+
"status" : "APPROVED",
|
60
|
+
"created" : "2021-08-31T10:21:04.482Z",
|
61
|
+
"originalAmount" : {
|
62
|
+
"amount" : "26.24",
|
63
|
+
"currency" : "USD"
|
64
|
+
},
|
65
|
+
"openToCaptureAmount" : {
|
66
|
+
"amount" : "16.24",
|
67
|
+
"currency" : "USD"
|
68
|
+
},
|
69
|
+
"paymentState" : "AUTH_APPROVED",
|
70
|
+
"merchantReference" : "R435232519",
|
71
|
+
"refunds" : [ {
|
72
|
+
"amount" : {
|
73
|
+
"amount" : "10.00",
|
74
|
+
"currency" : "USD"
|
75
|
+
},
|
76
|
+
"refundId" : "1xUMgHuj1jjX1bYsQRYhUjVK9Gz",
|
77
|
+
"refundedAt" : "2021-08-31T10:22:02.927Z"
|
78
|
+
} ],
|
79
|
+
"orderDetails" : {
|
80
|
+
"consumer" : {
|
81
|
+
"phoneNumber" : "",
|
82
|
+
"givenNames" : "Christian",
|
83
|
+
"surname" : "Rimondi",
|
84
|
+
"email" : "admin@example.com"
|
85
|
+
},
|
86
|
+
"billing" : {
|
87
|
+
"name" : "Christian Rimondi",
|
88
|
+
"line1" : "1313 Broadway",
|
89
|
+
"line2" : "",
|
90
|
+
"area1" : "New York",
|
91
|
+
"region" : "NY",
|
92
|
+
"postcode" : "10001",
|
93
|
+
"phoneNumber" : "12524264421"
|
94
|
+
},
|
95
|
+
"shipping" : {
|
96
|
+
"name" : "Christian Rimondi",
|
97
|
+
"line1" : "1313 Broadway",
|
98
|
+
"line2" : "",
|
99
|
+
"area1" : "New York",
|
100
|
+
"region" : "NY",
|
101
|
+
"postcode" : "10001",
|
102
|
+
"phoneNumber" : "12524264421"
|
103
|
+
},
|
104
|
+
"courier" : { },
|
105
|
+
"items" : [ {
|
106
|
+
"name" : "Solidus T-Shirt",
|
107
|
+
"sku" : "SOL-00003",
|
108
|
+
"quantity" : 1,
|
109
|
+
"price" : {
|
110
|
+
"amount" : "19.99",
|
111
|
+
"currency" : "USD"
|
112
|
+
},
|
113
|
+
"categories" : [ ]
|
114
|
+
} ],
|
115
|
+
"discounts" : [ ]
|
116
|
+
},
|
117
|
+
"events" : [ {
|
118
|
+
"id" : "1xUMc5a8zg55pFQOS3AIRh8Aozs",
|
119
|
+
"created" : "2021-08-31T10:21:29.074Z",
|
120
|
+
"expires" : "2021-09-07T10:21:29.044Z",
|
121
|
+
"type" : "AUTH_APPROVED",
|
122
|
+
"amount" : {
|
123
|
+
"amount" : "26.24",
|
124
|
+
"currency" : "USD"
|
125
|
+
},
|
126
|
+
"paymentEventMerchantReference" : null
|
127
|
+
}, {
|
128
|
+
"id" : "1xUMgHuj1jjX1bYsQRYhUjVK9Gz",
|
129
|
+
"created" : "2021-08-31T10:22:02.927Z",
|
130
|
+
"expires" : null,
|
131
|
+
"type" : "VOIDED",
|
132
|
+
"amount" : {
|
133
|
+
"amount" : "10.00",
|
134
|
+
"currency" : "USD"
|
135
|
+
},
|
136
|
+
"paymentEventMerchantReference" : null
|
137
|
+
} ]
|
138
|
+
}
|
139
|
+
recorded_at: Tue, 31 Aug 2021 10:31:19 GMT
|
140
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,120 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://global-api-sandbox.afterpay.com/v2/payments/capture
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"token":"002.kj16plsn63eqfacueg767cp7l34e9ph5tms4ql14o2iid7l1","merchantReference":null,"amount":null}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- SolidusAfterpay/0.0.1 (Solidus/3.0.1; Ruby/2.6.6; Merchant/100101481) https://
|
12
|
+
Authorization:
|
13
|
+
- Basic <ENCODED_AUTH_HEADER>
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Wed, 25 Aug 2021 14:57:17 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Content-Length:
|
30
|
+
- '1560'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- wbzt22o3ajpm2efimhqfmwst6m
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '69'
|
37
|
+
Cf-Cache-Status:
|
38
|
+
- DYNAMIC
|
39
|
+
Expect-Ct:
|
40
|
+
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
|
41
|
+
Set-Cookie:
|
42
|
+
- __cf_bm=0f42003dd5d0a97e8093a1ca3845148197627dc7-1629903437-1800-AQmyscm4AU8yJ+HMdlqMUYCVIajsIsAS6CbHuihiQsKF0l/Un9e6mweBaPcPTkp5Wrwn6vMcDTsNPlHHVpRkvrDWTwuuKXuaZHFVFnR6WAEk;
|
43
|
+
path=/; expires=Wed, 25-Aug-21 15:27:17 GMT; domain=.afterpay.com; HttpOnly;
|
44
|
+
Secure; SameSite=None
|
45
|
+
Strict-Transport-Security:
|
46
|
+
- max-age=31536000; includeSubDomains; preload
|
47
|
+
Server:
|
48
|
+
- cloudflare
|
49
|
+
Cf-Ray:
|
50
|
+
- 6845ac04aaf6fc85-FCO
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"id" : "100101770179",
|
56
|
+
"token" : "002.kj16plsn63eqfacueg767cp7l34e9ph5tms4ql14o2iid7l1",
|
57
|
+
"status" : "DECLINED",
|
58
|
+
"created" : "2021-08-25T09:46:39.126Z",
|
59
|
+
"originalAmount" : {
|
60
|
+
"amount" : "22.04",
|
61
|
+
"currency" : "USD"
|
62
|
+
},
|
63
|
+
"openToCaptureAmount" : {
|
64
|
+
"amount" : "22.04",
|
65
|
+
"currency" : "USD"
|
66
|
+
},
|
67
|
+
"paymentState" : "CAPTURE_DECLINED",
|
68
|
+
"merchantReference" : "R628448628",
|
69
|
+
"refunds" : [ ],
|
70
|
+
"orderDetails" : {
|
71
|
+
"consumer" : {
|
72
|
+
"phoneNumber" : "",
|
73
|
+
"givenNames" : "Christian",
|
74
|
+
"surname" : "Rimondi",
|
75
|
+
"email" : "admin@example.com"
|
76
|
+
},
|
77
|
+
"billing" : {
|
78
|
+
"name" : "Christian Rimondi",
|
79
|
+
"line1" : "1313 Broadway",
|
80
|
+
"line2" : "",
|
81
|
+
"area1" : "New York",
|
82
|
+
"region" : "NY",
|
83
|
+
"postcode" : "10001",
|
84
|
+
"phoneNumber" : "12524264421"
|
85
|
+
},
|
86
|
+
"shipping" : {
|
87
|
+
"name" : "Christian Rimondi",
|
88
|
+
"line1" : "1313 Broadway",
|
89
|
+
"line2" : "",
|
90
|
+
"area1" : "New York",
|
91
|
+
"region" : "NY",
|
92
|
+
"postcode" : "10001",
|
93
|
+
"phoneNumber" : "12524264421"
|
94
|
+
},
|
95
|
+
"courier" : { },
|
96
|
+
"items" : [ {
|
97
|
+
"name" : "Ruby Tote",
|
98
|
+
"sku" : "RUB-TOT01",
|
99
|
+
"quantity" : 1,
|
100
|
+
"price" : {
|
101
|
+
"amount" : "15.99",
|
102
|
+
"currency" : "USD"
|
103
|
+
}
|
104
|
+
} ],
|
105
|
+
"discounts" : [ ]
|
106
|
+
},
|
107
|
+
"events" : [ {
|
108
|
+
"id" : "1xDM3uHavfYqSFPWoQTNQgwrERa",
|
109
|
+
"created" : "2021-08-25T09:50:09.174Z",
|
110
|
+
"expires" : null,
|
111
|
+
"type" : "CAPTURE_DECLINED",
|
112
|
+
"amount" : {
|
113
|
+
"amount" : "22.04",
|
114
|
+
"currency" : "USD"
|
115
|
+
},
|
116
|
+
"paymentEventMerchantReference" : null
|
117
|
+
} ]
|
118
|
+
}
|
119
|
+
recorded_at: Wed, 25 Aug 2021 14:57:17 GMT
|
120
|
+
recorded_with: VCR 6.0.0
|