checkout_sdk 0.3.0 → 1.0.0.beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +31 -0
  3. data/CODE_OF_CONDUCT.md +84 -0
  4. data/Gemfile +5 -2
  5. data/LICENSE.md +9 -0
  6. data/README.md +96 -110
  7. data/Rakefile +3 -1
  8. data/lib/checkout_sdk/abstract_checkout_sdk_builder.rb +28 -0
  9. data/lib/checkout_sdk/api_client.rb +135 -0
  10. data/lib/checkout_sdk/apm/apm.rb +12 -0
  11. data/lib/checkout_sdk/apm/ideal/ideal_client.rb +25 -0
  12. data/lib/checkout_sdk/apm/previous/klarna/credit_session_request.rb +30 -0
  13. data/lib/checkout_sdk/apm/previous/klarna/klarna.rb +24 -0
  14. data/lib/checkout_sdk/apm/previous/klarna/klarna_client.rb +55 -0
  15. data/lib/checkout_sdk/apm/previous/klarna/klarna_product.rb +30 -0
  16. data/lib/checkout_sdk/apm/previous/klarna/klarna_shipping_info.rb +33 -0
  17. data/lib/checkout_sdk/apm/previous/klarna/order_capture_request.rb +37 -0
  18. data/lib/checkout_sdk/apm/previous/sepa/sepa_client.rb +42 -0
  19. data/lib/checkout_sdk/authorization_type.rb +12 -0
  20. data/lib/checkout_sdk/checkout_api.rb +51 -0
  21. data/lib/checkout_sdk/checkout_configuration.rb +22 -0
  22. data/lib/checkout_sdk/checkout_oauth_sdk_builder.rb +52 -0
  23. data/lib/checkout_sdk/checkout_sdk_builder.rb +20 -0
  24. data/lib/checkout_sdk/checkout_static_keys_sdk_builder.rb +23 -0
  25. data/lib/checkout_sdk/checkout_utils.rb +15 -0
  26. data/lib/checkout_sdk/client.rb +46 -0
  27. data/lib/checkout_sdk/common/abstract_file_request.rb +11 -0
  28. data/lib/checkout_sdk/common/account_holder.rb +44 -0
  29. data/lib/checkout_sdk/common/account_holder_identification.rb +20 -0
  30. data/lib/checkout_sdk/common/account_holder_identification_type.rb +13 -0
  31. data/lib/checkout_sdk/common/account_holder_type.rb +11 -0
  32. data/lib/checkout_sdk/common/account_type.rb +11 -0
  33. data/lib/checkout_sdk/common/address.rb +26 -0
  34. data/lib/checkout_sdk/common/amount_allocations.rb +20 -0
  35. data/lib/checkout_sdk/common/bank_details.rb +17 -0
  36. data/lib/checkout_sdk/common/challenge_indicator.rb +12 -0
  37. data/lib/checkout_sdk/common/commission.rb +14 -0
  38. data/lib/checkout_sdk/common/common.rb +22 -0
  39. data/lib/checkout_sdk/common/country.rb +260 -0
  40. data/lib/checkout_sdk/common/currency.rb +168 -0
  41. data/lib/checkout_sdk/common/customer_request.rb +26 -0
  42. data/lib/checkout_sdk/common/file_purpose.rb +9 -0
  43. data/lib/checkout_sdk/common/file_request.rb +11 -0
  44. data/lib/checkout_sdk/common/instrument_type.rb +11 -0
  45. data/lib/checkout_sdk/common/payment_source_type.rb +52 -0
  46. data/lib/checkout_sdk/common/phone.rb +14 -0
  47. data/lib/checkout_sdk/common/update_customer_request.rb +14 -0
  48. data/lib/checkout_sdk/customers/customer_request.rb +26 -0
  49. data/lib/checkout_sdk/customers/customers.rb +4 -0
  50. data/lib/checkout_sdk/customers/customers_client.rb +37 -0
  51. data/lib/checkout_sdk/disputes/dispute_evidence_request.rb +60 -0
  52. data/lib/checkout_sdk/disputes/dispute_status.rb +19 -0
  53. data/lib/checkout_sdk/disputes/disputes.rb +6 -0
  54. data/lib/checkout_sdk/disputes/disputes_client.rb +55 -0
  55. data/lib/checkout_sdk/disputes/disputes_query_filter.rb +47 -0
  56. data/lib/checkout_sdk/environment.rb +59 -0
  57. data/lib/checkout_sdk/error.rb +30 -0
  58. data/lib/checkout_sdk/forex/forex.rb +4 -0
  59. data/lib/checkout_sdk/forex/forex_client.rb +21 -0
  60. data/lib/checkout_sdk/forex/quote_request.rb +23 -0
  61. data/lib/checkout_sdk/http_metadata.rb +9 -0
  62. data/lib/checkout_sdk/instruments/create/instrument_bank_account_request.rb +51 -0
  63. data/lib/checkout_sdk/instruments/create/instrument_request.rb +17 -0
  64. data/lib/checkout_sdk/instruments/create/instrument_token_request.rb +21 -0
  65. data/lib/checkout_sdk/instruments/get/bank_account_field_query.rb +14 -0
  66. data/lib/checkout_sdk/instruments/get/payment_network.rb +14 -0
  67. data/lib/checkout_sdk/instruments/instruments.rb +15 -0
  68. data/lib/checkout_sdk/instruments/instruments_client.rb +49 -0
  69. data/lib/checkout_sdk/instruments/update/update_instrument_bank_account_request.rb +51 -0
  70. data/lib/checkout_sdk/instruments/update/update_instrument_card_request.rb +27 -0
  71. data/lib/checkout_sdk/instruments/update/update_instrument_request.rb +17 -0
  72. data/lib/checkout_sdk/instruments/update/update_instrument_token_request.rb +15 -0
  73. data/lib/checkout_sdk/json_serializer.rb +54 -0
  74. data/lib/checkout_sdk/oauth_access_token.rb +27 -0
  75. data/lib/checkout_sdk/oauth_scopes.rb +41 -0
  76. data/lib/checkout_sdk/oauth_sdk_credentials.rb +112 -0
  77. data/lib/checkout_sdk/payments/airline_data.rb +17 -0
  78. data/lib/checkout_sdk/payments/authorization_request.rb +17 -0
  79. data/lib/checkout_sdk/payments/authorization_type.rb +11 -0
  80. data/lib/checkout_sdk/payments/billing_descriptor.rb +17 -0
  81. data/lib/checkout_sdk/payments/capture_request.rb +41 -0
  82. data/lib/checkout_sdk/payments/capture_type.rb +10 -0
  83. data/lib/checkout_sdk/payments/charge_bearer.rb +10 -0
  84. data/lib/checkout_sdk/payments/d_local_installments.rb +11 -0
  85. data/lib/checkout_sdk/payments/d_local_processing_settings.rb +17 -0
  86. data/lib/checkout_sdk/payments/destination/bank_account_destination.rb +42 -0
  87. data/lib/checkout_sdk/payments/destination/card_destination.rb +24 -0
  88. data/lib/checkout_sdk/payments/destination/destination.rb +19 -0
  89. data/lib/checkout_sdk/payments/destination/destination_type.rb +12 -0
  90. data/lib/checkout_sdk/payments/destination/id_destination.rb +18 -0
  91. data/lib/checkout_sdk/payments/destination/token_destination.rb +18 -0
  92. data/lib/checkout_sdk/payments/exemption.rb +17 -0
  93. data/lib/checkout_sdk/payments/flight_leg_details.rb +35 -0
  94. data/lib/checkout_sdk/payments/instruction_scheme.rb +11 -0
  95. data/lib/checkout_sdk/payments/merchant_initiated_reason.rb +12 -0
  96. data/lib/checkout_sdk/payments/network_token_type.rb +12 -0
  97. data/lib/checkout_sdk/payments/os_type.rb +10 -0
  98. data/lib/checkout_sdk/payments/passenger.rb +17 -0
  99. data/lib/checkout_sdk/payments/passenger_name.rb +11 -0
  100. data/lib/checkout_sdk/payments/payer.rb +17 -0
  101. data/lib/checkout_sdk/payments/payment_instruction.rb +32 -0
  102. data/lib/checkout_sdk/payments/payment_recipient.rb +20 -0
  103. data/lib/checkout_sdk/payments/payment_request.rb +86 -0
  104. data/lib/checkout_sdk/payments/payment_type.rb +13 -0
  105. data/lib/checkout_sdk/payments/payments.rb +82 -0
  106. data/lib/checkout_sdk/payments/payments_client.rb +86 -0
  107. data/lib/checkout_sdk/payments/payout_billing_descriptor.rb +11 -0
  108. data/lib/checkout_sdk/payments/payout_request.rb +38 -0
  109. data/lib/checkout_sdk/payments/preferred_schema.rb +11 -0
  110. data/lib/checkout_sdk/payments/processing_settings.rb +80 -0
  111. data/lib/checkout_sdk/payments/product.rb +47 -0
  112. data/lib/checkout_sdk/payments/product_type.rb +12 -0
  113. data/lib/checkout_sdk/payments/refund_request.rb +17 -0
  114. data/lib/checkout_sdk/payments/risk_request.rb +11 -0
  115. data/lib/checkout_sdk/payments/sender/corporate_sender.rb +27 -0
  116. data/lib/checkout_sdk/payments/sender/government_sender.rb +27 -0
  117. data/lib/checkout_sdk/payments/sender/individual_sender.rb +42 -0
  118. data/lib/checkout_sdk/payments/sender/instrument_sender.rb +11 -0
  119. data/lib/checkout_sdk/payments/sender/sender.rb +22 -0
  120. data/lib/checkout_sdk/payments/sender/sender_type.rb +12 -0
  121. data/lib/checkout_sdk/payments/sender/source_of_funds.rb +14 -0
  122. data/lib/checkout_sdk/payments/sender/ticket.rb +23 -0
  123. data/lib/checkout_sdk/payments/shipping_details.rb +17 -0
  124. data/lib/checkout_sdk/payments/shipping_preference.rb +11 -0
  125. data/lib/checkout_sdk/payments/source/apm/after_pay_source.rb +15 -0
  126. data/lib/checkout_sdk/payments/source/apm/alipay_plus_source.rb +47 -0
  127. data/lib/checkout_sdk/payments/source/apm/bancontact_source.rb +24 -0
  128. data/lib/checkout_sdk/payments/source/apm/benefit_source.rb +11 -0
  129. data/lib/checkout_sdk/payments/source/apm/eps_source.rb +15 -0
  130. data/lib/checkout_sdk/payments/source/apm/giropay_source.rb +27 -0
  131. data/lib/checkout_sdk/payments/source/apm/ideal_source.rb +21 -0
  132. data/lib/checkout_sdk/payments/source/apm/knet_source.rb +36 -0
  133. data/lib/checkout_sdk/payments/source/apm/mbway_source.rb +11 -0
  134. data/lib/checkout_sdk/payments/source/apm/multi_banco_source.rb +21 -0
  135. data/lib/checkout_sdk/payments/source/apm/p24_source.rb +24 -0
  136. data/lib/checkout_sdk/payments/source/apm/paypal_source.rb +11 -0
  137. data/lib/checkout_sdk/payments/source/apm/post_finance_source.rb +21 -0
  138. data/lib/checkout_sdk/payments/source/apm/qpay_source.rb +24 -0
  139. data/lib/checkout_sdk/payments/source/apm/sofort_source.rb +18 -0
  140. data/lib/checkout_sdk/payments/source/apm/stcpay_source.rb +11 -0
  141. data/lib/checkout_sdk/payments/source/apm/tamara_source.rb +15 -0
  142. data/lib/checkout_sdk/payments/source/apm/we_chat_pay_source.rb +15 -0
  143. data/lib/checkout_sdk/payments/source/bank_account_source.rb +30 -0
  144. data/lib/checkout_sdk/payments/source/card_source.rb +39 -0
  145. data/lib/checkout_sdk/payments/source/currency_account_source.rb +15 -0
  146. data/lib/checkout_sdk/payments/source/id_source.rb +21 -0
  147. data/lib/checkout_sdk/payments/source/network_token_source.rb +45 -0
  148. data/lib/checkout_sdk/payments/source/payment_request_source.rb +18 -0
  149. data/lib/checkout_sdk/payments/source/payout_request_source.rb +22 -0
  150. data/lib/checkout_sdk/payments/source/payout_source_type.rb +9 -0
  151. data/lib/checkout_sdk/payments/source/provider_token_source.rb +21 -0
  152. data/lib/checkout_sdk/payments/source/token_source.rb +24 -0
  153. data/lib/checkout_sdk/payments/terminal_type.rb +11 -0
  154. data/lib/checkout_sdk/payments/three_ds_flow_type.rb +11 -0
  155. data/lib/checkout_sdk/payments/three_ds_request.rb +56 -0
  156. data/lib/checkout_sdk/payments/user_action.rb +10 -0
  157. data/lib/checkout_sdk/payments/void_request.rb +14 -0
  158. data/lib/checkout_sdk/platform_type.rb +10 -0
  159. data/lib/checkout_sdk/previous/checkout_api.rb +29 -0
  160. data/lib/checkout_sdk/previous/checkout_previous_sdk_builder.rb +11 -0
  161. data/lib/checkout_sdk/previous/checkout_previous_static_keys_sdk_builder.rb +24 -0
  162. data/lib/checkout_sdk/previous/previous_static_keys_sdk_credentials.rb +38 -0
  163. data/lib/checkout_sdk/sdk_authorization.rb +25 -0
  164. data/lib/checkout_sdk/sdk_credentials.rb +12 -0
  165. data/lib/checkout_sdk/sessions/authentication_method.rb +14 -0
  166. data/lib/checkout_sdk/sessions/authentication_type.rb +10 -0
  167. data/lib/checkout_sdk/sessions/card_holder_account_info.rb +32 -0
  168. data/lib/checkout_sdk/sessions/category.rb +10 -0
  169. data/lib/checkout_sdk/sessions/channel/app_session.rb +36 -0
  170. data/lib/checkout_sdk/sessions/channel/browser_session.rb +42 -0
  171. data/lib/checkout_sdk/sessions/channel/channel_data.rb +19 -0
  172. data/lib/checkout_sdk/sessions/channel/channel_data_type.rb +10 -0
  173. data/lib/checkout_sdk/sessions/channel/sdk_ephemeral_public_key.rb +19 -0
  174. data/lib/checkout_sdk/sessions/channel/sdk_interface_type.rb +11 -0
  175. data/lib/checkout_sdk/sessions/channel/three_ds_method_completion.rb +11 -0
  176. data/lib/checkout_sdk/sessions/channel/uie_elements.rb +13 -0
  177. data/lib/checkout_sdk/sessions/completion/completion_info.rb +19 -0
  178. data/lib/checkout_sdk/sessions/completion/completion_info_type.rb +10 -0
  179. data/lib/checkout_sdk/sessions/completion/hosted_completion_info.rb +21 -0
  180. data/lib/checkout_sdk/sessions/completion/non_hosted_completion_info.rb +15 -0
  181. data/lib/checkout_sdk/sessions/delivery_timeframe.rb +12 -0
  182. data/lib/checkout_sdk/sessions/installment.rb +17 -0
  183. data/lib/checkout_sdk/sessions/merchant_risk_info.rb +23 -0
  184. data/lib/checkout_sdk/sessions/recurring.rb +14 -0
  185. data/lib/checkout_sdk/sessions/session_address.rb +11 -0
  186. data/lib/checkout_sdk/sessions/session_marketplace_data.rb +11 -0
  187. data/lib/checkout_sdk/sessions/session_request.rb +68 -0
  188. data/lib/checkout_sdk/sessions/session_secret_credentials.rb +28 -0
  189. data/lib/checkout_sdk/sessions/session_source_type.rb +12 -0
  190. data/lib/checkout_sdk/sessions/sessions.rb +47 -0
  191. data/lib/checkout_sdk/sessions/sessions_billing_descriptor.rb +11 -0
  192. data/lib/checkout_sdk/sessions/sessions_client.rb +64 -0
  193. data/lib/checkout_sdk/sessions/shipping_indicator.rb +9 -0
  194. data/lib/checkout_sdk/sessions/source/card_source.rb +30 -0
  195. data/lib/checkout_sdk/sessions/source/id_source.rb +15 -0
  196. data/lib/checkout_sdk/sessions/source/network_token_source.rb +27 -0
  197. data/lib/checkout_sdk/sessions/source/session_scheme.rb +14 -0
  198. data/lib/checkout_sdk/sessions/source/session_source.rb +37 -0
  199. data/lib/checkout_sdk/sessions/source/token_source.rb +18 -0
  200. data/lib/checkout_sdk/sessions/three_ds_method_completion_request.rb +11 -0
  201. data/lib/checkout_sdk/sessions/transaction_type.rb +13 -0
  202. data/lib/checkout_sdk/static_keys_builder.rb +35 -0
  203. data/lib/checkout_sdk/static_keys_sdk_credentials.rb +35 -0
  204. data/lib/checkout_sdk/tokens/apple_pay_token_data.rb +20 -0
  205. data/lib/checkout_sdk/tokens/apple_pay_token_request.rb +15 -0
  206. data/lib/checkout_sdk/tokens/card_token_request.rb +36 -0
  207. data/lib/checkout_sdk/tokens/google_pay_token_data.rb +17 -0
  208. data/lib/checkout_sdk/tokens/google_pay_token_request.rb +15 -0
  209. data/lib/checkout_sdk/tokens/token_type.rb +11 -0
  210. data/lib/checkout_sdk/tokens/tokens.rb +10 -0
  211. data/lib/checkout_sdk/tokens/tokens_client.rb +21 -0
  212. data/lib/checkout_sdk/tokens/wallet_token_request.rb +19 -0
  213. data/lib/checkout_sdk/version.rb +3 -1
  214. data/lib/checkout_sdk.rb +59 -21
  215. data/sig/checkout_sdk.rbs +4 -0
  216. metadata +254 -81
  217. data/.gitignore +0 -11
  218. data/.travis.yml +0 -7
  219. data/Gemfile.lock +0 -45
  220. data/LICENSE +0 -21
  221. data/bin/console +0 -14
  222. data/bin/setup +0 -8
  223. data/checkout_sdk.gemspec +0 -24
  224. data/documentation/.gitignore +0 -20
  225. data/documentation/docs/environment.md +0 -26
  226. data/documentation/docs/getting_started.md +0 -48
  227. data/documentation/docs/initialize.md +0 -19
  228. data/documentation/docs/install.md +0 -21
  229. data/documentation/docs/payments.md +0 -200
  230. data/documentation/docs/sources.md +0 -53
  231. data/documentation/docs/tokens.md +0 -88
  232. data/documentation/docusaurus.config.js +0 -60
  233. data/documentation/package-lock.json +0 -13511
  234. data/documentation/package.json +0 -32
  235. data/documentation/sidebars.js +0 -10
  236. data/documentation/src/css/custom.css +0 -103
  237. data/documentation/src/pages/index.js +0 -10
  238. data/documentation/src/pages/styles.module.css +0 -37
  239. data/documentation/static/img/favicon.png +0 -0
  240. data/documentation/static/img/logo.png +0 -0
  241. data/documentation/static/img/undraw_docusaurus_mountain.svg +0 -170
  242. data/documentation/static/img/undraw_docusaurus_react.svg +0 -169
  243. data/documentation/static/img/undraw_docusaurus_tree.svg +0 -1
  244. data/documentation/yarn.lock +0 -9369
  245. data/lib/checkout_sdk/api_resource.rb +0 -77
  246. data/lib/checkout_sdk/configuration.rb +0 -10
  247. data/lib/checkout_sdk/data/capture_payment.rb +0 -11
  248. data/lib/checkout_sdk/data/payment_request_source.rb +0 -145
  249. data/lib/checkout_sdk/data/payment_source.rb +0 -40
  250. data/lib/checkout_sdk/data/refund_payment.rb +0 -11
  251. data/lib/checkout_sdk/data/request_token.rb +0 -67
  252. data/lib/checkout_sdk/data/void_payment.rb +0 -10
  253. data/spec/checkout_sdk/api_resource_spec.rb +0 -126
  254. data/spec/checkout_sdk/data/payment_request_source_spec.rb +0 -126
  255. data/spec/checkout_sdk/data/request_token_spec.rb +0 -107
  256. data/spec/checkout_sdk_spec.rb +0 -21
  257. data/spec/spec_helper.rb +0 -32
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute name
6
+ # @return [String]
7
+ # @!attribute email
8
+ # @return [String]
9
+ # @!attribute document
10
+ # @return [String]
11
+ class Payer
12
+ attr_accessor :name,
13
+ :email,
14
+ :document
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute purpose
6
+ # @return [String]
7
+ # @!attribute charge_bearer
8
+ # @return [String] {ChargeBearer}
9
+ # @!attribute repair
10
+ # @return [TrueClass, FalseClass]
11
+ # @!attribute scheme
12
+ # @return [String] {InstructionScheme}
13
+ # @!attribute quote_id
14
+ # @return [String]
15
+ # @!attribute skip_expiry
16
+ # @return [TrueClass, FalseClass]
17
+ # @!attribute funds_transfer_type
18
+ # @return [String]
19
+ # @!attribute mvv
20
+ # @return [String]
21
+ class PaymentInstruction
22
+ attr_accessor :purpose,
23
+ :charge_bearer,
24
+ :repair,
25
+ :scheme,
26
+ :quote_id,
27
+ :skip_expiry,
28
+ :funds_transfer_type,
29
+ :mvv
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute dob
6
+ # @return [String]
7
+ # @!attribute account_number
8
+ # @return [String]
9
+ # @!attribute zip
10
+ # @return [String]
11
+ # @!attribute last_name
12
+ # @return [String]
13
+ class PaymentRecipient
14
+ attr_accessor :dob,
15
+ :account_number,
16
+ :zip,
17
+ :last_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute source
6
+ # @return [PaymentRequestSource]
7
+ # @!attribute amount
8
+ # @return [Integer]
9
+ # @!attribute currency
10
+ # @return [String] {CheckoutSdk::Common::Currency}
11
+ # @!attribute payment_type
12
+ # @return [String] {PaymentType}
13
+ # @!attribute merchant_initiated
14
+ # @return [TrueClass, FalseClass]
15
+ # @!attribute reference
16
+ # @return [String]
17
+ # @!attribute description
18
+ # @return [String]
19
+ # @!attribute authorization_type
20
+ # @return [String] {AuthorizationType}
21
+ # @!attribute capture
22
+ # @return [TrueClass, FalseClass]
23
+ # @!attribute capture_on
24
+ # @return [Time]
25
+ # @!attribute customer
26
+ # @return [CheckoutSdk::Common::CustomerRequest]
27
+ # @!attribute billing_descriptor
28
+ # @return [BillingDescriptor]
29
+ # @!attribute shipping
30
+ # @return [ShippingDetails]
31
+ # @!attribute three_ds
32
+ # @return [ThreeDSRequest]
33
+ # @!attribute processing_channel_id
34
+ # @return [String]
35
+ # @!attribute previous_payment_id
36
+ # @return [String]
37
+ # @!attribute risk
38
+ # @return [RiskRequest]
39
+ # @!attribute success_url
40
+ # @return [String]
41
+ # @!attribute failure_url
42
+ # @return [String]
43
+ # @!attribute payment_ip
44
+ # @return [String]
45
+ # @!attribute sender
46
+ # @return [Sender]
47
+ # @!attribute recipient
48
+ # @return [PaymentRecipient]
49
+ # @!attribute amount_allocations
50
+ # @return [Array(CheckoutSdk::Common::AmountAllocations)]
51
+ # @!attribute processing
52
+ # @return [ProcessingSettings]
53
+ # @!attribute metadata
54
+ # @return [Hash{String => Object}]
55
+ # @!attribute items
56
+ # @return [Array(Product)]
57
+ class PaymentRequest
58
+ attr_accessor :source,
59
+ :amount,
60
+ :currency,
61
+ :payment_type,
62
+ :merchant_initiated,
63
+ :reference,
64
+ :description,
65
+ :authorization_type,
66
+ :capture,
67
+ :capture_on,
68
+ :customer,
69
+ :billing_descriptor,
70
+ :shipping,
71
+ :three_ds,
72
+ :processing_channel_id,
73
+ :previous_payment_id,
74
+ :risk,
75
+ :success_url,
76
+ :failure_url,
77
+ :payment_ip,
78
+ :sender,
79
+ :recipient,
80
+ :amount_allocations,
81
+ :processing,
82
+ :metadata,
83
+ :items
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ module PaymentType
6
+ REGULAR = 'Regular'
7
+ RECURRING = 'Recurring'
8
+ MOTO = 'Moto'
9
+ INSTALLMENT = 'Installment'
10
+ UNSCHEDULED = 'Unscheduled'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'checkout_sdk/payments/capture_request'
4
+ require 'checkout_sdk/payments/passenger'
5
+ require 'checkout_sdk/payments/authorization_request'
6
+ require 'checkout_sdk/payments/d_local_processing_settings'
7
+ require 'checkout_sdk/payments/payout_request'
8
+ require 'checkout_sdk/payments/user_action'
9
+ require 'checkout_sdk/payments/three_ds_request'
10
+ require 'checkout_sdk/payments/product_type'
11
+ require 'checkout_sdk/payments/payout_billing_descriptor'
12
+ require 'checkout_sdk/payments/shipping_details'
13
+ require 'checkout_sdk/payments/payer'
14
+ require 'checkout_sdk/payments/authorization_type'
15
+ require 'checkout_sdk/payments/os_type'
16
+ require 'checkout_sdk/payments/payment_instruction'
17
+ require 'checkout_sdk/payments/refund_request'
18
+ require 'checkout_sdk/payments/product'
19
+ require 'checkout_sdk/payments/source/payment_request_source'
20
+ require 'checkout_sdk/payments/source/payout_request_source'
21
+ require 'checkout_sdk/payments/source/network_token_source'
22
+ require 'checkout_sdk/payments/source/token_source'
23
+ require 'checkout_sdk/payments/source/provider_token_source'
24
+ require 'checkout_sdk/payments/source/bank_account_source'
25
+ require 'checkout_sdk/payments/source/payout_source_type'
26
+ require 'checkout_sdk/payments/source/currency_account_source'
27
+ require 'checkout_sdk/payments/source/id_source'
28
+ require 'checkout_sdk/payments/source/card_source'
29
+ require 'checkout_sdk/payments/source/apm/after_pay_source'
30
+ require 'checkout_sdk/payments/source/apm/alipay_plus_source'
31
+ require 'checkout_sdk/payments/source/apm/bancontact_source'
32
+ require 'checkout_sdk/payments/source/apm/benefit_source'
33
+ require 'checkout_sdk/payments/source/apm/eps_source'
34
+ require 'checkout_sdk/payments/source/apm/giropay_source'
35
+ require 'checkout_sdk/payments/source/apm/ideal_source'
36
+ require 'checkout_sdk/payments/source/apm/knet_source'
37
+ require 'checkout_sdk/payments/source/apm/mbway_source'
38
+ require 'checkout_sdk/payments/source/apm/multi_banco_source'
39
+ require 'checkout_sdk/payments/source/apm/p24_source'
40
+ require 'checkout_sdk/payments/source/apm/paypal_source'
41
+ require 'checkout_sdk/payments/source/apm/post_finance_source'
42
+ require 'checkout_sdk/payments/source/apm/qpay_source'
43
+ require 'checkout_sdk/payments/source/apm/sofort_source'
44
+ require 'checkout_sdk/payments/source/apm/stcpay_source'
45
+ require 'checkout_sdk/payments/source/apm/tamara_source'
46
+ require 'checkout_sdk/payments/source/apm/we_chat_pay_source'
47
+ require 'checkout_sdk/payments/sender/sender'
48
+ require 'checkout_sdk/payments/sender/sender_type'
49
+ require 'checkout_sdk/payments/sender/source_of_funds'
50
+ require 'checkout_sdk/payments/sender/government_sender'
51
+ require 'checkout_sdk/payments/sender/individual_sender'
52
+ require 'checkout_sdk/payments/sender/corporate_sender'
53
+ require 'checkout_sdk/payments/sender/instrument_sender'
54
+ require 'checkout_sdk/payments/sender/ticket'
55
+ require 'checkout_sdk/payments/capture_type'
56
+ require 'checkout_sdk/payments/payment_type'
57
+ require 'checkout_sdk/payments/destination/destination'
58
+ require 'checkout_sdk/payments/destination/token_destination'
59
+ require 'checkout_sdk/payments/destination/bank_account_destination'
60
+ require 'checkout_sdk/payments/destination/card_destination'
61
+ require 'checkout_sdk/payments/destination/destination_type'
62
+ require 'checkout_sdk/payments/destination/id_destination'
63
+ require 'checkout_sdk/payments/merchant_initiated_reason'
64
+ require 'checkout_sdk/payments/preferred_schema'
65
+ require 'checkout_sdk/payments/airline_data'
66
+ require 'checkout_sdk/payments/risk_request'
67
+ require 'checkout_sdk/payments/payments_client'
68
+ require 'checkout_sdk/payments/billing_descriptor'
69
+ require 'checkout_sdk/payments/payment_recipient'
70
+ require 'checkout_sdk/payments/d_local_installments'
71
+ require 'checkout_sdk/payments/shipping_preference'
72
+ require 'checkout_sdk/payments/exemption'
73
+ require 'checkout_sdk/payments/three_ds_flow_type'
74
+ require 'checkout_sdk/payments/void_request'
75
+ require 'checkout_sdk/payments/payment_request'
76
+ require 'checkout_sdk/payments/passenger_name'
77
+ require 'checkout_sdk/payments/processing_settings'
78
+ require 'checkout_sdk/payments/charge_bearer'
79
+ require 'checkout_sdk/payments/instruction_scheme'
80
+ require 'checkout_sdk/payments/network_token_type'
81
+ require 'checkout_sdk/payments/terminal_type'
82
+ require 'checkout_sdk/payments/flight_leg_details'
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ class PaymentsClient < Client
6
+ PAYMENTS_PATH = 'payments'
7
+ private_constant :PAYMENTS_PATH
8
+
9
+ # @param [ApiClient] api_client
10
+ # @param [CheckoutConfiguration] configuration
11
+ def initialize(api_client, configuration)
12
+ super api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY_OR_OAUTH
13
+ end
14
+
15
+ # @param [PaymentRequest] payment_request
16
+ # @param [String, nil] idempotency_key
17
+ def request_payment(payment_request, idempotency_key = nil)
18
+ api_client.invoke_post(PAYMENTS_PATH,
19
+ sdk_authorization,
20
+ payment_request,
21
+ idempotency_key)
22
+ end
23
+
24
+ # @param [PayoutRequest] payout_request
25
+ # @param [String, nil] idempotency_key
26
+ def request_payout(payout_request, idempotency_key = nil)
27
+ api_client.invoke_post(PAYMENTS_PATH,
28
+ sdk_authorization,
29
+ payout_request,
30
+ idempotency_key)
31
+ end
32
+
33
+ # @param [String] payment_id
34
+ def get_payment_details(payment_id)
35
+ api_client.invoke_get(build_path(PAYMENTS_PATH, payment_id),
36
+ sdk_authorization)
37
+ end
38
+
39
+ # @param [String] payment_id
40
+ def get_payment_actions(payment_id)
41
+ api_client.invoke_get(build_path(PAYMENTS_PATH, payment_id, 'actions'),
42
+ sdk_authorization)
43
+ end
44
+
45
+ # @param [String] payment_id
46
+ # @param [CaptureRequest] capture_request
47
+ # @param [String, nil] idempotency_key
48
+ def capture_payment(payment_id, capture_request = nil, idempotency_key = nil)
49
+ api_client.invoke_post(build_path(PAYMENTS_PATH, payment_id, 'captures'),
50
+ sdk_authorization,
51
+ capture_request,
52
+ idempotency_key)
53
+ end
54
+
55
+ # @param [String] payment_id
56
+ # @param [RefundRequest] refund_request
57
+ # @param [String, nil] idempotency_key
58
+ def refund_payment(payment_id, refund_request = nil, idempotency_key = nil)
59
+ api_client.invoke_post(build_path(PAYMENTS_PATH, payment_id, 'refunds'),
60
+ sdk_authorization,
61
+ refund_request,
62
+ idempotency_key)
63
+ end
64
+
65
+ # @param [String] payment_id
66
+ # @param [VoidRequest] void_request
67
+ # @param [String, nil] idempotency_key
68
+ def void_payment(payment_id, void_request = nil, idempotency_key = nil)
69
+ api_client.invoke_post(build_path(PAYMENTS_PATH, payment_id, 'voids'),
70
+ sdk_authorization,
71
+ void_request,
72
+ idempotency_key)
73
+ end
74
+
75
+ # @param [String] payment_id
76
+ # @param [AuthorizationRequest] authorization_request
77
+ # @param [String, nil] idempotency_key
78
+ def increment_payment_authorization(payment_id, authorization_request = nil, idempotency_key = nil)
79
+ api_client.invoke_post(build_path(PAYMENTS_PATH, payment_id, 'authorizations'),
80
+ sdk_authorization,
81
+ authorization_request,
82
+ idempotency_key)
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute reference
6
+ # @return [String]
7
+ class PayoutBillingDescriptor
8
+ attr_accessor :reference
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute source
6
+ # @return [PayoutRequestSource]
7
+ # @!attribute destination
8
+ # @return [Destination]
9
+ # @!attribute amount
10
+ # @return [Integer]
11
+ # @!attribute currency
12
+ # @return [String] {CheckoutSdk::Common::Currency}
13
+ # @!attribute reference
14
+ # @return [String]
15
+ # @!attribute billing_descriptor
16
+ # @return [PayoutBillingDescriptor]
17
+ # @!attribute sender
18
+ # @return [Sender]
19
+ # @!attribute instruction
20
+ # @return [PaymentInstruction]
21
+ # @!attribute processing_channel_id
22
+ # @return [String]
23
+ # @!attribute metadata
24
+ # @return [Hash{String => Object}]
25
+ class PayoutRequest
26
+ attr_accessor :source,
27
+ :destination,
28
+ :amount,
29
+ :currency,
30
+ :reference,
31
+ :billing_descriptor,
32
+ :sender,
33
+ :instruction,
34
+ :processing_channel_id,
35
+ :metadata
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ module PreferredSchema
6
+ VISA = 'visa'
7
+ MASTERCARD = 'mastercard'
8
+ CARTES_BANCAIRES = 'cartes_bancaires'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute order_id
6
+ # @return [String]
7
+ # @!attribute tax_amount
8
+ # @return [Integer]
9
+ # @!attribute discount_amount
10
+ # @return [Integer]
11
+ # @!attribute duty_amount
12
+ # @return [Integer]
13
+ # @!attribute shipping_amount
14
+ # @return [Integer]
15
+ # @!attribute shipping_tax_amount
16
+ # @return [Integer]
17
+ # @!attribute aft
18
+ # @return [TrueClass, FalseClass]
19
+ # @!attribute preferred_scheme
20
+ # @return [String] {PreferredSchema}
21
+ # @!attribute merchant_initiated_reason
22
+ # @return [String] {MerchantInitiatedReason}
23
+ # @!attribute campaign_id
24
+ # @return [Integer]
25
+ # @!attribute product_type
26
+ # @return [String] {ProductType}
27
+ # @!attribute open_id
28
+ # @return [String]
29
+ # @!attribute original_order_amount
30
+ # @return [Integer]
31
+ # @!attribute receipt_id
32
+ # @return [String]
33
+ # @!attribute terminal_type
34
+ # @return [String] {TerminalType}
35
+ # @!attribute os_type
36
+ # @return [String] {OsType}
37
+ # @!attribute invoice_id
38
+ # @return [String]
39
+ # @!attribute brand_name
40
+ # @return [String]
41
+ # @!attribute locale
42
+ # @return [String]
43
+ # @!attribute shipping_preference
44
+ # @return [String] {ShippingPreference}
45
+ # @!attribute user_action
46
+ # @return [String] {UserAction}
47
+ # @!attribute set_transaction_context
48
+ # @return [Array(Hash{String => String})]
49
+ # @!attribute airline_data
50
+ # @return [Array(AirlineData)]
51
+ # @!attribute dlocal
52
+ # @return [DLocalProcessingSettings]
53
+ class ProcessingSettings
54
+ attr_accessor :order_id,
55
+ :tax_amount,
56
+ :discount_amount,
57
+ :duty_amount,
58
+ :shipping_amount,
59
+ :shipping_tax_amount,
60
+ :aft,
61
+ :preferred_scheme,
62
+ :merchant_initiated_reason,
63
+ :campaign_id,
64
+ :product_type,
65
+ :open_id,
66
+ :original_order_amount,
67
+ :receipt_id,
68
+ :terminal_type,
69
+ :os_type,
70
+ :invoice_id,
71
+ :brand_name,
72
+ :locale,
73
+ :shipping_preference,
74
+ :user_action,
75
+ :set_transaction_context,
76
+ :airline_data,
77
+ :dlocal
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute name
6
+ # @return [String]
7
+ # @!attribute quantity
8
+ # @return [Integer]
9
+ # @!attribute unit_price
10
+ # @return [Integer]
11
+ # @!attribute reference
12
+ # @return [String]
13
+ # @!attribute commodity_code
14
+ # @return [String]
15
+ # @!attribute unit_of_measure
16
+ # @return [String]
17
+ # @!attribute total_amount
18
+ # @return [Integer]
19
+ # @!attribute tax_amount
20
+ # @return [Integer]
21
+ # @!attribute discount_amount
22
+ # @return [Integer]
23
+ # @!attribute wxpay_goods_id
24
+ # @return [String]
25
+ # @!attribute image_url
26
+ # @return [String]
27
+ # @!attribute url
28
+ # @return [String]
29
+ # @!attribute sku
30
+ # @return [String]
31
+ class Product
32
+ attr_accessor :name,
33
+ :quantity,
34
+ :unit_price,
35
+ :reference,
36
+ :commodity_code,
37
+ :unit_of_measure,
38
+ :total_amount,
39
+ :tax_amount,
40
+ :discount_amount,
41
+ :wxpay_goods_id,
42
+ :image_url,
43
+ :url,
44
+ :sku
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ module ProductType
6
+ QR_CODE = 'QR Code'
7
+ IN_APP = 'In-App'
8
+ OFFICIAL_ACCOUNT = 'Official Account'
9
+ MINI_PROGRAM = 'Mini Program'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute amount
6
+ # @return [Integer]
7
+ # @!attribute reference
8
+ # @return [String]
9
+ # @!attribute metadata
10
+ # @return [Hash{String => Object}]
11
+ class RefundRequest
12
+ attr_accessor :amount,
13
+ :reference,
14
+ :metadata
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute enabled
6
+ # @return [TrueClass, FalseClass]
7
+ class RiskRequest
8
+ attr_accessor :enabled
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute company_name
6
+ # @return [String]
7
+ # @!attribute address
8
+ # @return [String] {CheckoutSdk::Common::Address}
9
+ # @!attribute reference_type
10
+ # @return [String]
11
+ # @!attribute source_of_funds
12
+ # @return [String] {SourceOfFunds}
13
+ # @!attribute identification
14
+ # @return [CheckoutSdk::Common::AccountHolderIdentification]
15
+ class CorporateSender < Sender
16
+ attr_accessor :company_name,
17
+ :address,
18
+ :reference_type,
19
+ :source_of_funds,
20
+ :identification
21
+
22
+ def initialize
23
+ super CheckoutSdk::Payments::SenderType::CORPORATE
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute company_name
6
+ # @return [String]
7
+ # @!attribute address
8
+ # @return [String] {CheckoutSdk::Common::Address}
9
+ # @!attribute reference_type
10
+ # @return [String]
11
+ # @!attribute source_of_funds
12
+ # @return [String] {SourceOfFunds}
13
+ # @!attribute identification
14
+ # @return [CheckoutSdk::Common::AccountHolderIdentification]
15
+ class GovernmentSender < Sender
16
+ attr_accessor :company_name,
17
+ :address,
18
+ :reference_type,
19
+ :source_of_funds,
20
+ :identification
21
+
22
+ def initialize
23
+ super CheckoutSdk::Payments::SenderType::GOVERNMENT
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutSdk
4
+ module Payments
5
+ # @!attribute first_name
6
+ # @return [String]
7
+ # @!attribute last_name
8
+ # @return [String]
9
+ # @!attribute address
10
+ # @return [String] {CheckoutSdk::Common::Address}
11
+ # @!attribute identification
12
+ # @return [CheckoutSdk::Common::AccountHolderIdentification]
13
+ # @!attribute middle_name
14
+ # @return [String]
15
+ # @!attribute reference_type
16
+ # @return [String]
17
+ # @!attribute date_of_birth
18
+ # @return [String]
19
+ # @!attribute source_of_funds
20
+ # @return [String] {SourceOfFunds}
21
+ # @!attribute country_of_birth
22
+ # @return [String] {CheckoutSdk::Common::Country}
23
+ # @!attribute nationality
24
+ # @return [String] {CheckoutSdk::Common::Country}
25
+ class IndividualSender < Sender
26
+ attr_accessor :first_name,
27
+ :last_name,
28
+ :address,
29
+ :identification,
30
+ :middle_name,
31
+ :reference_type,
32
+ :date_of_birth,
33
+ :source_of_funds,
34
+ :country_of_birth,
35
+ :nationality
36
+
37
+ def initialize
38
+ super CheckoutSdk::Payments::SenderType::INDIVIDUAL
39
+ end
40
+ end
41
+ end
42
+ end