solidus_afterpay 0.1.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 (85) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +41 -0
  3. data/.gem_release.yml +5 -0
  4. data/.github/stale.yml +17 -0
  5. data/.github_changelog_generator +2 -0
  6. data/.gitignore +20 -0
  7. data/.rspec +2 -0
  8. data/.rubocop.yml +14 -0
  9. data/CHANGELOG.md +1 -0
  10. data/Gemfile +33 -0
  11. data/LICENSE +202 -0
  12. data/README.md +175 -0
  13. data/Rakefile +6 -0
  14. data/app/assets/javascripts/solidus_afterpay/afterpay_checkout.js +131 -0
  15. data/app/assets/javascripts/spree/backend/solidus_afterpay.js +2 -0
  16. data/app/assets/javascripts/spree/frontend/solidus_afterpay.js +4 -0
  17. data/app/assets/stylesheets/spree/backend/solidus_afterpay.css +4 -0
  18. data/app/assets/stylesheets/spree/frontend/solidus_afterpay.css +4 -0
  19. data/app/controllers/solidus_afterpay/base_controller.rb +30 -0
  20. data/app/controllers/solidus_afterpay/callbacks_controller.rb +71 -0
  21. data/app/controllers/solidus_afterpay/checkouts_controller.rb +47 -0
  22. data/app/decorators/controllers/solidus_afterpay/spree/checkout_controller_decorator.rb +13 -0
  23. data/app/decorators/models/solidus_afterpay/spree/order_decorator.rb +15 -0
  24. data/app/helpers/solidus_afterpay/afterpay_helper.rb +15 -0
  25. data/app/models/solidus_afterpay/gateway.rb +157 -0
  26. data/app/models/solidus_afterpay/order_component_builder.rb +97 -0
  27. data/app/models/solidus_afterpay/payment_method.rb +56 -0
  28. data/app/models/solidus_afterpay/payment_source.rb +23 -0
  29. data/app/models/solidus_afterpay/user_agent_generator.rb +35 -0
  30. data/app/views/solidus_afterpay/_afterpay_javascript.html.erb +5 -0
  31. data/app/views/spree/admin/payments/source_forms/_afterpay.html.erb +1 -0
  32. data/app/views/spree/admin/payments/source_views/_afterpay.html.erb +0 -0
  33. data/app/views/spree/api/payments/source_views/_afterpay.json.jbuilder +3 -0
  34. data/app/views/spree/checkout/payment/_afterpay.html.erb +9 -0
  35. data/app/views/spree/shared/_afterpay_messaging.html.erb +13 -0
  36. data/bin/console +17 -0
  37. data/bin/rails +7 -0
  38. data/bin/rails-engine +13 -0
  39. data/bin/rails-sandbox +16 -0
  40. data/bin/rake +7 -0
  41. data/bin/sandbox +86 -0
  42. data/bin/setup +8 -0
  43. data/codecov.yml +2 -0
  44. data/config/locales/en.yml +12 -0
  45. data/config/routes.rb +7 -0
  46. data/db/migrate/20210813142725_create_solidus_afterpay_payment_sources.rb +12 -0
  47. data/lib/generators/solidus_afterpay/install/install_generator.rb +43 -0
  48. data/lib/generators/solidus_afterpay/install/templates/initializer.rb +5 -0
  49. data/lib/solidus_afterpay/configuration.rb +25 -0
  50. data/lib/solidus_afterpay/engine.rb +25 -0
  51. data/lib/solidus_afterpay/testing_support/factories.rb +20 -0
  52. data/lib/solidus_afterpay/version.rb +5 -0
  53. data/lib/solidus_afterpay.rb +5 -0
  54. data/solidus_afterpay.gemspec +38 -0
  55. data/spec/fixtures/vcr_casettes/create_checkout/invalid.yml +65 -0
  56. data/spec/fixtures/vcr_casettes/create_checkout/valid.yml +64 -0
  57. data/spec/fixtures/vcr_casettes/credit/invalid.yml +61 -0
  58. data/spec/fixtures/vcr_casettes/credit/valid.yml +63 -0
  59. data/spec/fixtures/vcr_casettes/deferred/authorize/declined_payment.yml +120 -0
  60. data/spec/fixtures/vcr_casettes/deferred/authorize/invalid.yml +61 -0
  61. data/spec/fixtures/vcr_casettes/deferred/authorize/valid.yml +120 -0
  62. data/spec/fixtures/vcr_casettes/deferred/capture/invalid.yml +61 -0
  63. data/spec/fixtures/vcr_casettes/deferred/capture/valid.yml +140 -0
  64. data/spec/fixtures/vcr_casettes/deferred/void/invalid.yml +61 -0
  65. data/spec/fixtures/vcr_casettes/deferred/void/valid.yml +137 -0
  66. data/spec/fixtures/vcr_casettes/find_payment/invalid.yml +61 -0
  67. data/spec/fixtures/vcr_casettes/find_payment/valid.yml +140 -0
  68. data/spec/fixtures/vcr_casettes/immediate/capture/declined_payment.yml +120 -0
  69. data/spec/fixtures/vcr_casettes/immediate/capture/invalid.yml +61 -0
  70. data/spec/fixtures/vcr_casettes/immediate/capture/valid.yml +134 -0
  71. data/spec/fixtures/vcr_casettes/retrieve_configuration/valid.yml +67 -0
  72. data/spec/helpers/solidus_afterpay/afterpay_helper_spec.rb +23 -0
  73. data/spec/models/solidus_afterpay/gateway_spec.rb +418 -0
  74. data/spec/models/solidus_afterpay/order_component_builder_spec.rb +137 -0
  75. data/spec/models/solidus_afterpay/payment_method_spec.rb +143 -0
  76. data/spec/models/solidus_afterpay/payment_source_spec.rb +61 -0
  77. data/spec/models/solidus_afterpay/user_agent_generator_spec.rb +22 -0
  78. data/spec/models/spree/order_spec.rb +158 -0
  79. data/spec/requests/solidus_afterpay/callbacks_controller_spec.rb +127 -0
  80. data/spec/requests/solidus_afterpay/checkouts_controller_spec.rb +190 -0
  81. data/spec/spec_helper.rb +31 -0
  82. data/spec/support/auth.rb +15 -0
  83. data/spec/support/preferences.rb +33 -0
  84. data/spec/support/vcr.rb +18 -0
  85. metadata +249 -0
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ SolidusAfterpay::Engine.routes.draw do
4
+ match '/callbacks/confirm', to: '/solidus_afterpay/callbacks#confirm', via: %i[get post]
5
+ get '/callbacks/cancel', to: '/solidus_afterpay/callbacks#cancel'
6
+ post '/checkouts', to: '/solidus_afterpay/checkouts#create'
7
+ end
@@ -0,0 +1,12 @@
1
+ class CreateSolidusAfterpayPaymentSources < SolidusSupport::Migration[4.2]
2
+ def change
3
+ create_table :solidus_afterpay_payment_sources do |t|
4
+ t.string :token
5
+ t.references :payment_method, index: true
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ add_foreign_key :solidus_afterpay_payment_sources, :spree_payment_methods, column: :payment_method_id
11
+ end
12
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusAfterpay
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ class_option :auto_run_migrations, type: :boolean, default: false
7
+ source_root File.expand_path('templates', __dir__)
8
+
9
+ def copy_initializer
10
+ template 'initializer.rb', 'config/initializers/solidus_afterpay.rb'
11
+ end
12
+
13
+ def add_javascripts
14
+ append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_afterpay\n"
15
+ append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_afterpay\n"
16
+ end
17
+
18
+ def add_stylesheets
19
+ inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_afterpay\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
20
+ inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_afterpay\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
21
+ end
22
+
23
+ def add_migrations
24
+ run 'bin/rails railties:install:migrations FROM=solidus_afterpay'
25
+ end
26
+
27
+ def mount_engine
28
+ insert_into_file File.join('config', 'routes.rb'), after: "Rails.application.routes.draw do\n" do
29
+ "mount SolidusAfterpay::Engine, at: '/solidus_afterpay'\n"
30
+ end
31
+ end
32
+
33
+ def run_migrations
34
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
35
+ if run_migrations
36
+ run 'bin/rails db:migrate'
37
+ else
38
+ puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ SolidusAfterpay.configure do |config|
4
+ config.use_solidus_api = false
5
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusAfterpay
4
+ class Configuration
5
+ attr_accessor :use_solidus_api
6
+ end
7
+
8
+ class << self
9
+ def configuration
10
+ @configuration ||= Configuration.new
11
+ end
12
+
13
+ alias config configuration
14
+
15
+ def configure
16
+ yield configuration
17
+ end
18
+
19
+ def api_base_controller_parent_class
20
+ return ::Spree::Api::BaseController if configuration.use_solidus_api
21
+
22
+ SolidusAfterpay::BaseController
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'solidus_core'
4
+ require 'solidus_support'
5
+
6
+ module SolidusAfterpay
7
+ class Engine < Rails::Engine
8
+ include SolidusSupport::EngineExtensions
9
+
10
+ isolate_namespace ::Spree
11
+
12
+ engine_name 'solidus_afterpay'
13
+
14
+ # use rspec for tests
15
+ config.generators do |g|
16
+ g.test_framework :rspec
17
+ end
18
+
19
+ initializer "spree.payment_methods.register_afterpay_payment_method",
20
+ after: "spree.register.payment_methods" do |app|
21
+ app.config.spree.payment_methods << "SolidusAfterpay::PaymentMethod"
22
+ Spree::PermittedAttributes.source_attributes.concat [:token]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ factory :afterpay_payment_method, class: SolidusAfterpay::PaymentMethod do
5
+ name { 'Afterpay' }
6
+ end
7
+ end
8
+
9
+ FactoryBot.define do
10
+ factory :afterpay_payment, parent: :payment do
11
+ association(:payment_method, factory: :afterpay_payment_method)
12
+ end
13
+ end
14
+
15
+ FactoryBot.define do
16
+ factory :afterpay_payment_source, class: SolidusAfterpay::PaymentSource do
17
+ association(:payment_method, factory: :afterpay_payment_method)
18
+ token { "12345678910" }
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusAfterpay
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'solidus_afterpay/configuration'
4
+ require 'solidus_afterpay/version'
5
+ require 'solidus_afterpay/engine'
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/solidus_afterpay/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'solidus_afterpay'
7
+ spec.version = SolidusAfterpay::VERSION
8
+ spec.authors = ['Christian Rimondi', 'Jordy Garcia']
9
+ spec.email = 'contact@solidus.io'
10
+
11
+ spec.summary = 'Solidus extension for using Afterpay in your store.'
12
+ spec.homepage = 'https://github.com/solidusio-contrib/solidus_afterpay#readme'
13
+ spec.license = 'Apache-2.0'
14
+
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+ spec.metadata['source_code_uri'] = 'https://github.com/solidusio-contrib/solidus_afterpay'
17
+ spec.metadata['changelog_uri'] = 'https://github.com/solidusio-contrib/solidus_afterpay/blob/master/CHANGELOG.md'
18
+
19
+ spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
24
+
25
+ spec.files = files.grep_v(%r{^(test|spec|features)/})
26
+ spec.test_files = files.grep(%r{^(test|spec|features)/})
27
+ spec.bindir = "exe"
28
+ spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency 'afterpay', '~> 0.2.0'
32
+ spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 4']
33
+ spec.add_dependency 'solidus_support', '~> 0.5'
34
+
35
+ spec.add_development_dependency 'solidus_dev_support', '~> 2.5'
36
+ spec.add_development_dependency 'vcr', '~> 6.0'
37
+ spec.add_development_dependency 'webmock', '~> 3.14'
38
+ end
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://global-api-sandbox.afterpay.com/v2/checkouts
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"amount":{"amount":"110.0","currency":"USD"},"consumer":{"phoneNumber":null,"givenNames":"John","surname":"Von
9
+ Doe","email":"email1@example.com"},"billing":{"name":"John Von Doe","line1":"PO
10
+ Box 1337","line2":"Northwest","area1":"Herndon","area2":null,"region":"AL","postcode":"10001","countryCode":null,"phoneNumber":"555-555-0199"},"shipping":{"name":"John
11
+ Von Doe","line1":"A Different Road","line2":"Northwest","area1":"Herndon","area2":null,"region":"AL","postcode":"10002","countryCode":null,"phoneNumber":"555-555-0199"},"courier":null,"items":[{"name":"Product
12
+ #1 - 4517","sku":"SKU-1","pageUrl":null,"imageUrl":null,"quantity":1,"price":{"amount":"10.0","currency":"USD"},"categories":null,"estimatedShipmentDate":null}],"discounts":null,"merchant":{"redirectConfirmUrl":"INVALID_URL","redirectCancelUrl":"https://merchantsite.com/cancel"},"paymentType":null,"merchantReference":"R454538030","taxAmount":null,"shippingAmount":null}'
13
+ headers:
14
+ User-Agent:
15
+ - SolidusAfterpay/0.0.1 (Solidus/3.0.1; Ruby/2.6.6; Merchant/100101481) https://
16
+ Authorization:
17
+ - Basic <ENCODED_AUTH_HEADER>
18
+ Content-Type:
19
+ - application/json
20
+ Accept-Encoding:
21
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
+ Accept:
23
+ - "*/*"
24
+ response:
25
+ status:
26
+ code: 422
27
+ message: Unprocessable Entity
28
+ headers:
29
+ Date:
30
+ - Wed, 25 Aug 2021 14:56:00 GMT
31
+ Content-Type:
32
+ - application/json
33
+ Content-Length:
34
+ - '161'
35
+ Connection:
36
+ - keep-alive
37
+ Http-Correlation-Id:
38
+ - wcojzlfj2rfkqm4w6ayrvuynnq
39
+ X-Envoy-Upstream-Service-Time:
40
+ - '1'
41
+ Cf-Cache-Status:
42
+ - DYNAMIC
43
+ Expect-Ct:
44
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
45
+ Set-Cookie:
46
+ - __cf_bm=458888e7b4f03e70f12df97baec05158b5a76852-1629903360-1800-AQkZgFhWlLVhjIocg7r7deIfz1lAUyyEaisx9bXg9Ocwas501JwTxgqXWs2R9DAqrFXrRyfdIntHiY5D3U7kGXrmhCgTFYrDxPixPtLPZ+1b;
47
+ path=/; expires=Wed, 25-Aug-21 15:26:00 GMT; domain=.afterpay.com; HttpOnly;
48
+ Secure; SameSite=None
49
+ Strict-Transport-Security:
50
+ - max-age=31536000; includeSubDomains; preload
51
+ Server:
52
+ - cloudflare
53
+ Cf-Ray:
54
+ - 6845aa213deecd3a-FCO
55
+ body:
56
+ encoding: UTF-8
57
+ string: |-
58
+ {
59
+ "errorCode" : "invalid_object",
60
+ "errorId" : "6a7240c88a0d76d5",
61
+ "message" : "merchant.redirectConfirmUrl must be a valid URL",
62
+ "httpStatusCode" : 422
63
+ }
64
+ recorded_at: Wed, 25 Aug 2021 14:56:00 GMT
65
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,64 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://global-api-sandbox.afterpay.com/v2/checkouts
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"amount":{"amount":"110.0","currency":"USD"},"consumer":{"phoneNumber":null,"givenNames":"John","surname":"Von
9
+ Doe","email":"email3@example.com"},"billing":{"name":"John Von Doe","line1":"PO
10
+ Box 1337","line2":"Northwest","area1":"Herndon","area2":null,"region":"AL","postcode":"10005","countryCode":null,"phoneNumber":"555-555-0199"},"shipping":{"name":"John
11
+ Von Doe","line1":"A Different Road","line2":"Northwest","area1":"Herndon","area2":null,"region":"AL","postcode":"10006","countryCode":null,"phoneNumber":"555-555-0199"},"courier":null,"items":[{"name":"Product
12
+ #3 - 9548","sku":"SKU-3","pageUrl":null,"imageUrl":null,"quantity":1,"price":{"amount":"10.0","currency":"USD"},"categories":null,"estimatedShipmentDate":null}],"discounts":null,"merchant":{"redirectConfirmUrl":"https://merchantsite.com/confirm","redirectCancelUrl":"https://merchantsite.com/cancel"},"paymentType":null,"merchantReference":"R444808561","taxAmount":null,"shippingAmount":null}'
13
+ headers:
14
+ User-Agent:
15
+ - SolidusAfterpay/0.0.1 (Solidus/3.0.1; Ruby/2.6.6; Merchant/100101481) https://
16
+ Authorization:
17
+ - Basic <ENCODED_AUTH_HEADER>
18
+ Content-Type:
19
+ - application/json
20
+ Accept-Encoding:
21
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
+ Accept:
23
+ - "*/*"
24
+ response:
25
+ status:
26
+ code: 201
27
+ message: Created
28
+ headers:
29
+ Date:
30
+ - Wed, 25 Aug 2021 14:56:00 GMT
31
+ Content-Type:
32
+ - application/json
33
+ Content-Length:
34
+ - '249'
35
+ Connection:
36
+ - keep-alive
37
+ Http-Correlation-Id:
38
+ - rdpkhcwkeqlv2irhiask3pltjm
39
+ X-Envoy-Upstream-Service-Time:
40
+ - '37'
41
+ Cf-Cache-Status:
42
+ - DYNAMIC
43
+ Expect-Ct:
44
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
45
+ Set-Cookie:
46
+ - __cf_bm=f6c4d0cdcaa29e5fddf69187d3f8669a0ff92516-1629903360-1800-AROMdFTai3kYVqaapy1FVuhHoAKL/UoScijdZgg9OdkkdqwLfjx1l7Cxk6Yqm0qHyKkjCQ7NGmcCyeB39rNMBT1lETNAwhlDqfY+CJ6kAb6/;
47
+ path=/; expires=Wed, 25-Aug-21 15:26:00 GMT; domain=.afterpay.com; HttpOnly;
48
+ Secure; SameSite=None
49
+ Strict-Transport-Security:
50
+ - max-age=31536000; includeSubDomains; preload
51
+ Server:
52
+ - cloudflare
53
+ Cf-Ray:
54
+ - 6845aa243bb0fc89-FCO
55
+ body:
56
+ encoding: UTF-8
57
+ string: |-
58
+ {
59
+ "token" : "002.nq5oa41fisldkbfvtfjqc9nl1c6jhjna0b92osmstabi2lse",
60
+ "expires" : "2021-08-25T17:56:00.817Z",
61
+ "redirectCheckoutUrl" : "https://portal.sandbox.afterpay.com/us/checkout/?token=002.nq5oa41fisldkbfvtfjqc9nl1c6jhjna0b92osmstabi2lse"
62
+ }
63
+ recorded_at: Wed, 25 Aug 2021 14:56:00 GMT
64
+ 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/refund
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"requestId":null,"merchantReference":null,"refundMerchantReference":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
+ - Wed, 25 Aug 2021 14:56:01 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Http-Correlation-Id:
34
+ - niezt4yj2dkazwuaxcylyctiia
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=81e813f9b6a9b6041a3d539ff719c1362dbee0d7-1629903361-1800-AVFdNDg4AQvJHpdIrmZWTC4rShEPzouH1zIL4mzM59aQ+YuVenlK7OdUtpsPgycODEOuYbUcqh368D3EFoYFQLmPl8XrO0VfJz5ZC/d+lxpP;
43
+ path=/; expires=Wed, 25-Aug-21 15:26:01 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
+ - 6845aa2a69d4cd26-FCO
51
+ body:
52
+ encoding: ASCII-8BIT
53
+ string: |-
54
+ {
55
+ "errorCode" : "not_found",
56
+ "errorId" : "c7585eb6f53f5af5",
57
+ "message" : "Afterpay payment ID not found.",
58
+ "httpStatusCode" : 404
59
+ }
60
+ recorded_at: Wed, 25 Aug 2021 14:56:01 GMT
61
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,63 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://global-api-sandbox.afterpay.com/v2/payments/100101768366/refund
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"requestId":null,"merchantReference":null,"refundMerchantReference":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
+ - Wed, 25 Aug 2021 14:56:33 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Content-Length:
30
+ - '140'
31
+ Connection:
32
+ - keep-alive
33
+ Http-Correlation-Id:
34
+ - 24wpvce67xhgrrg5pqe3fgduda
35
+ X-Envoy-Upstream-Service-Time:
36
+ - '54'
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=e9f4b17314baa927279640073ce9b4ff5a20400f-1629903393-1800-ATEYxDJqfplwOhv7PEuvKTFvzf0cFIA+ctvgNlZuMf4O535a4edKPQ9QImknp0pT7qSY2FRZdUqe/b84LTROEUWm/jP2XhxTGtcGJcCBLyDH;
43
+ path=/; expires=Wed, 25-Aug-21 15:26:33 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
+ - 6845aaf1fb7fcd42-FCO
51
+ body:
52
+ encoding: UTF-8
53
+ string: |-
54
+ {
55
+ "amount" : {
56
+ "amount" : "10.00",
57
+ "currency" : "USD"
58
+ },
59
+ "refundId" : "1934419",
60
+ "refundedAt" : "2021-08-25T14:56:33.753Z"
61
+ }
62
+ recorded_at: Wed, 25 Aug 2021 14:56:33 GMT
63
+ recorded_with: VCR 6.0.0