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,120 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://global-api-sandbox.afterpay.com/v2/payments/auth
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"token":"002.ijlqnvko1o4ou45uabplrl9pqao8u2v52njs2972r24hje65","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: 402
|
23
|
+
message: Payment Required
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Thu, 26 Aug 2021 16:49:57 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Content-Length:
|
30
|
+
- '1560'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- gnficlh6g2sky5fijzcyzjocta
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '253'
|
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=31c51aeac48376bb2857541c183d592f37a9981f-1629996597-1800-AfkfX/fwd9Fk1ug6hM4M7hUbmXnPGPs/TsRRzQpRiOKMXHPB+aSZGP/W8kEANiDEwlrN4o7uSWrXdx8PhQ2U8xuv304GDZXXaLoY1qOwSYCk;
|
43
|
+
path=/; expires=Thu, 26-Aug-21 17:19:57 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
|
+
- 684e8e68ba79cd26-FCO
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"id" : "100101773585",
|
56
|
+
"token" : "002.ijlqnvko1o4ou45uabplrl9pqao8u2v52njs2972r24hje65",
|
57
|
+
"status" : "DECLINED",
|
58
|
+
"created" : "2021-08-26T16:47:46.907Z",
|
59
|
+
"originalAmount" : {
|
60
|
+
"amount" : "26.24",
|
61
|
+
"currency" : "USD"
|
62
|
+
},
|
63
|
+
"openToCaptureAmount" : {
|
64
|
+
"amount" : "26.24",
|
65
|
+
"currency" : "USD"
|
66
|
+
},
|
67
|
+
"paymentState" : "AUTH_DECLINED",
|
68
|
+
"merchantReference" : "R735670701",
|
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" : "Solidus T-Shirt",
|
98
|
+
"sku" : "SOL-00003",
|
99
|
+
"quantity" : 1,
|
100
|
+
"price" : {
|
101
|
+
"amount" : "19.99",
|
102
|
+
"currency" : "USD"
|
103
|
+
}
|
104
|
+
} ],
|
105
|
+
"discounts" : [ ]
|
106
|
+
},
|
107
|
+
"events" : [ {
|
108
|
+
"id" : "1xH0Ei1o80ZUK4uYjCo3FMilGdK",
|
109
|
+
"created" : "2021-08-26T16:49:56.938Z",
|
110
|
+
"expires" : null,
|
111
|
+
"type" : "AUTH_DECLINED",
|
112
|
+
"amount" : {
|
113
|
+
"amount" : "26.24",
|
114
|
+
"currency" : "USD"
|
115
|
+
},
|
116
|
+
"paymentEventMerchantReference" : null
|
117
|
+
} ]
|
118
|
+
}
|
119
|
+
recorded_at: Thu, 26 Aug 2021 16:49:57 GMT
|
120
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://global-api-sandbox.afterpay.com/v2/payments/auth
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"token":"INVALID_TOKEN","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: 402
|
23
|
+
message: Payment Required
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Thu, 26 Aug 2021 16:19:00 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Content-Length:
|
30
|
+
- '163'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- mivm6ycf3d6giix6nilde7b3la
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '51'
|
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=3076ec6d5b7ae1f855435d84bd9181ad152c1dd2-1629994740-1800-AeR2AoddlKoTBWSilLJ48iLmiitkT+fC7xdM6BPEk4DBMXg2MxyWWeIkC/URWsvWm6Y43l/oslizLmaG0h4j1MwM5dMX9hu6BQfGSI2ecCRa;
|
43
|
+
path=/; expires=Thu, 26-Aug-21 16:49:00 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
|
+
- 684e61182d2ecd3a-FCO
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"errorCode" : "invalid_token",
|
56
|
+
"errorId" : "bff68cc7fdcdca58",
|
57
|
+
"message" : "Cannot complete payment, expired or invalid token.",
|
58
|
+
"httpStatusCode" : 402
|
59
|
+
}
|
60
|
+
recorded_at: Thu, 26 Aug 2021 16:19:00 GMT
|
61
|
+
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/auth
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"token":"002.m6d9jkrtv1p0j4jqslklhfq9k4nl54jo2530d58kf6snpqq1","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
|
+
- Thu, 26 Aug 2021 16:29:00 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Content-Length:
|
30
|
+
- '1582'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- k654fhwizgpnbdibcncwtr6gyu
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '287'
|
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=68a30d131a201eb6606d48280916ef0e8dbe85cf-1629995340-1800-ARn57j5GkV7ltywtVVCLVLWapp8IWDQ3WR+nZnNDOz+KL+/4f5v61NOLYoWOHX53YA24dt6A4GzYSMQgZkqTh5IXtnSKKkQQBR5pvlrAI3NT;
|
43
|
+
path=/; expires=Thu, 26-Aug-21 16:59:00 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
|
+
- 684e6fb9e8f56f52-FCO
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"id" : "100101782114",
|
56
|
+
"token" : "002.m6d9jkrtv1p0j4jqslklhfq9k4nl54jo2530d58kf6snpqq1",
|
57
|
+
"status" : "APPROVED",
|
58
|
+
"created" : "2021-08-26T16:27:34.957Z",
|
59
|
+
"originalAmount" : {
|
60
|
+
"amount" : "26.24",
|
61
|
+
"currency" : "USD"
|
62
|
+
},
|
63
|
+
"openToCaptureAmount" : {
|
64
|
+
"amount" : "26.24",
|
65
|
+
"currency" : "USD"
|
66
|
+
},
|
67
|
+
"paymentState" : "AUTH_APPROVED",
|
68
|
+
"merchantReference" : "R735670701",
|
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" : "Solidus T-Shirt",
|
98
|
+
"sku" : "SOL-00003",
|
99
|
+
"quantity" : 1,
|
100
|
+
"price" : {
|
101
|
+
"amount" : "19.99",
|
102
|
+
"currency" : "USD"
|
103
|
+
}
|
104
|
+
} ],
|
105
|
+
"discounts" : [ ]
|
106
|
+
},
|
107
|
+
"events" : [ {
|
108
|
+
"id" : "1xGxgr4IwNIYMLTijS80YQSpAbs",
|
109
|
+
"created" : "2021-08-26T16:29:00.156Z",
|
110
|
+
"expires" : "2021-09-02T16:29:00.154Z",
|
111
|
+
"type" : "AUTH_APPROVED",
|
112
|
+
"amount" : {
|
113
|
+
"amount" : "26.24",
|
114
|
+
"currency" : "USD"
|
115
|
+
},
|
116
|
+
"paymentEventMerchantReference" : null
|
117
|
+
} ]
|
118
|
+
}
|
119
|
+
recorded_at: Thu, 26 Aug 2021 16:29:00 GMT
|
120
|
+
recorded_with: VCR 6.0.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/capture
|
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
|
+
- Mon, 30 Aug 2021 08:48:27 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- 65heouufjkegv3vl5qb4i73xcy
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '10'
|
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=668eff4e9ffc28fd31679cdc0261c9ce4b4acb4f-1630313307-1800-ARk1O0SHKLPLwUr13/S67+8NNwr+pjKEXPuAkFR3wUFehdAFbFXgmCP/WIdwgqMJhCTfgtb5JTUww/y2ybtjxRVHs3ghPKv8n8FlLptenDOJ;
|
43
|
+
path=/; expires=Mon, 30-Aug-21 09:18:27 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
|
+
- 686cc29bb9b9cd16-FCO
|
51
|
+
body:
|
52
|
+
encoding: ASCII-8BIT
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"errorCode" : "not_found",
|
56
|
+
"errorId" : "b02ca4e229954972",
|
57
|
+
"message" : "Afterpay payment ID not found.",
|
58
|
+
"httpStatusCode" : 404
|
59
|
+
}
|
60
|
+
recorded_at: Mon, 30 Aug 2021 08:48:27 GMT
|
61
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,140 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://global-api-sandbox.afterpay.com/v2/payments/100101782114/capture
|
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
|
+
- Mon, 30 Aug 2021 08:48:27 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Content-Length:
|
30
|
+
- '2102'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Http-Correlation-Id:
|
34
|
+
- ozupbu4dmlivkgkqcb3hse46pa
|
35
|
+
X-Envoy-Upstream-Service-Time:
|
36
|
+
- '30'
|
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=fe551c8249f0fc8a8392504329daf6fc7bbdd579-1630313307-1800-Ae5qBfEcUSiF6/f+0sKnwQj1nhuHwASlKgZn2PJtUJEApOuu1pqCfgSwpM209BNW+TXJREQGPXbMqZYmcSE6cLeFYXOlzeI11NSwWBDk12x4;
|
43
|
+
path=/; expires=Mon, 30-Aug-21 09:18:27 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
|
+
- 686cc2995adacd2a-FCO
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"id" : "100101782114",
|
56
|
+
"token" : "002.6pp2jr5uhgakhroekobc8ei75jsb0aicevunbcudl094dir7",
|
57
|
+
"status" : "APPROVED",
|
58
|
+
"created" : "2021-08-30T08:45:58.336Z",
|
59
|
+
"originalAmount" : {
|
60
|
+
"amount" : "26.24",
|
61
|
+
"currency" : "USD"
|
62
|
+
},
|
63
|
+
"openToCaptureAmount" : {
|
64
|
+
"amount" : "6.24",
|
65
|
+
"currency" : "USD"
|
66
|
+
},
|
67
|
+
"paymentState" : "PARTIALLY_CAPTURED",
|
68
|
+
"merchantReference" : "R735670701",
|
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" : "Solidus T-Shirt",
|
98
|
+
"sku" : "SOL-00003",
|
99
|
+
"quantity" : 1,
|
100
|
+
"price" : {
|
101
|
+
"amount" : "19.99",
|
102
|
+
"currency" : "USD"
|
103
|
+
}
|
104
|
+
} ],
|
105
|
+
"discounts" : [ ]
|
106
|
+
},
|
107
|
+
"events" : [ {
|
108
|
+
"id" : "1xRLxAGSlrW6GphmzOiNqLgUrKA",
|
109
|
+
"created" : "2021-08-30T08:46:37.409Z",
|
110
|
+
"expires" : "2021-09-06T08:46:37.407Z",
|
111
|
+
"type" : "AUTH_APPROVED",
|
112
|
+
"amount" : {
|
113
|
+
"amount" : "26.24",
|
114
|
+
"currency" : "USD"
|
115
|
+
},
|
116
|
+
"paymentEventMerchantReference" : null
|
117
|
+
}, {
|
118
|
+
"id" : "1xRMAnRV2coOinONSRiP64gecUd",
|
119
|
+
"created" : "2021-08-30T08:48:26.776Z",
|
120
|
+
"expires" : null,
|
121
|
+
"type" : "CAPTURED",
|
122
|
+
"amount" : {
|
123
|
+
"amount" : "10.00",
|
124
|
+
"currency" : "USD"
|
125
|
+
},
|
126
|
+
"paymentEventMerchantReference" : null
|
127
|
+
}, {
|
128
|
+
"id" : "1xRMAxMjwp4lx8EsOONREc3qyq2",
|
129
|
+
"created" : "2021-08-30T08:48:27.278Z",
|
130
|
+
"expires" : null,
|
131
|
+
"type" : "CAPTURED",
|
132
|
+
"amount" : {
|
133
|
+
"amount" : "10.00",
|
134
|
+
"currency" : "USD"
|
135
|
+
},
|
136
|
+
"paymentEventMerchantReference" : null
|
137
|
+
} ]
|
138
|
+
}
|
139
|
+
recorded_at: Mon, 30 Aug 2021 08:48:27 GMT
|
140
|
+
recorded_with: VCR 6.0.0
|