checkout_sdk 1.0.0.beta.1 → 1.0.0.beta.2
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/README.md +57 -0
- data/lib/checkout_sdk/abstract_checkout_sdk_builder.rb +25 -4
- data/lib/checkout_sdk/accounts/account_holder.rb +35 -0
- data/lib/checkout_sdk/accounts/accounts.rb +30 -0
- data/lib/checkout_sdk/accounts/accounts_client.rb +65 -0
- data/lib/checkout_sdk/accounts/business_type.rb +15 -0
- data/lib/checkout_sdk/accounts/company.rb +35 -0
- data/lib/checkout_sdk/accounts/contact_details.rb +14 -0
- data/lib/checkout_sdk/accounts/date_of_birth.rb +17 -0
- data/lib/checkout_sdk/accounts/document.rb +17 -0
- data/lib/checkout_sdk/accounts/document_type.rb +14 -0
- data/lib/checkout_sdk/accounts/entity_document.rb +14 -0
- data/lib/checkout_sdk/accounts/entity_email_addresses.rb +11 -0
- data/lib/checkout_sdk/accounts/entity_financial_details.rb +20 -0
- data/lib/checkout_sdk/accounts/entity_financial_documents.rb +14 -0
- data/lib/checkout_sdk/accounts/file_request.rb +8 -0
- data/lib/checkout_sdk/accounts/identification.rb +14 -0
- data/lib/checkout_sdk/accounts/individual.rb +38 -0
- data/lib/checkout_sdk/accounts/instrument_document.rb +14 -0
- data/lib/checkout_sdk/accounts/onboard_entity.rb +23 -0
- data/lib/checkout_sdk/accounts/payment_instrument.rb +50 -0
- data/lib/checkout_sdk/accounts/phone.rb +11 -0
- data/lib/checkout_sdk/accounts/place_of_birth.rb +11 -0
- data/lib/checkout_sdk/accounts/profile.rb +17 -0
- data/lib/checkout_sdk/accounts/representative.rb +35 -0
- data/lib/checkout_sdk/accounts/schedule_frequency_daily.rb +11 -0
- data/lib/checkout_sdk/accounts/schedule_frequency_monthly.rb +15 -0
- data/lib/checkout_sdk/accounts/schedule_frequency_type.rb +11 -0
- data/lib/checkout_sdk/accounts/schedule_frequency_weekly.rb +15 -0
- data/lib/checkout_sdk/accounts/schedule_request.rb +19 -0
- data/lib/checkout_sdk/accounts/update_schedule.rb +17 -0
- data/lib/checkout_sdk/api_client.rb +11 -20
- data/lib/checkout_sdk/checkout_api.rb +28 -2
- data/lib/checkout_sdk/checkout_configuration.rb +6 -4
- data/lib/checkout_sdk/checkout_oauth_sdk_builder.rb +3 -1
- data/lib/checkout_sdk/checkout_static_keys_sdk_builder.rb +2 -1
- data/lib/checkout_sdk/checkout_utils.rb +15 -0
- data/lib/checkout_sdk/common/common.rb +1 -1
- data/lib/checkout_sdk/common/file_request.rb +5 -2
- data/lib/checkout_sdk/common/product.rb +17 -0
- data/lib/checkout_sdk/instruments/create/instrument.rb +2 -0
- data/lib/checkout_sdk/instruments/update/update_instrument.rb +2 -0
- data/lib/checkout_sdk/oauth_scopes.rb +2 -0
- data/lib/checkout_sdk/oauth_sdk_credentials.rb +5 -13
- data/lib/checkout_sdk/payments/base_payments_client.rb +5 -0
- data/lib/checkout_sdk/payments/billing_information.rb +14 -0
- data/lib/checkout_sdk/payments/hosted/hosted_payments_client.rb +25 -0
- data/lib/checkout_sdk/payments/hosted/hosted_payments_session.rb +87 -0
- data/lib/checkout_sdk/payments/links/payment_link.rb +84 -0
- data/lib/checkout_sdk/payments/links/payments_links_client.rb +25 -0
- data/lib/checkout_sdk/payments/payment_type.rb +0 -1
- data/lib/checkout_sdk/payments/payments.rb +12 -1
- data/lib/checkout_sdk/payments/payments_query_filter.rb +17 -0
- data/lib/checkout_sdk/payments/previous/source/payment_source.rb +1 -0
- data/lib/checkout_sdk/payments/sender/corporate_sender.rb +1 -1
- data/lib/checkout_sdk/payments/sender/government_sender.rb +1 -1
- data/lib/checkout_sdk/payments/sender/individual_sender.rb +1 -1
- data/lib/checkout_sdk/payments/source/card_source.rb +2 -2
- data/lib/checkout_sdk/payments/source/customer_source.rb +15 -0
- data/lib/checkout_sdk/payments/source/payment_source.rb +1 -0
- data/lib/checkout_sdk/payments/three_ds_request.rb +3 -0
- data/lib/checkout_sdk/previous/checkout_api.rb +8 -0
- data/lib/checkout_sdk/previous/checkout_previous_static_keys_sdk_builder.rb +2 -1
- data/lib/checkout_sdk/reports/reports.rb +4 -0
- data/lib/checkout_sdk/reports/reports_client.rb +26 -0
- data/lib/checkout_sdk/reports/reports_query.rb +23 -0
- data/lib/checkout_sdk/tokens/card_token_request.rb +2 -2
- data/lib/checkout_sdk/version.rb +1 -1
- data/lib/checkout_sdk/workflows/create_workflow.rb +20 -0
- data/lib/checkout_sdk/workflows/entity_workflow_condition.rb +15 -0
- data/lib/checkout_sdk/workflows/event_workflow_condition.rb +15 -0
- data/lib/checkout_sdk/workflows/patch_workflow.rb +14 -0
- data/lib/checkout_sdk/workflows/processing_channel_workflow_condition.rb +15 -0
- data/lib/checkout_sdk/workflows/reflow.rb +11 -0
- data/lib/checkout_sdk/workflows/reflow_by_events.rb +11 -0
- data/lib/checkout_sdk/workflows/reflow_by_subjects.rb +11 -0
- data/lib/checkout_sdk/workflows/webhook_signature.rb +14 -0
- data/lib/checkout_sdk/workflows/webhook_workflow_action.rb +21 -0
- data/lib/checkout_sdk/workflows/workflow_action.rb +19 -0
- data/lib/checkout_sdk/workflows/workflow_action_type.rb +9 -0
- data/lib/checkout_sdk/workflows/workflow_condition.rb +19 -0
- data/lib/checkout_sdk/workflows/workflow_condition_type.rb +11 -0
- data/lib/checkout_sdk/workflows/workflows.rb +18 -0
- data/lib/checkout_sdk/workflows/workflows_client.rb +115 -0
- data/lib/checkout_sdk.rb +3 -0
- metadata +58 -3
- data/lib/checkout_sdk/common/abstract_file_request.rb +0 -11
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute id
|
6
|
+
# @return [String]
|
7
|
+
# @!attribute first_name
|
8
|
+
# @return [String]
|
9
|
+
# @!attribute last_name
|
10
|
+
# @return [String]
|
11
|
+
# @!attribute address
|
12
|
+
# @return [CheckoutSdk::Common::Address]
|
13
|
+
# @!attribute identification
|
14
|
+
# @return [Identification]
|
15
|
+
# @!attribute phone
|
16
|
+
# @return [Phone]
|
17
|
+
# @!attribute date_of_birth
|
18
|
+
# @return [DateOfBirth]
|
19
|
+
# @!attribute place_of_birth
|
20
|
+
# @return [PlaceOfBirth]
|
21
|
+
# @!attribute roles
|
22
|
+
# @return [Array(String)]
|
23
|
+
class Representative
|
24
|
+
attr_accessor :id,
|
25
|
+
:first_name,
|
26
|
+
:last_name,
|
27
|
+
:address,
|
28
|
+
:identification,
|
29
|
+
:phone,
|
30
|
+
:date_of_birth,
|
31
|
+
:place_of_birth,
|
32
|
+
:roles
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute by_month_day
|
6
|
+
# @return [Array(Integer)]
|
7
|
+
class ScheduleFrequencyMonthly < ScheduleRequest
|
8
|
+
attr_accessor :by_month_day
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super ScheduleFrequencyType::MONTHLY
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute by_day
|
6
|
+
# @return [Array(String)]
|
7
|
+
class ScheduleFrequencyWeekly < ScheduleRequest
|
8
|
+
attr_accessor :by_day
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super ScheduleFrequencyType::WEEKLY
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute frequency
|
6
|
+
# @return [String] {ScheduleFrequencyType}
|
7
|
+
class ScheduleRequest
|
8
|
+
attr_reader :frequency
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
# @abstract
|
13
|
+
# @param [String] frequency {ScheduleFrequencyType}
|
14
|
+
def initialize(frequency)
|
15
|
+
@frequency = frequency
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute enabled
|
6
|
+
# @return [TrueClass, FalseClass]
|
7
|
+
# @!attribute threshold
|
8
|
+
# @return [TrueClass, FalseClass]
|
9
|
+
# @!attribute recurrence
|
10
|
+
# @return [ScheduleRequest]
|
11
|
+
class UpdateSchedule
|
12
|
+
attr_accessor :enabled,
|
13
|
+
:threshold,
|
14
|
+
:recurrence
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -2,12 +2,15 @@
|
|
2
2
|
|
3
3
|
module CheckoutSdk
|
4
4
|
class ApiClient
|
5
|
-
|
5
|
+
attr_accessor :client, :multipart_client
|
6
|
+
|
7
|
+
# @param [CheckoutConfiguration] configuration
|
6
8
|
# @param [String] uri
|
7
|
-
def initialize(
|
8
|
-
|
9
|
-
@client =
|
10
|
-
@multipart_client =
|
9
|
+
def initialize(configuration, uri)
|
10
|
+
@client = configuration.http_client.clone
|
11
|
+
@client.url_prefix = uri
|
12
|
+
@multipart_client = configuration.multipart_http_client.clone
|
13
|
+
@multipart_client.url_prefix = uri
|
11
14
|
end
|
12
15
|
|
13
16
|
# @param [String] path
|
@@ -51,19 +54,6 @@ module CheckoutSdk
|
|
51
54
|
|
52
55
|
private
|
53
56
|
|
54
|
-
def build_multipart_client(uri)
|
55
|
-
Faraday.new(uri) do |f|
|
56
|
-
f.request :multipart
|
57
|
-
f.response :raise_error
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def build_default_client(uri)
|
62
|
-
Faraday.new(uri) do |f|
|
63
|
-
f.response :raise_error
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
57
|
def invoke(method, path, authorization, body = nil, idempotency_key = nil, params: nil)
|
68
58
|
path = append_params(path, params) unless params.nil?
|
69
59
|
|
@@ -91,14 +81,13 @@ module CheckoutSdk
|
|
91
81
|
end
|
92
82
|
|
93
83
|
def append_params(path, input_params)
|
94
|
-
# TODO: refactor this into a utils method
|
95
84
|
hash = CheckoutSdk::JsonSerializer.to_custom_hash(input_params)
|
96
85
|
params = URI.encode_www_form(hash)
|
97
86
|
"#{path}?#{params}"
|
98
87
|
end
|
99
88
|
|
100
89
|
def build_multipart_request(file_request, file)
|
101
|
-
key = file_request.
|
90
|
+
key = file_request.class.name.start_with?(CheckoutSdk::Common::FileRequest.name) ? :file : :path
|
102
91
|
{
|
103
92
|
key => Faraday::Multipart::FilePart.new(
|
104
93
|
file,
|
@@ -128,6 +117,8 @@ module CheckoutSdk
|
|
128
117
|
end
|
129
118
|
|
130
119
|
def parse_response(response)
|
120
|
+
raise CheckoutApiException, response if response.status < 200 || response.status >= 300
|
121
|
+
|
131
122
|
metadata = CheckoutUtils.map_to_http_metadata(response)
|
132
123
|
body = (JSON.parse(response.body, object_class: OpenStruct) if !response.body.nil? && response.body != '')
|
133
124
|
body = OpenStruct.new if body.nil?
|
@@ -7,25 +7,40 @@ module CheckoutSdk
|
|
7
7
|
# @return [CheckoutSdk::Disputes::DisputesClient]
|
8
8
|
# @!attribute forex
|
9
9
|
# @return [CheckoutSdk::Forex::ForexClient]
|
10
|
+
# @!attribute hosted
|
11
|
+
# @return [CheckoutSdk::Payments::HostedPaymentsClient]
|
10
12
|
# @!attribute instruments
|
11
13
|
# @return [CheckoutSdk::Instruments::InstrumentsClient]
|
14
|
+
# @!attribute links
|
15
|
+
# @return [CheckoutSdk::Payments::PaymentsLinksClient]
|
12
16
|
# @!attribute payments
|
13
17
|
# @return [CheckoutSdk::Payments::PaymentsClient]
|
18
|
+
# @!attribute reports
|
19
|
+
# @return [CheckoutSdk::Reports::ReportsClient]
|
14
20
|
# @!attribute sessions
|
15
21
|
# @return [CheckoutSdk::Sessions::SessionsClient]
|
16
22
|
# @!attribute tokens
|
17
23
|
# @return [CheckoutSdk::Tokens::TokensClient]
|
18
24
|
# @!attribute ideal
|
19
25
|
# @return [CheckoutSdk::Apm::IdealClient]
|
26
|
+
# @!attribute accounts
|
27
|
+
# @return [CheckoutSdk::Accounts::AccountsClient]
|
28
|
+
# @!attribute workflows
|
29
|
+
# @return [CheckoutSdk::Workflows::WorkflowsClient]
|
20
30
|
class CheckoutApi
|
21
31
|
attr_reader :customers,
|
22
32
|
:disputes,
|
23
33
|
:forex,
|
34
|
+
:hosted,
|
24
35
|
:instruments,
|
36
|
+
:links,
|
25
37
|
:payments,
|
38
|
+
:reports,
|
26
39
|
:sessions,
|
27
40
|
:tokens,
|
28
|
-
:ideal
|
41
|
+
:ideal,
|
42
|
+
:accounts,
|
43
|
+
:workflows
|
29
44
|
|
30
45
|
# @param [CheckoutConfiguration] configuration
|
31
46
|
def initialize(configuration)
|
@@ -33,11 +48,16 @@ module CheckoutSdk
|
|
33
48
|
@customers = CheckoutSdk::Customers::CustomersClient.new api_client, configuration
|
34
49
|
@disputes = CheckoutSdk::Disputes::DisputesClient.new api_client, configuration
|
35
50
|
@forex = CheckoutSdk::Forex::ForexClient.new api_client, configuration
|
51
|
+
@hosted = CheckoutSdk::Payments::HostedPaymentsClient.new api_client, configuration
|
36
52
|
@instruments = CheckoutSdk::Instruments::InstrumentsClient.new api_client, configuration
|
53
|
+
@links = CheckoutSdk::Payments::PaymentsLinksClient.new api_client, configuration
|
37
54
|
@payments = CheckoutSdk::Payments::PaymentsClient.new api_client, configuration
|
55
|
+
@reports = CheckoutSdk::Reports::ReportsClient.new api_client, configuration
|
38
56
|
@sessions = CheckoutSdk::Sessions::SessionsClient.new api_client, configuration
|
39
57
|
@tokens = CheckoutSdk::Tokens::TokensClient.new api_client, configuration
|
40
58
|
@ideal = CheckoutSdk::Apm::IdealClient.new api_client, configuration
|
59
|
+
@workflows = CheckoutSdk::Workflows::WorkflowsClient.new api_client, configuration
|
60
|
+
@accounts = CheckoutSdk::Accounts::AccountsClient.new(api_client, files_client(configuration), configuration)
|
41
61
|
end
|
42
62
|
|
43
63
|
private
|
@@ -45,7 +65,13 @@ module CheckoutSdk
|
|
45
65
|
# @param [CheckoutConfiguration] configuration
|
46
66
|
# @return [ApiClient]
|
47
67
|
def base_api_client(configuration)
|
48
|
-
|
68
|
+
ApiClient.new(configuration, configuration.environment.base_uri)
|
69
|
+
end
|
70
|
+
|
71
|
+
# @param [CheckoutConfiguration] configuration
|
72
|
+
# @return [ApiClient]
|
73
|
+
def files_client(configuration)
|
74
|
+
ApiClient.new(configuration, configuration.environment.files_uri)
|
49
75
|
end
|
50
76
|
end
|
51
77
|
end
|
@@ -6,17 +6,19 @@ module CheckoutSdk
|
|
6
6
|
# @!attribute environment
|
7
7
|
# @return [Environment]
|
8
8
|
# @!attribute http_client
|
9
|
-
# @return [
|
9
|
+
# @return [Faraday::Connection]
|
10
10
|
class CheckoutConfiguration
|
11
|
-
attr_accessor :credentials, :environment, :http_client
|
11
|
+
attr_accessor :credentials, :environment, :http_client, :multipart_http_client
|
12
12
|
|
13
13
|
# @param [SdkCredentials] credentials
|
14
14
|
# @param [Environment] environment
|
15
|
-
# @param [
|
16
|
-
|
15
|
+
# @param [Faraday::Connection] http_client
|
16
|
+
# @param [Faraday::Connection] multipart_http_client
|
17
|
+
def initialize(credentials, environment, http_client, multipart_http_client)
|
17
18
|
@credentials = credentials
|
18
19
|
@environment = environment
|
19
20
|
@http_client = http_client
|
21
|
+
@multipart_http_client = multipart_http_client
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -40,11 +40,13 @@ module CheckoutSdk
|
|
40
40
|
|
41
41
|
# @return [CheckoutSdk::CheckoutApi]
|
42
42
|
def build
|
43
|
+
super
|
43
44
|
CheckoutSdk::CheckoutApi.new(
|
44
45
|
CheckoutConfiguration.new(
|
45
46
|
OAuthSdkCredentials.new(client_id, client_secret, scopes, http_client, environment, authorization_uri),
|
46
47
|
environment,
|
47
|
-
http_client
|
48
|
+
http_client,
|
49
|
+
multipart_http_client
|
48
50
|
)
|
49
51
|
)
|
50
52
|
end
|
@@ -20,5 +20,20 @@ module CheckoutSdk
|
|
20
20
|
end
|
21
21
|
metadata
|
22
22
|
end
|
23
|
+
|
24
|
+
# @return [Faraday::Connection]
|
25
|
+
def self.build_multipart_client
|
26
|
+
Faraday.new do |f|
|
27
|
+
f.request :multipart
|
28
|
+
f.response :raise_error
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Faraday::Connection]
|
33
|
+
def self.build_default_client
|
34
|
+
Faraday.new do |f|
|
35
|
+
f.response :raise_error
|
36
|
+
end
|
37
|
+
end
|
23
38
|
end
|
24
39
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'checkout_sdk/common/abstract_file_request'
|
4
3
|
require 'checkout_sdk/common/account_type'
|
5
4
|
require 'checkout_sdk/common/customer_request'
|
6
5
|
require 'checkout_sdk/common/amount_allocations'
|
@@ -22,3 +21,4 @@ require 'checkout_sdk/common/challenge_indicator'
|
|
22
21
|
require 'checkout_sdk/common/update_customer_request'
|
23
22
|
require 'checkout_sdk/common/marketplace_data'
|
24
23
|
require 'checkout_sdk/common/shipping_info'
|
24
|
+
require 'checkout_sdk/common/product'
|
@@ -4,8 +4,11 @@ module CheckoutSdk
|
|
4
4
|
module Common
|
5
5
|
# @!attribute purpose
|
6
6
|
# @return [FilePurpose]
|
7
|
-
|
8
|
-
|
7
|
+
# @!attribute file
|
8
|
+
# @return [String]
|
9
|
+
class FileRequest
|
10
|
+
attr_accessor :purpose,
|
11
|
+
:file
|
9
12
|
end
|
10
13
|
end
|
11
14
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Common
|
5
|
+
# @!attribute name
|
6
|
+
# @return [String]
|
7
|
+
# @!attribute quantity
|
8
|
+
# @return [Integer]
|
9
|
+
# @!attribute price
|
10
|
+
# @return [Integer]
|
11
|
+
class Product
|
12
|
+
attr_accessor :name,
|
13
|
+
:quantity,
|
14
|
+
:price
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -27,7 +27,7 @@ module CheckoutSdk
|
|
27
27
|
# @param [String] client_id
|
28
28
|
# @param [String] client_secret
|
29
29
|
# @param [Array(CheckoutSdk::OAuthScopes)] scopes
|
30
|
-
# @param [Faraday] http_client
|
30
|
+
# @param [Faraday::Connection] http_client
|
31
31
|
# @param [CheckoutSdk::Environment] environment
|
32
32
|
# @param [String, nil] auth_uri
|
33
33
|
def initialize(client_id, client_secret, scopes, http_client, environment, auth_uri = nil)
|
@@ -36,7 +36,8 @@ module CheckoutSdk
|
|
36
36
|
@client_secret = client_secret
|
37
37
|
@scopes = scopes
|
38
38
|
@authorization_uri = auth_uri.nil? ? environment.authorization_uri : auth_uri
|
39
|
-
@
|
39
|
+
@oauth_http_client = http_client.clone
|
40
|
+
@oauth_http_client.url_prefix = @authorization_uri
|
40
41
|
build_access_token
|
41
42
|
end
|
42
43
|
|
@@ -66,7 +67,7 @@ module CheckoutSdk
|
|
66
67
|
body = URI.encode_www_form data
|
67
68
|
|
68
69
|
begin
|
69
|
-
response = @
|
70
|
+
response = @oauth_http_client.run_request(:post, @authorization_uri, body, headers)
|
70
71
|
rescue Faraday::ClientError => e
|
71
72
|
raise CheckoutAuthorizationException, e.response
|
72
73
|
rescue Faraday::ConnectionFailed => e
|
@@ -85,19 +86,10 @@ module CheckoutSdk
|
|
85
86
|
|
86
87
|
private
|
87
88
|
|
88
|
-
# TODO: refactor this into a utils method
|
89
|
-
# @param [String] authorization_uri
|
90
|
-
# @return [Faraday::Connection]
|
91
|
-
def build_default_client(authorization_uri)
|
92
|
-
Faraday.new(authorization_uri) do |f|
|
93
|
-
f.response(:raise_error)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
89
|
# @param [String] client_id
|
98
90
|
# @param [String] client_secret
|
99
91
|
# @param [Environment] environment
|
100
|
-
# @param [String] authorization_uri
|
92
|
+
# @param [String, nil] authorization_uri
|
101
93
|
def validate_arguments(client_id, client_secret, environment, authorization_uri)
|
102
94
|
if client_id.nil? || client_secret.nil?
|
103
95
|
raise CheckoutArgumentException, 'Invalid OAuth "client_id" or "client_secret"'
|
@@ -5,6 +5,11 @@ module CheckoutSdk
|
|
5
5
|
class BasePaymentsClient < Client
|
6
6
|
PAYMENTS_PATH = 'payments'
|
7
7
|
|
8
|
+
# @param [PaymentsQueryFilter] query_filter
|
9
|
+
def get_payments_list(query_filter)
|
10
|
+
api_client.invoke_get(PAYMENTS_PATH, sdk_authorization, query_filter)
|
11
|
+
end
|
12
|
+
|
8
13
|
# @param [String] payment_id
|
9
14
|
def get_payment_details(payment_id)
|
10
15
|
api_client.invoke_get(build_path(PAYMENTS_PATH, payment_id),
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Payments
|
5
|
+
# @!attribute address
|
6
|
+
# @return [CheckoutSdk::Common::Address]
|
7
|
+
# @!attribute phone
|
8
|
+
# @return [CheckoutSdk::Common::Phone]
|
9
|
+
class BillingInformation
|
10
|
+
attr_accessor :address,
|
11
|
+
:phone
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Payments
|
5
|
+
class HostedPaymentsClient < Client
|
6
|
+
HOSTED_PAYMENTS = 'hosted-payments'
|
7
|
+
|
8
|
+
# @param [ApiClient] api_client
|
9
|
+
# @param [CheckoutConfiguration] configuration
|
10
|
+
def initialize(api_client, configuration)
|
11
|
+
super api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param [HostedPaymentsSession] hosted_payments_session
|
15
|
+
def create_hosted_payments_page_session(hosted_payments_session)
|
16
|
+
api_client.invoke_post(HOSTED_PAYMENTS, sdk_authorization, hosted_payments_session)
|
17
|
+
end
|
18
|
+
|
19
|
+
# @param [String] hosted_payment_id
|
20
|
+
def get_hosted_payments_page_details(hosted_payment_id)
|
21
|
+
api_client.invoke_get(build_path(HOSTED_PAYMENTS, hosted_payment_id), sdk_authorization)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Payments
|
5
|
+
# @!attribute amount
|
6
|
+
# @return [Integer]
|
7
|
+
# @!attribute currency
|
8
|
+
# @return [String] {CheckoutSdk::Common::Currency}
|
9
|
+
# @!attribute payment_type
|
10
|
+
# @return [String] {PaymentType}
|
11
|
+
# @!attribute payment_ip
|
12
|
+
# @return [String]
|
13
|
+
# @!attribute billing_descriptor
|
14
|
+
# @return [BillingDescriptor]
|
15
|
+
# @!attribute reference
|
16
|
+
# @return [String]
|
17
|
+
# @!attribute description
|
18
|
+
# @return [String]
|
19
|
+
# @!attribute customer
|
20
|
+
# @return [CheckoutSdk::Common::CustomerRequest]
|
21
|
+
# @!attribute shipping
|
22
|
+
# @return [ShippingDetails]
|
23
|
+
# @!attribute billing
|
24
|
+
# @return [BillingInformation]
|
25
|
+
# @!attribute recipient
|
26
|
+
# @return [PaymentRecipient]
|
27
|
+
# @!attribute processing
|
28
|
+
# @return [ProcessingSettings]
|
29
|
+
# @!attribute allow_payment_methods
|
30
|
+
# @return [Array(CheckoutSdk::Common::PaymentSourceType)]
|
31
|
+
# @!attribute products
|
32
|
+
# @return [Array(CheckoutSdk::Common::Product)]
|
33
|
+
# @!attribute risk
|
34
|
+
# @return [RiskRequest]
|
35
|
+
# @!attribute success_url
|
36
|
+
# @return [String]
|
37
|
+
# @!attribute cancel_url
|
38
|
+
# @return [String]
|
39
|
+
# @!attribute failure_url
|
40
|
+
# @return [String]
|
41
|
+
# @!attribute metadata
|
42
|
+
# @return [Hash(String=>Object)]
|
43
|
+
# @!attribute locale
|
44
|
+
# @return [String]
|
45
|
+
# @!attribute three_ds
|
46
|
+
# @return [ThreeDSRequest]
|
47
|
+
# @!attribute capture
|
48
|
+
# @return [TrueClass, FalseClass]
|
49
|
+
# @!attribute capture_on
|
50
|
+
# @return [Time]
|
51
|
+
# @!attribute processing_channel_id
|
52
|
+
# @return [String] - Not available on Previous.
|
53
|
+
# @!attribute marketplace
|
54
|
+
# @deprecated Please use {#amount_allocations} instead
|
55
|
+
# @return [CheckoutSdk::Common::MarketplaceData] - Not available on Previous.
|
56
|
+
# @!attribute amount_allocations
|
57
|
+
# @return [Array(CheckoutSdk::Common::AmountAllocations)] - Not available on Previous.
|
58
|
+
class HostedPaymentsSession
|
59
|
+
attr_accessor :amount,
|
60
|
+
:currency,
|
61
|
+
:payment_type,
|
62
|
+
:payment_ip,
|
63
|
+
:billing_descriptor,
|
64
|
+
:reference,
|
65
|
+
:description,
|
66
|
+
:customer,
|
67
|
+
:shipping,
|
68
|
+
:billing,
|
69
|
+
:recipient,
|
70
|
+
:processing,
|
71
|
+
:allow_payment_methods,
|
72
|
+
:products,
|
73
|
+
:risk,
|
74
|
+
:success_url,
|
75
|
+
:cancel_url,
|
76
|
+
:failure_url,
|
77
|
+
:metadata,
|
78
|
+
:locale,
|
79
|
+
:three_ds,
|
80
|
+
:capture,
|
81
|
+
:capture_on,
|
82
|
+
:processing_channel_id,
|
83
|
+
:marketplace,
|
84
|
+
:amount_allocations
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|