checkout_sdk 1.0.0.beta.0 → 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/lib/checkout_sdk/api_client.rb +6 -2
  4. data/lib/checkout_sdk/apm/apm.rb +0 -1
  5. data/lib/checkout_sdk/apm/previous/klarna/credit_session_request.rb +19 -21
  6. data/lib/checkout_sdk/apm/previous/klarna/klarna.rb +13 -15
  7. data/lib/checkout_sdk/apm/previous/klarna/klarna_client.rb +43 -45
  8. data/lib/checkout_sdk/apm/previous/klarna/klarna_product.rb +19 -21
  9. data/lib/checkout_sdk/apm/previous/klarna/order_capture_request.rb +24 -26
  10. data/lib/checkout_sdk/apm/previous/sepa/sepa_client.rb +25 -27
  11. data/lib/checkout_sdk/checkout_utils.rb +13 -4
  12. data/lib/checkout_sdk/common/account_holder.rb +4 -1
  13. data/lib/checkout_sdk/common/common.rb +2 -0
  14. data/lib/checkout_sdk/common/marketplace_data.rb +14 -0
  15. data/lib/checkout_sdk/common/payment_source_type.rb +1 -0
  16. data/lib/checkout_sdk/common/shipping_info.rb +29 -0
  17. data/lib/checkout_sdk/customers/customer_request.rb +2 -2
  18. data/lib/checkout_sdk/disputes/disputes_client.rb +5 -0
  19. data/lib/checkout_sdk/disputes/disputes_query_filter.rb +3 -3
  20. data/lib/checkout_sdk/instruments/base_instruments_client.rb +20 -0
  21. data/lib/checkout_sdk/instruments/create/{instrument_request.rb → instrument.rb} +1 -1
  22. data/lib/checkout_sdk/instruments/create/{instrument_bank_account_request.rb → instrument_bank_account.rb} +1 -1
  23. data/lib/checkout_sdk/instruments/create/{instrument_token_request.rb → instrument_token.rb} +1 -1
  24. data/lib/checkout_sdk/instruments/instruments.rb +14 -7
  25. data/lib/checkout_sdk/instruments/instruments_client.rb +4 -15
  26. data/lib/checkout_sdk/instruments/previous/create/instrument.rb +26 -0
  27. data/lib/checkout_sdk/instruments/previous/instruments_client.rb +28 -0
  28. data/lib/checkout_sdk/instruments/previous/update/update_instrument.rb +25 -0
  29. data/lib/checkout_sdk/instruments/update/{update_instrument_request.rb → update_instrument.rb} +1 -1
  30. data/lib/checkout_sdk/instruments/update/{update_instrument_bank_account_request.rb → update_instrument_bank_account.rb} +1 -1
  31. data/lib/checkout_sdk/instruments/update/{update_instrument_card_request.rb → update_instrument_card.rb} +1 -1
  32. data/lib/checkout_sdk/instruments/update/{update_instrument_token_request.rb → update_instrument_token.rb} +1 -1
  33. data/lib/checkout_sdk/payments/base_payments_client.rb +41 -0
  34. data/lib/checkout_sdk/payments/billing_plan.rb +17 -0
  35. data/lib/checkout_sdk/payments/billing_plan_type.rb +14 -0
  36. data/lib/checkout_sdk/payments/capture_request.rb +4 -0
  37. data/lib/checkout_sdk/payments/destination/destination.rb +1 -1
  38. data/lib/checkout_sdk/payments/payment_request.rb +5 -1
  39. data/lib/checkout_sdk/payments/payments.rb +81 -23
  40. data/lib/checkout_sdk/payments/payments_client.rb +1 -36
  41. data/lib/checkout_sdk/payments/payout_request.rb +1 -1
  42. data/lib/checkout_sdk/payments/previous/capture_request.rb +19 -0
  43. data/lib/checkout_sdk/payments/previous/destination/card_destination.rb +38 -0
  44. data/lib/checkout_sdk/payments/previous/destination/destination.rb +21 -0
  45. data/lib/checkout_sdk/payments/previous/destination/id_destination.rb +23 -0
  46. data/lib/checkout_sdk/payments/previous/destination/token_destination.rb +29 -0
  47. data/lib/checkout_sdk/payments/previous/fund_transfer_type.rb +17 -0
  48. data/lib/checkout_sdk/payments/previous/payment_request.rb +73 -0
  49. data/lib/checkout_sdk/payments/previous/payments_client.rb +43 -0
  50. data/lib/checkout_sdk/payments/previous/payout_request.rb +70 -0
  51. data/lib/checkout_sdk/payments/previous/source/apm/alipay_source.rb +13 -0
  52. data/lib/checkout_sdk/payments/previous/source/apm/alma_source.rb +23 -0
  53. data/lib/checkout_sdk/payments/previous/source/apm/bancontact_source.rb +26 -0
  54. data/lib/checkout_sdk/payments/previous/source/apm/benefit_pay_source.rb +17 -0
  55. data/lib/checkout_sdk/payments/previous/source/apm/boleto_source.rb +26 -0
  56. data/lib/checkout_sdk/payments/previous/source/apm/eps_source.rb +20 -0
  57. data/lib/checkout_sdk/payments/previous/source/apm/fawry_source.rb +47 -0
  58. data/lib/checkout_sdk/payments/previous/source/apm/giropay_source.rb +32 -0
  59. data/lib/checkout_sdk/payments/previous/source/apm/ideal_source.rb +23 -0
  60. data/lib/checkout_sdk/payments/previous/source/apm/integration_type.rb +12 -0
  61. data/lib/checkout_sdk/payments/previous/source/apm/klarna_source.rb +56 -0
  62. data/lib/checkout_sdk/payments/previous/source/apm/knet_source.rb +38 -0
  63. data/lib/checkout_sdk/payments/previous/source/apm/multi_banco_source.rb +23 -0
  64. data/lib/checkout_sdk/payments/previous/source/apm/oxxo_source.rb +26 -0
  65. data/lib/checkout_sdk/payments/previous/source/apm/p24_source.rb +26 -0
  66. data/lib/checkout_sdk/payments/previous/source/apm/pago_facil_source.rb +26 -0
  67. data/lib/checkout_sdk/payments/previous/source/apm/paypal_source.rb +26 -0
  68. data/lib/checkout_sdk/payments/previous/source/apm/poli_source.rb +13 -0
  69. data/lib/checkout_sdk/payments/previous/source/apm/qpay_source.rb +26 -0
  70. data/lib/checkout_sdk/payments/previous/source/apm/rapi_pago_source.rb +26 -0
  71. data/lib/checkout_sdk/payments/previous/source/apm/sofort_source.rb +20 -0
  72. data/lib/checkout_sdk/payments/previous/source/card_source.rb +41 -0
  73. data/lib/checkout_sdk/payments/previous/source/customer_source.rb +17 -0
  74. data/lib/checkout_sdk/payments/previous/source/d_local_source.rb +41 -0
  75. data/lib/checkout_sdk/payments/previous/source/id_source.rb +20 -0
  76. data/lib/checkout_sdk/payments/previous/source/network_token_source.rb +47 -0
  77. data/lib/checkout_sdk/payments/previous/source/payment_source.rb +20 -0
  78. data/lib/checkout_sdk/payments/previous/source/token_source.rb +26 -0
  79. data/lib/checkout_sdk/payments/processing_settings.rb +15 -0
  80. data/lib/checkout_sdk/payments/sender/sender.rb +2 -2
  81. data/lib/checkout_sdk/payments/source/apm/after_pay_source.rb +1 -1
  82. data/lib/checkout_sdk/payments/source/apm/alipay_plus_source.rb +1 -1
  83. data/lib/checkout_sdk/payments/source/apm/alma_source.rb +15 -0
  84. data/lib/checkout_sdk/payments/source/apm/bancontact_source.rb +1 -1
  85. data/lib/checkout_sdk/payments/source/apm/benefit_source.rb +1 -1
  86. data/lib/checkout_sdk/payments/source/apm/eps_source.rb +1 -1
  87. data/lib/checkout_sdk/payments/source/apm/fawry_product.rb +20 -0
  88. data/lib/checkout_sdk/payments/source/apm/fawry_source.rb +30 -0
  89. data/lib/checkout_sdk/payments/source/apm/giropay_source.rb +1 -1
  90. data/lib/checkout_sdk/payments/source/apm/ideal_source.rb +1 -1
  91. data/lib/checkout_sdk/payments/source/apm/klarna_source.rb +15 -0
  92. data/lib/checkout_sdk/payments/source/apm/knet_source.rb +1 -1
  93. data/lib/checkout_sdk/payments/source/apm/mbway_source.rb +1 -1
  94. data/lib/checkout_sdk/payments/source/apm/multi_banco_source.rb +1 -1
  95. data/lib/checkout_sdk/payments/source/apm/p24_source.rb +1 -1
  96. data/lib/checkout_sdk/payments/source/apm/paypal_source.rb +5 -1
  97. data/lib/checkout_sdk/payments/source/apm/post_finance_source.rb +1 -1
  98. data/lib/checkout_sdk/payments/source/apm/qpay_source.rb +1 -1
  99. data/lib/checkout_sdk/payments/source/apm/sofort_source.rb +1 -1
  100. data/lib/checkout_sdk/payments/source/apm/stcpay_source.rb +1 -1
  101. data/lib/checkout_sdk/payments/source/apm/tamara_source.rb +1 -1
  102. data/lib/checkout_sdk/payments/source/apm/we_chat_pay_source.rb +1 -1
  103. data/lib/checkout_sdk/payments/source/bank_account_source.rb +1 -1
  104. data/lib/checkout_sdk/payments/source/card_source.rb +1 -1
  105. data/lib/checkout_sdk/payments/source/currency_account_source.rb +1 -1
  106. data/lib/checkout_sdk/payments/source/id_source.rb +1 -1
  107. data/lib/checkout_sdk/payments/source/network_token_source.rb +1 -1
  108. data/lib/checkout_sdk/payments/source/{payment_request_source.rb → payment_source.rb} +1 -1
  109. data/lib/checkout_sdk/payments/source/{payout_request_source.rb → payout_source.rb} +3 -3
  110. data/lib/checkout_sdk/payments/source/provider_token_source.rb +1 -1
  111. data/lib/checkout_sdk/payments/source/token_source.rb +1 -1
  112. data/lib/checkout_sdk/payments/three_ds_request.rb +4 -1
  113. data/lib/checkout_sdk/previous/checkout_api.rb +29 -5
  114. data/lib/checkout_sdk/sources/mandate_type.rb +12 -0
  115. data/lib/checkout_sdk/sources/sepa_source_request.rb +20 -0
  116. data/lib/checkout_sdk/sources/source_data.rb +28 -0
  117. data/lib/checkout_sdk/sources/source_request.rb +30 -0
  118. data/lib/checkout_sdk/sources/source_type.rb +11 -0
  119. data/lib/checkout_sdk/sources/sources.rb +9 -0
  120. data/lib/checkout_sdk/sources/sources_client.rb +23 -0
  121. data/lib/checkout_sdk/tokens/wallet_token_request.rb +1 -1
  122. data/lib/checkout_sdk/version.rb +1 -1
  123. data/lib/checkout_sdk.rb +3 -0
  124. metadata +68 -12
  125. data/lib/checkout_sdk/apm/previous/klarna/klarna_shipping_info.rb +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02f69890364a27b8824317c2604c3dcc1182ceab269ba237589c7db3529d16a1
4
- data.tar.gz: fd4d4cdbf183476ae79c4fbf58f517102eb23d3795af8a8d2be5e1e76a44ab2c
3
+ metadata.gz: a0d976eb888dbeda40a8ece1c8701d3ba7c1cec555699c5953b425c092a3d9b9
4
+ data.tar.gz: 44ae834bdb42d042f082030b87137261be0a48188d33f8b6c1864e96ea215787
5
5
  SHA512:
6
- metadata.gz: 627d42ca4a6d47e0336bfbf0df46dca6c703898c17923fbb0356974e0833c3a099e7701ffab5caee7eae83966469849931ca3183b14f52f1afcca0cd1e46047c
7
- data.tar.gz: ad0c24f31adf78f719a4af8f5e6e889274b08987d038e8b470aa8c1881114242b21462bd1b237f217f79f5c30d4020d94cdb6470037aad1354d5e19035346d8c
6
+ metadata.gz: f6a38b94c47462ec0837b57be1ac13c4c916acf8eb2360126f9ef4b3a93667fe281ceb0945209ff51d6d72edde1ca1e4596166a75044cdeb3f5a6c5808d48042
7
+ data.tar.gz: 270e249ce92268f2346f4da01b3a79e83148ff871a8584844db05fdf60ef786fc6051c22f58d94d3d314e800760d5207d7a43b223b307c261638cb3f20bd28af
data/.rubocop.yml CHANGED
@@ -19,6 +19,9 @@ Metrics/MethodLength:
19
19
  Metrics/ParameterLists:
20
20
  Max: 10
21
21
 
22
+ Metrics/ClassLength:
23
+ Max: 110
24
+
22
25
  Style/Documentation:
23
26
  Enabled: false
24
27
 
@@ -128,8 +128,12 @@ module CheckoutSdk
128
128
  end
129
129
 
130
130
  def parse_response(response)
131
- # TODO: include http metadata response
132
- JSON.parse(response.body, object_class: OpenStruct) if !response.body.nil? && response.body != ''
131
+ metadata = CheckoutUtils.map_to_http_metadata(response)
132
+ body = (JSON.parse(response.body, object_class: OpenStruct) if !response.body.nil? && response.body != '')
133
+ body = OpenStruct.new if body.nil?
134
+ body = OpenStruct.new(items: body) if body.is_a? Array
135
+ body.metadata = metadata if body.is_a? OpenStruct
136
+ body
133
137
  end
134
138
  end
135
139
  end
@@ -4,7 +4,6 @@
4
4
  require 'checkout_sdk/apm/previous/klarna/credit_session_request'
5
5
  require 'checkout_sdk/apm/previous/klarna/klarna'
6
6
  require 'checkout_sdk/apm/previous/klarna/klarna_product'
7
- require 'checkout_sdk/apm/previous/klarna/klarna_shipping_info'
8
7
  require 'checkout_sdk/apm/previous/klarna/order_capture_request'
9
8
 
10
9
  require 'checkout_sdk/apm/previous/klarna/klarna_client'
@@ -3,27 +3,25 @@
3
3
  module CheckoutSdk
4
4
  module Previous
5
5
  module Apm
6
- module Klarna
7
- # @!attribute purchase_country
8
- # @return [String] {CheckoutSdk::Common::Country}
9
- # @!attribute currency
10
- # @return [String] {CheckoutSdk::Common::Currency}
11
- # @!attribute locale
12
- # @return [String]
13
- # @!attribute amount
14
- # @return [Integer]
15
- # @!attribute tax_amount
16
- # @return [Integer]
17
- # @!attribute products
18
- # @return [Array(KlarnaProduct)]
19
- class CreditSessionRequest
20
- attr_accessor :purchase_country,
21
- :currency,
22
- :locale,
23
- :amount,
24
- :tax_amount,
25
- :products
26
- end
6
+ # @!attribute purchase_country
7
+ # @return [String] {CheckoutSdk::Common::Country}
8
+ # @!attribute currency
9
+ # @return [String] {CheckoutSdk::Common::Currency}
10
+ # @!attribute locale
11
+ # @return [String]
12
+ # @!attribute amount
13
+ # @return [Integer]
14
+ # @!attribute tax_amount
15
+ # @return [Integer]
16
+ # @!attribute products
17
+ # @return [Array(KlarnaProduct)]
18
+ class CreditSessionRequest
19
+ attr_accessor :purchase_country,
20
+ :currency,
21
+ :locale,
22
+ :amount,
23
+ :tax_amount,
24
+ :products
27
25
  end
28
26
  end
29
27
  end
@@ -3,21 +3,19 @@
3
3
  module CheckoutSdk
4
4
  module Previous
5
5
  module Apm
6
- module Klarna
7
- # @!attribute description
8
- # @return [String]
9
- # @!attribute products
10
- # @return [Array(KlarnaProduct)]
11
- # @!attribute shipping_info
12
- # @return [KlarnaShippingInfo]
13
- # @!attribute shipping_delay
14
- # @return [Integer]
15
- class Klarna
16
- attr_accessor :description,
17
- :products,
18
- :shipping_info,
19
- :shipping_delay
20
- end
6
+ # @!attribute description
7
+ # @return [String]
8
+ # @!attribute products
9
+ # @return [Array(KlarnaProduct)]
10
+ # @!attribute shipping_info
11
+ # @return [CheckoutSdk::Common::ShippingInfo]
12
+ # @!attribute shipping_delay
13
+ # @return [Integer]
14
+ class Klarna
15
+ attr_accessor :description,
16
+ :products,
17
+ :shipping_info,
18
+ :shipping_delay
21
19
  end
22
20
  end
23
21
  end
@@ -3,51 +3,49 @@
3
3
  module CheckoutSdk
4
4
  module Previous
5
5
  module Apm
6
- module Klarna
7
- class KlarnaClient < Client
8
- CREDIT_SESSIONS = 'credit-sessions'
9
- ORDERS = 'orders'
10
- CAPTURES = 'captures'
11
- VOIDS = 'voids'
12
- private_constant :CREDIT_SESSIONS, :ORDERS, :CAPTURES, :VOIDS
13
-
14
- # @param [ApiClient] api_client
15
- # @param [CheckoutConfiguration] configuration
16
- def initialize(api_client, configuration)
17
- super api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY
18
- end
19
-
20
- # @param credit_session_request [CreditSessionRequest]
21
- def create_credit_session(credit_session_request)
22
- api_client.invoke_post(build_path(base_url, CREDIT_SESSIONS), sdk_authorization, credit_session_request)
23
- end
24
-
25
- # @param session_id [String]
26
- def get_credit_session(session_id)
27
- api_client.invoke_get(build_path(base_url, CREDIT_SESSIONS, session_id), sdk_authorization)
28
- end
29
-
30
- # @param payment_id [String]
31
- # @param order_capture_request [OrderCaptureRequest]
32
- def capture_payment(payment_id, order_capture_request)
33
- api_client.invoke_post(build_path(base_url, ORDERS, payment_id, CAPTURES),
34
- sdk_authorization,
35
- order_capture_request)
36
- end
37
-
38
- # @param payment_id [String]
39
- # @param void_request [CheckoutSdk::Payments::VoidRequest]
40
- def void_payment(payment_id, void_request)
41
- api_client.invoke_post(build_path(base_url, ORDERS, payment_id, VOIDS),
42
- sdk_authorization,
43
- void_request)
44
- end
45
-
46
- private
47
-
48
- def base_url
49
- sandbox? ? 'klarna-external' : 'klarna'
50
- end
6
+ class KlarnaClient < Client
7
+ CREDIT_SESSIONS = 'credit-sessions'
8
+ ORDERS = 'orders'
9
+ CAPTURES = 'captures'
10
+ VOIDS = 'voids'
11
+ private_constant :CREDIT_SESSIONS, :ORDERS, :CAPTURES, :VOIDS
12
+
13
+ # @param [ApiClient] api_client
14
+ # @param [CheckoutConfiguration] configuration
15
+ def initialize(api_client, configuration)
16
+ super api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY
17
+ end
18
+
19
+ # @param credit_session_request [CreditSessionRequest]
20
+ def create_credit_session(credit_session_request)
21
+ api_client.invoke_post(build_path(base_url, CREDIT_SESSIONS), sdk_authorization, credit_session_request)
22
+ end
23
+
24
+ # @param session_id [String]
25
+ def get_credit_session(session_id)
26
+ api_client.invoke_get(build_path(base_url, CREDIT_SESSIONS, session_id), sdk_authorization)
27
+ end
28
+
29
+ # @param payment_id [String]
30
+ # @param order_capture_request [OrderCaptureRequest]
31
+ def capture_payment(payment_id, order_capture_request)
32
+ api_client.invoke_post(build_path(base_url, ORDERS, payment_id, CAPTURES),
33
+ sdk_authorization,
34
+ order_capture_request)
35
+ end
36
+
37
+ # @param payment_id [String]
38
+ # @param void_request [CheckoutSdk::Payments::VoidRequest]
39
+ def void_payment(payment_id, void_request)
40
+ api_client.invoke_post(build_path(base_url, ORDERS, payment_id, VOIDS),
41
+ sdk_authorization,
42
+ void_request)
43
+ end
44
+
45
+ private
46
+
47
+ def base_url
48
+ sandbox? ? 'klarna-external' : 'klarna'
51
49
  end
52
50
  end
53
51
  end
@@ -3,27 +3,25 @@
3
3
  module CheckoutSdk
4
4
  module Previous
5
5
  module Apm
6
- module Klarna
7
- # @!attribute name
8
- # @return [String]
9
- # @!attribute quantity
10
- # @return [Integer]
11
- # @!attribute unit_price
12
- # @return [Integer]
13
- # @!attribute tax_rate
14
- # @return [Integer]
15
- # @!attribute total_amount
16
- # @return [Integer]
17
- # @!attribute total_tax_amount
18
- # @return [Integer]
19
- class KlarnaProduct
20
- attr_accessor :name,
21
- :quantity,
22
- :unit_price,
23
- :tax_rate,
24
- :total_amount,
25
- :total_tax_amount
26
- end
6
+ # @!attribute name
7
+ # @return [String]
8
+ # @!attribute quantity
9
+ # @return [Integer]
10
+ # @!attribute unit_price
11
+ # @return [Integer]
12
+ # @!attribute tax_rate
13
+ # @return [Integer]
14
+ # @!attribute total_amount
15
+ # @return [Integer]
16
+ # @!attribute total_tax_amount
17
+ # @return [Integer]
18
+ class KlarnaProduct
19
+ attr_accessor :name,
20
+ :quantity,
21
+ :unit_price,
22
+ :tax_rate,
23
+ :total_amount,
24
+ :total_tax_amount
27
25
  end
28
26
  end
29
27
  end
@@ -3,33 +3,31 @@
3
3
  module CheckoutSdk
4
4
  module Previous
5
5
  module Apm
6
- module Klarna
7
- # @!attribute type
8
- # @return [CheckoutSdk::Common::PaymentSourceType]
9
- # @!attribute amount
10
- # @return [Integer]
11
- # @!attribute reference
12
- # @return [String]
13
- # @!attribute metadata
14
- # @return [Hash(String=>Object)]
15
- # @!attribute klarna
16
- # @return [Klarna]
17
- # @!attribute shipping_info
18
- # @return [KlarnaShippingInfo]
19
- # @!attribute shipping_delay
20
- # @return [Integer]
21
- class OrderCaptureRequest
22
- attr_reader :type
23
- attr_accessor :amount,
24
- :reference,
25
- :metadata,
26
- :klarna,
27
- :shipping_info,
28
- :shipping_delay
6
+ # @!attribute type
7
+ # @return [CheckoutSdk::Common::PaymentSourceType]
8
+ # @!attribute amount
9
+ # @return [Integer]
10
+ # @!attribute reference
11
+ # @return [String]
12
+ # @!attribute metadata
13
+ # @return [Hash(String=>Object)]
14
+ # @!attribute klarna
15
+ # @return [Klarna]
16
+ # @!attribute shipping_info
17
+ # @return [CheckoutSdk::Common::ShippingInfo]
18
+ # @!attribute shipping_delay
19
+ # @return [Integer]
20
+ class OrderCaptureRequest
21
+ attr_reader :type
22
+ attr_accessor :amount,
23
+ :reference,
24
+ :metadata,
25
+ :klarna,
26
+ :shipping_info,
27
+ :shipping_delay
29
28
 
30
- def initialize
31
- @type = CheckoutSdk::Common::PaymentSourceType::KLARNA
32
- end
29
+ def initialize
30
+ @type = CheckoutSdk::Common::PaymentSourceType::KLARNA
33
31
  end
34
32
  end
35
33
  end
@@ -3,38 +3,36 @@
3
3
  module CheckoutSdk
4
4
  module Previous
5
5
  module Apm
6
- module Sepa
7
- class SepaClient < Client
8
- SEPA_MANDATES = 'sepa/mandates'
9
- PPRO = 'ppro'
10
- CANCEL = 'cancel'
11
- private_constant :SEPA_MANDATES, :PPRO, :CANCEL
6
+ class SepaClient < Client
7
+ SEPA_MANDATES = 'sepa/mandates'
8
+ PPRO = 'ppro'
9
+ CANCEL = 'cancel'
10
+ private_constant :SEPA_MANDATES, :PPRO, :CANCEL
12
11
 
13
- # @param [ApiClient] api_client
14
- # @param [CheckoutConfiguration] configuration
15
- def initialize(api_client, configuration)
16
- super api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY
17
- end
12
+ # @param [ApiClient] api_client
13
+ # @param [CheckoutConfiguration] configuration
14
+ def initialize(api_client, configuration)
15
+ super api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY
16
+ end
18
17
 
19
- # @param mandate_id [String]
20
- def get_mandate(mandate_id)
21
- api_client.invoke_get(build_path(SEPA_MANDATES, mandate_id), sdk_authorization)
22
- end
18
+ # @param mandate_id [String]
19
+ def get_mandate(mandate_id)
20
+ api_client.invoke_get(build_path(SEPA_MANDATES, mandate_id), sdk_authorization)
21
+ end
23
22
 
24
- # @param mandate_id [String]
25
- def cancel_mandate(mandate_id)
26
- api_client.invoke_post(build_path(SEPA_MANDATES, mandate_id, CANCEL), sdk_authorization)
27
- end
23
+ # @param mandate_id [String]
24
+ def cancel_mandate(mandate_id)
25
+ api_client.invoke_post(build_path(SEPA_MANDATES, mandate_id, CANCEL), sdk_authorization)
26
+ end
28
27
 
29
- # @param mandate_id [String]
30
- def get_mandate_via_ppro(mandate_id)
31
- api_client.invoke_get(build_path(PPRO, SEPA_MANDATES, mandate_id), sdk_authorization)
32
- end
28
+ # @param mandate_id [String]
29
+ def get_mandate_via_ppro(mandate_id)
30
+ api_client.invoke_get(build_path(PPRO, SEPA_MANDATES, mandate_id), sdk_authorization)
31
+ end
33
32
 
34
- # @param mandate_id [String]
35
- def cancel_mandate_via_ppro(mandate_id)
36
- api_client.invoke_post(build_path(PPRO, SEPA_MANDATES, mandate_id, CANCEL), sdk_authorization)
37
- end
33
+ # @param mandate_id [String]
34
+ def cancel_mandate_via_ppro(mandate_id)
35
+ api_client.invoke_post(build_path(PPRO, SEPA_MANDATES, mandate_id, CANCEL), sdk_authorization)
38
36
  end
39
37
  end
40
38
  end
@@ -5,10 +5,19 @@ module CheckoutSdk
5
5
  # @return [CheckoutSdk::HttpMetadata]
6
6
  def self.map_to_http_metadata(response)
7
7
  metadata = CheckoutSdk::HttpMetadata.new
8
- # TODO: convert to hash
9
- metadata.headers = response[:headers]
10
- metadata.status_code = response[:status]
11
- metadata.body = response[:body]
8
+ return metadata if response.nil?
9
+
10
+ if response.is_a?(Hash)
11
+ metadata.headers = response[:headers]
12
+ metadata.status_code = response[:status]
13
+ metadata.body = response[:body]
14
+ end
15
+
16
+ if response.class.name.start_with? Faraday::Response.name
17
+ metadata.headers = response.headers
18
+ metadata.status_code = response.status
19
+ metadata.body = response.body
20
+ end
12
21
  metadata
13
22
  end
14
23
  end
@@ -26,6 +26,8 @@ module CheckoutSdk
26
26
  # @return [AccountHolderIdentification]
27
27
  # @!attribute email
28
28
  # @return [String]
29
+ # @!attribute gender
30
+ # @return [String]
29
31
  class AccountHolder
30
32
  attr_accessor :type,
31
33
  :first_name,
@@ -38,7 +40,8 @@ module CheckoutSdk
38
40
  :billing_address,
39
41
  :phone,
40
42
  :identification,
41
- :email
43
+ :email,
44
+ :gender
42
45
  end
43
46
  end
44
47
  end
@@ -20,3 +20,5 @@ require 'checkout_sdk/common/file_request'
20
20
  require 'checkout_sdk/common/file_purpose'
21
21
  require 'checkout_sdk/common/challenge_indicator'
22
22
  require 'checkout_sdk/common/update_customer_request'
23
+ require 'checkout_sdk/common/marketplace_data'
24
+ require 'checkout_sdk/common/shipping_info'
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Common
5
+ # @!attribute sub_entity_id
6
+ # @return [String]
7
+ # @!attribute sub_entities
8
+ # @return [Array(AmountAllocations)]
9
+ class MarketplaceData
10
+ attr_accessor :sub_entity_id,
11
+ :sub_entities
12
+ end
13
+ end
14
+ end
@@ -47,6 +47,7 @@ module CheckoutSdk
47
47
  MBWAY = 'mbway'
48
48
  POSTFINANCE = 'postfinance'
49
49
  STCPAY = 'stcpay'
50
+ ALMA = 'alma'
50
51
  end
51
52
  end
52
53
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Common
5
+ # @!attribute shipping_company
6
+ # @return [String]
7
+ # @!attribute shipping_method
8
+ # @return [String]
9
+ # @!attribute tracking_number
10
+ # @return [String]
11
+ # @!attribute tracking_uri
12
+ # @return [String]
13
+ # @!attribute return_shipping_company
14
+ # @return [String]
15
+ # @!attribute return_tracking_number
16
+ # @return [String]
17
+ # @!attribute return_tracking_uri
18
+ # @return [String]
19
+ class ShippingInfo
20
+ attr_accessor :shipping_company,
21
+ :shipping_method,
22
+ :tracking_number,
23
+ :tracking_uri,
24
+ :return_shipping_company,
25
+ :return_tracking_number,
26
+ :return_tracking_uri
27
+ end
28
+ end
29
+ end
@@ -11,9 +11,9 @@ module CheckoutSdk
11
11
  # @!attribute metadata
12
12
  # @return [Hash{String => Object}]
13
13
  # @!attribute default
14
- # @return [String]
14
+ # @return [String] - Not available on previous
15
15
  # @!attribute instruments
16
- # @return [Array(String)]
16
+ # @return [Array(String)] - Not available on previous
17
17
  class CustomerRequest
18
18
  attr_accessor :email,
19
19
  :name,
@@ -50,6 +50,11 @@ module CheckoutSdk
50
50
  def upload_file(file_request)
51
51
  api_client.submit_file(FILES, sdk_authorization, file_request)
52
52
  end
53
+
54
+ # @param [String] file_id
55
+ def get_file_details(file_id)
56
+ api_client.invoke_get(build_path(FILES, file_id), sdk_authorization)
57
+ end
53
58
  end
54
59
  end
55
60
  end
@@ -23,11 +23,11 @@ module CheckoutSdk
23
23
  # @!attribute this_channel_only
24
24
  # @return [TrueClass, FalseClass]
25
25
  # @!attribute entity_ids
26
- # @return [String]
26
+ # @return [String] - Not available on Previous.
27
27
  # @!attribute sub_entity_ids
28
- # @return [String]
28
+ # @return [String] - Not available on Previous.
29
29
  # @!attribute payment_mcc
30
- # @return [String]
30
+ # @return [String] - Not available on Previous.
31
31
  class DisputesQueryFilter
32
32
  attr_accessor :limit,
33
33
  :skip,
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Instruments
5
+ class BaseInstrumentsClient < Client
6
+ INSTRUMENTS = 'instruments'
7
+ private_constant :INSTRUMENTS
8
+
9
+ # @param [String] instrument_id
10
+ def get(instrument_id)
11
+ api_client.invoke_get(build_path(INSTRUMENTS, instrument_id), sdk_authorization)
12
+ end
13
+
14
+ # @param [String] instrument_id
15
+ def delete(instrument_id)
16
+ api_client.invoke_delete(build_path(INSTRUMENTS, instrument_id), sdk_authorization)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -4,7 +4,7 @@ module CheckoutSdk
4
4
  module Instruments
5
5
  # @!attribute type
6
6
  # @return [String] {CheckoutSdk::Common::InstrumentType}
7
- class InstrumentRequest
7
+ class Instrument
8
8
  attr_reader :type
9
9
 
10
10
  # @abstract
@@ -28,7 +28,7 @@ module CheckoutSdk
28
28
  # @return [CheckoutSdk::Common::BankDetails]
29
29
  # @!attribute customer
30
30
  # @return [CheckoutSdk::Common::CustomerRequest]
31
- class InstrumentBankAccountRequest < InstrumentRequest
31
+ class InstrumentBankAccount < Instrument
32
32
  attr_accessor :account_type,
33
33
  :account_number,
34
34
  :bank_code,
@@ -8,7 +8,7 @@ module CheckoutSdk
8
8
  # @return [CheckoutSdk::Common::AccountHolder]
9
9
  # @!attribute customer
10
10
  # @return [CheckoutSdk::Common::CustomerRequest]
11
- class InstrumentTokenRequest < InstrumentRequest
11
+ class InstrumentToken < Instrument
12
12
  attr_accessor :token,
13
13
  :account_holder,
14
14
  :customer
@@ -1,15 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Update
4
- require 'checkout_sdk/instruments/update/update_instrument_request'
5
- require 'checkout_sdk/instruments/update/update_instrument_card_request'
6
- require 'checkout_sdk/instruments/update/update_instrument_bank_account_request'
7
- require 'checkout_sdk/instruments/update/update_instrument_token_request'
4
+ require 'checkout_sdk/instruments/update/update_instrument'
5
+ require 'checkout_sdk/instruments/update/update_instrument_card'
6
+ require 'checkout_sdk/instruments/update/update_instrument_bank_account'
7
+ require 'checkout_sdk/instruments/update/update_instrument_token'
8
8
  # Get
9
9
  require 'checkout_sdk/instruments/get/payment_network'
10
10
  require 'checkout_sdk/instruments/get/bank_account_field_query'
11
11
  # Create
12
- require 'checkout_sdk/instruments/create/instrument_request'
13
- require 'checkout_sdk/instruments/create/instrument_token_request'
14
- require 'checkout_sdk/instruments/create/instrument_bank_account_request'
12
+ require 'checkout_sdk/instruments/create/instrument'
13
+ require 'checkout_sdk/instruments/create/instrument_token'
14
+ require 'checkout_sdk/instruments/create/instrument_bank_account'
15
+ # Client
16
+ require 'checkout_sdk/instruments/base_instruments_client'
15
17
  require 'checkout_sdk/instruments/instruments_client'
18
+
19
+ # Previous
20
+ require 'checkout_sdk/instruments/previous/create/instrument'
21
+ require 'checkout_sdk/instruments/previous/update/update_instrument'
22
+ require 'checkout_sdk/instruments/previous/instruments_client'