solidus_afterpay 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -0
  3. data/Gemfile +6 -3
  4. data/README.md +55 -23
  5. data/app/assets/javascripts/solidus_afterpay/afterpay_checkout.js +11 -11
  6. data/app/assets/javascripts/solidus_afterpay/afterpay_checkout_button.js +85 -0
  7. data/app/assets/javascripts/solidus_afterpay/afterpay_init.js +12 -0
  8. data/app/assets/javascripts/solidus_afterpay/backend/afterpay_autocomplete.js +9 -0
  9. data/app/assets/javascripts/spree/backend/solidus_afterpay.js +3 -1
  10. data/app/assets/javascripts/spree/frontend/solidus_afterpay.js +2 -0
  11. data/app/controllers/solidus_afterpay/callbacks_controller.rb +5 -1
  12. data/app/controllers/solidus_afterpay/checkouts_controller.rb +8 -2
  13. data/app/controllers/solidus_afterpay/express_callbacks_controller.rb +65 -0
  14. data/app/decorators/controllers/solidus_afterpay/spree/orders_controller_decorator.rb +13 -0
  15. data/app/helpers/solidus_afterpay/afterpay_helper.rb +5 -4
  16. data/app/models/solidus_afterpay/gateway.rb +37 -10
  17. data/app/models/solidus_afterpay/order_component_builder.rb +34 -5
  18. data/app/models/solidus_afterpay/payment_method.rb +43 -10
  19. data/app/models/solidus_afterpay/payment_source.rb +1 -1
  20. data/app/presentes/solidus_afterpay/order_presenter.rb +17 -0
  21. data/app/presentes/solidus_afterpay/shipping_rate_presenter.rb +28 -0
  22. data/app/services/solidus_afterpay/base_service.rb +13 -0
  23. data/app/services/solidus_afterpay/shipping_rate_builder_service.rb +32 -0
  24. data/app/services/solidus_afterpay/update_order_addresses_service.rb +45 -0
  25. data/app/services/solidus_afterpay/update_order_attributes_service.rb +49 -0
  26. data/app/views/solidus_afterpay/_afterpay_checkout_button.html.erb +9 -0
  27. data/app/views/solidus_afterpay/_afterpay_javascript.html.erb +4 -1
  28. data/app/views/spree/api/payments/source_views/_afterpay.json.jbuilder +1 -1
  29. data/app/views/spree/shared/_afterpay_messaging.html.erb +14 -12
  30. data/bin/sandbox +1 -1
  31. data/config/locales/en.yml +4 -0
  32. data/config/routes.rb +2 -0
  33. data/lib/generators/solidus_afterpay/install/templates/initializer.rb +12 -0
  34. data/lib/solidus_afterpay/configuration.rb +29 -0
  35. data/lib/solidus_afterpay/engine.rb +1 -1
  36. data/lib/solidus_afterpay/testing_support/factories.rb +20 -0
  37. data/lib/solidus_afterpay/version.rb +1 -1
  38. data/solidus_afterpay.gemspec +4 -4
  39. metadata +23 -73
  40. data/spec/fixtures/vcr_casettes/create_checkout/invalid.yml +0 -65
  41. data/spec/fixtures/vcr_casettes/create_checkout/valid.yml +0 -64
  42. data/spec/fixtures/vcr_casettes/credit/invalid.yml +0 -61
  43. data/spec/fixtures/vcr_casettes/credit/valid.yml +0 -63
  44. data/spec/fixtures/vcr_casettes/deferred/authorize/declined_payment.yml +0 -120
  45. data/spec/fixtures/vcr_casettes/deferred/authorize/invalid.yml +0 -61
  46. data/spec/fixtures/vcr_casettes/deferred/authorize/valid.yml +0 -120
  47. data/spec/fixtures/vcr_casettes/deferred/capture/invalid.yml +0 -61
  48. data/spec/fixtures/vcr_casettes/deferred/capture/valid.yml +0 -140
  49. data/spec/fixtures/vcr_casettes/deferred/void/invalid.yml +0 -61
  50. data/spec/fixtures/vcr_casettes/deferred/void/valid.yml +0 -137
  51. data/spec/fixtures/vcr_casettes/find_payment/invalid.yml +0 -61
  52. data/spec/fixtures/vcr_casettes/find_payment/valid.yml +0 -140
  53. data/spec/fixtures/vcr_casettes/immediate/capture/declined_payment.yml +0 -120
  54. data/spec/fixtures/vcr_casettes/immediate/capture/invalid.yml +0 -61
  55. data/spec/fixtures/vcr_casettes/immediate/capture/valid.yml +0 -134
  56. data/spec/fixtures/vcr_casettes/retrieve_configuration/valid.yml +0 -67
  57. data/spec/helpers/solidus_afterpay/afterpay_helper_spec.rb +0 -23
  58. data/spec/models/solidus_afterpay/gateway_spec.rb +0 -418
  59. data/spec/models/solidus_afterpay/order_component_builder_spec.rb +0 -137
  60. data/spec/models/solidus_afterpay/payment_method_spec.rb +0 -143
  61. data/spec/models/solidus_afterpay/payment_source_spec.rb +0 -61
  62. data/spec/models/solidus_afterpay/user_agent_generator_spec.rb +0 -22
  63. data/spec/models/spree/order_spec.rb +0 -158
  64. data/spec/requests/solidus_afterpay/callbacks_controller_spec.rb +0 -127
  65. data/spec/requests/solidus_afterpay/checkouts_controller_spec.rb +0 -190
  66. data/spec/spec_helper.rb +0 -31
  67. data/spec/support/auth.rb +0 -15
  68. data/spec/support/preferences.rb +0 -33
  69. data/spec/support/vcr.rb +0 -18
@@ -1,140 +0,0 @@
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
@@ -1,120 +0,0 @@
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
@@ -1,61 +0,0 @@
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":"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
- - Wed, 25 Aug 2021 14:55:10 GMT
27
- Content-Type:
28
- - application/json
29
- Content-Length:
30
- - '163'
31
- Connection:
32
- - keep-alive
33
- Http-Correlation-Id:
34
- - 2m54dxammo5yivs22xpqy5ymp4
35
- X-Envoy-Upstream-Service-Time:
36
- - '65'
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=59dde99429147353c566297400188a205dd1c569-1629903310-1800-AW+vk29NN4QPXNzSzYsYy0du6wT4ILfy1NY9yfxHlmnG/9bR/OuBxCflDZ2b/f2kBF4GjBQ3d9y4Tov4NdIy990scvazqSnXwt/2X2iaTMBt;
43
- path=/; expires=Wed, 25-Aug-21 15:25:10 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
- - 6845a8e67fc5cd42-FCO
51
- body:
52
- encoding: UTF-8
53
- string: |-
54
- {
55
- "errorCode" : "invalid_token",
56
- "errorId" : "da76c8c79d41e92b",
57
- "message" : "Cannot complete payment, expired or invalid token.",
58
- "httpStatusCode" : 402
59
- }
60
- recorded_at: Wed, 25 Aug 2021 14:55:10 GMT
61
- recorded_with: VCR 6.0.0
@@ -1,134 +0,0 @@
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.nt7e0ioqj00fh0ua1nbqcj6vcn9obtfsglqvrj9ijpo3edfc","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:00 GMT
27
- Content-Type:
28
- - application/json
29
- Content-Length:
30
- - '1853'
31
- Connection:
32
- - keep-alive
33
- Http-Correlation-Id:
34
- - aybxyh56w3cheadll4m2tdy7q4
35
- X-Envoy-Upstream-Service-Time:
36
- - '52'
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=559bbd7450eb18d65d238a3f883de3d462989653-1629903420-1800-AZAsHum/8AJvXaC7SsSFuucq7UTebHQq8yI3EfbLOvY3g5R5nTPNo4NpNe4AJsWcz0yS5nit62GxjFvF2gp2C0JXbMys7O8SzRIgMSaMo0Lz;
43
- path=/; expires=Wed, 25-Aug-21 15:27: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
- - 6845ab96ea29cd2e-FCO
51
- body:
52
- encoding: UTF-8
53
- string: |-
54
- {
55
- "id" : "100101768366",
56
- "token" : "002.nt7e0ioqj00fh0ua1nbqcj6vcn9obtfsglqvrj9ijpo3edfc",
57
- "status" : "APPROVED",
58
- "created" : "2021-08-24T15:30:14.497Z",
59
- "originalAmount" : {
60
- "amount" : "22.04",
61
- "currency" : "USD"
62
- },
63
- "openToCaptureAmount" : {
64
- "amount" : "0.00",
65
- "currency" : "USD"
66
- },
67
- "paymentState" : "CAPTURED",
68
- "merchantReference" : "R903458715",
69
- "refunds" : [ {
70
- "amount" : {
71
- "amount" : "0.10",
72
- "currency" : "USD"
73
- },
74
- "refundId" : "1933891",
75
- "refundedAt" : "2021-08-25T10:09:30.819Z"
76
- }, {
77
- "amount" : {
78
- "amount" : "10.00",
79
- "currency" : "USD"
80
- },
81
- "refundId" : "1934419",
82
- "refundedAt" : "2021-08-25T14:56:33.753Z"
83
- } ],
84
- "orderDetails" : {
85
- "consumer" : {
86
- "phoneNumber" : "",
87
- "givenNames" : "Christian",
88
- "surname" : "Rimondi",
89
- "email" : "admin@example.com"
90
- },
91
- "billing" : {
92
- "name" : "Christian Rimondi",
93
- "line1" : "1313 Broadway",
94
- "line2" : "",
95
- "area1" : "New York",
96
- "region" : "NY",
97
- "postcode" : "10001",
98
- "phoneNumber" : "12524264421"
99
- },
100
- "shipping" : {
101
- "name" : "Christian Rimondi",
102
- "line1" : "1313 Broadway",
103
- "line2" : "",
104
- "area1" : "New York",
105
- "region" : "NY",
106
- "postcode" : "10001",
107
- "phoneNumber" : "12524264421"
108
- },
109
- "courier" : { },
110
- "items" : [ {
111
- "name" : "Ruby Tote",
112
- "sku" : "RUB-TOT01",
113
- "quantity" : 1,
114
- "price" : {
115
- "amount" : "15.99",
116
- "currency" : "USD"
117
- }
118
- } ],
119
- "discounts" : [ ]
120
- },
121
- "events" : [ {
122
- "id" : "1xBCPLdc9Opx4SQY8PeMXDtemsV",
123
- "created" : "2021-08-24T15:31:09.859Z",
124
- "expires" : null,
125
- "type" : "CAPTURED",
126
- "amount" : {
127
- "amount" : "22.04",
128
- "currency" : "USD"
129
- },
130
- "paymentEventMerchantReference" : null
131
- } ]
132
- }
133
- recorded_at: Wed, 25 Aug 2021 14:57:00 GMT
134
- recorded_with: VCR 6.0.0
@@ -1,67 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://global-api-sandbox.afterpay.com/v2/configuration
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
- - Wed, 25 Aug 2021 14:56:02 GMT
25
- Content-Type:
26
- - application/json
27
- Content-Length:
28
- - '151'
29
- Connection:
30
- - keep-alive
31
- Cache-Control:
32
- - private, no-transform, max-age=1800
33
- Http-Correlation-Id:
34
- - u73bnoiwo265mfjp7rdrdzfsxu
35
- Vary:
36
- - Accept-Encoding
37
- X-Envoy-Upstream-Service-Time:
38
- - '10'
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=ebd26f3256f7c877137bf42087fa5550fed5965e-1629903362-1800-AcvTlx8l0pTK7CNPb9AuSNR0Gno8NZxAq/ln/lsb1QfRDTKngcaw3pe7umDu3S2LL583bb0jFHJGa/Lbzh3XP31WX5N+vTDZeMa33NSOwYtV;
45
- path=/; expires=Wed, 25-Aug-21 15:26:02 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
- - 6845aa2e5871cd32-FCO
53
- body:
54
- encoding: UTF-8
55
- string: |-
56
- {
57
- "minimumAmount" : {
58
- "amount" : "1.00",
59
- "currency" : "USD"
60
- },
61
- "maximumAmount" : {
62
- "amount" : "1000.00",
63
- "currency" : "USD"
64
- }
65
- }
66
- recorded_at: Wed, 25 Aug 2021 14:56:02 GMT
67
- recorded_with: VCR 6.0.0
@@ -1,23 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe SolidusAfterpay::AfterpayHelper, type: :helper do
4
- describe '#include_afterpay_js' do
5
- subject { helper.include_afterpay_js(test_mode: test_mode) }
6
-
7
- context 'when test_mode is false' do
8
- let(:test_mode) { false }
9
-
10
- it 'includes the production javascript' do
11
- is_expected.to eq('<script src="https://portal.afterpay.com/afterpay.js"></script>')
12
- end
13
- end
14
-
15
- context 'when test_mode is true' do
16
- let(:test_mode) { true }
17
-
18
- it 'includes the sandbox javascript' do
19
- is_expected.to eq('<script src="https://portal.sandbox.afterpay.com/afterpay.js"></script>')
20
- end
21
- end
22
- end
23
- end