pcp-server-ruby-sdk 1.0.0 → 1.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/README.md +9 -3
- data/api-definition.yaml +4803 -0
- data/lib/PCP-server-Ruby-SDK/endpoints/checkout_api_client.rb +24 -0
- data/lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb +47 -0
- data/lib/PCP-server-Ruby-SDK/endpoints/payment_information_api_client.rb +27 -2
- data/lib/PCP-server-Ruby-SDK/models/action_type.rb +34 -0
- data/lib/PCP-server-Ruby-SDK/models/api_error.rb +1 -1
- data/lib/PCP-server-Ruby-SDK/models/avs_result.rb +52 -0
- data/lib/PCP-server-Ruby-SDK/models/bank_account_information.rb +17 -5
- data/lib/PCP-server-Ruby-SDK/models/bank_payout_method_specific_input.rb +198 -0
- data/lib/PCP-server-Ruby-SDK/models/business_relation.rb +30 -0
- data/lib/PCP-server-Ruby-SDK/models/capture_output.rb +45 -41
- data/lib/PCP-server-Ruby-SDK/models/card_fraud_results.rb +3 -2
- data/lib/PCP-server-Ruby-SDK/models/card_recurrence_details.rb +5 -2
- data/lib/PCP-server-Ruby-SDK/models/customer.rb +21 -6
- data/lib/PCP-server-Ruby-SDK/models/customer_account.rb +51 -0
- data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_output.rb +43 -40
- data/lib/PCP-server-Ruby-SDK/models/merchant_action.rb +3 -2
- data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_input.rb +16 -33
- data/lib/PCP-server-Ruby-SDK/models/mobile_payment_three_dsecure.rb +185 -0
- data/lib/PCP-server-Ruby-SDK/models/order_line_details_input.rb +12 -6
- data/lib/PCP-server-Ruby-SDK/models/{payment_product320_specific_input.rb → pause_payment_request.rb} +13 -31
- data/lib/PCP-server-Ruby-SDK/models/pause_payment_response.rb +192 -0
- data/lib/PCP-server-Ruby-SDK/models/payee.rb +212 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_event.rb +14 -14
- data/lib/PCP-server-Ruby-SDK/models/payment_execution.rb +39 -5
- data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_request.rb +212 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_response.rb +202 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_information_response.rb +40 -25
- data/lib/PCP-server-Ruby-SDK/models/payment_instructions.rb +222 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_product302_specific_input.rb +232 -0
- data/lib/PCP-server-Ruby-SDK/models/payout_output.rb +28 -24
- data/lib/PCP-server-Ruby-SDK/models/payout_response.rb +6 -25
- data/lib/PCP-server-Ruby-SDK/models/recurring_payment_sequence_indicator.rb +30 -0
- data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input.rb +14 -4
- data/lib/PCP-server-Ruby-SDK/models/refresh_payment_request.rb +192 -0
- data/lib/PCP-server-Ruby-SDK/models/refresh_type.rb +30 -0
- data/lib/PCP-server-Ruby-SDK/models/sepa_transfer_payment_product_772_specific_input.rb +192 -0
- data/lib/PCP-server-Ruby-SDK/models/status_value.rb +12 -10
- data/lib/PCP-server-Ruby-SDK/queries/get_checkouts_query.rb +3 -1
- data/lib/PCP-server-Ruby-SDK/transformer/apple_pay_transformer.rb +2 -2
- data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
- data/lib/PCP-server-Ruby-SDK.rb +24 -2
- data/package-lock.json +174 -245
- data/package.json +1 -1
- data/scripts.sh +7 -14
- data/spec/endpoints/checkout_api_client_spec.rb +51 -0
- data/spec/endpoints/payment_execution_api_client_spec.rb +102 -0
- data/spec/endpoints/payment_information_api_client_spec.rb +52 -0
- data/spec/transformer/apple_pay_transformer_spec.rb +1 -1
- data/spec/utils/server_meta_info_spec.rb +2 -2
- metadata +24 -7
@@ -124,6 +124,30 @@ module PCPServerSDK
|
|
124
124
|
make_api_call(url.to_s, request_init)
|
125
125
|
nil
|
126
126
|
end
|
127
|
+
|
128
|
+
# Complete a checkout
|
129
|
+
# @param merchant_id [String] The merchant identifier
|
130
|
+
# @param commerce_case_id [String] The commerce case identifier
|
131
|
+
# @param checkout_id [String] The checkout identifier
|
132
|
+
# @param payload [PCPServerSDK::Models::CompleteOrderRequest] The complete order request
|
133
|
+
# @return [PCPServerSDK::Models::CompletePaymentResponse] The complete payment response
|
134
|
+
def complete_checkout_request(merchant_id, commerce_case_id, checkout_id, payload)
|
135
|
+
raise TypeError, MERCHANT_ID_REQUIRED_ERROR if merchant_id.nil? || merchant_id.empty?
|
136
|
+
raise TypeError, COMMERCE_CASE_ID_REQUIRED_ERROR if commerce_case_id.nil? || commerce_case_id.empty?
|
137
|
+
raise TypeError, CHECKOUT_ID_REQUIRED_ERROR if checkout_id.nil? || checkout_id.empty?
|
138
|
+
raise TypeError, PAYLOAD_REQUIRED_ERROR if payload.nil?
|
139
|
+
|
140
|
+
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/complete-order")
|
141
|
+
|
142
|
+
request_init = {
|
143
|
+
method: 'POST',
|
144
|
+
headers: { 'Content-Type' => 'application/json' },
|
145
|
+
body: JSON.generate(payload)
|
146
|
+
}
|
147
|
+
|
148
|
+
response = make_api_call(url.to_s, request_init)
|
149
|
+
deserialize_json(response, PCPServerSDK::Models::CompletePaymentResponse)
|
150
|
+
end
|
127
151
|
end
|
128
152
|
end
|
129
153
|
end
|
@@ -130,6 +130,53 @@ module PCPServerSDK
|
|
130
130
|
deserialize_json(response, PCPServerSDK::Models::CompletePaymentResponse)
|
131
131
|
end
|
132
132
|
|
133
|
+
# Pause a payment
|
134
|
+
# @param merchant_id [String] The merchant identifier
|
135
|
+
# @param commerce_case_id [String] The commerce case identifier
|
136
|
+
# @param checkout_id [String] The checkout identifier
|
137
|
+
# @param payment_execution_id [String] The payment execution identifier
|
138
|
+
# @param payload [PCPServerSDK::Models::PausePaymentRequest] The pause payment request
|
139
|
+
# @return [PCPServerSDK::Models::PausePaymentResponse] The pause payment response
|
140
|
+
def pause_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload)
|
141
|
+
validate_ids(merchant_id, commerce_case_id, checkout_id)
|
142
|
+
raise TypeError, PAYMENT_EXECUTION_ID_REQUIRED_ERROR if payment_execution_id.nil? || payment_execution_id.empty?
|
143
|
+
|
144
|
+
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions/#{payment_execution_id}/pause")
|
145
|
+
|
146
|
+
request_init = {
|
147
|
+
method: 'POST',
|
148
|
+
headers: { 'Content-Type' => 'application/json' },
|
149
|
+
body: JSON.generate(payload)
|
150
|
+
}
|
151
|
+
|
152
|
+
response = make_api_call(url.to_s, request_init)
|
153
|
+
deserialize_json(response, PCPServerSDK::Models::PausePaymentResponse)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Refresh a payment
|
157
|
+
# @param merchant_id [String] The merchant identifier
|
158
|
+
# @param commerce_case_id [String] The commerce case identifier
|
159
|
+
# @param checkout_id [String] The checkout identifier
|
160
|
+
# @param payment_execution_id [String] The payment execution identifier
|
161
|
+
# @param payload [PCPServerSDK::Models::RefreshPaymentRequest] The refresh payment request
|
162
|
+
# @return [PCPServerSDK::Models::PaymentExecution] The refreshed payment execution
|
163
|
+
def refresh_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload)
|
164
|
+
validate_ids(merchant_id, commerce_case_id, checkout_id)
|
165
|
+
raise TypeError, PAYMENT_EXECUTION_ID_REQUIRED_ERROR if payment_execution_id.nil? || payment_execution_id.empty?
|
166
|
+
|
167
|
+
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions/#{payment_execution_id}/refresh")
|
168
|
+
|
169
|
+
request_init = {
|
170
|
+
method: 'POST',
|
171
|
+
headers: { 'Content-Type' => 'application/json' },
|
172
|
+
body: JSON.generate(payload)
|
173
|
+
}
|
174
|
+
|
175
|
+
response = make_api_call(url.to_s, request_init)
|
176
|
+
deserialize_json(response, PCPServerSDK::Models::PaymentExecution)
|
177
|
+
end
|
178
|
+
|
179
|
+
|
133
180
|
private
|
134
181
|
|
135
182
|
def validate_ids(merchant_id, commerce_case_id, checkout_id)
|
@@ -24,7 +24,7 @@ module PCPServerSDK
|
|
24
24
|
def create_payment_information(merchant_id, commerce_case_id, checkout_id, payload)
|
25
25
|
validate_ids(merchant_id, commerce_case_id, checkout_id)
|
26
26
|
|
27
|
-
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-
|
27
|
+
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-information")
|
28
28
|
|
29
29
|
request_init = {
|
30
30
|
method: 'POST',
|
@@ -46,7 +46,7 @@ module PCPServerSDK
|
|
46
46
|
validate_ids(merchant_id, commerce_case_id, checkout_id)
|
47
47
|
raise TypeError, PAYMENT_INFORMATION_ID_REQUIRED_ERROR if payment_information_id.nil? || payment_information_id.empty?
|
48
48
|
|
49
|
-
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-
|
49
|
+
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-information/#{payment_information_id}")
|
50
50
|
|
51
51
|
request_init = {
|
52
52
|
method: 'GET',
|
@@ -57,6 +57,31 @@ module PCPServerSDK
|
|
57
57
|
deserialize_json(response, PCPServerSDK::Models::PaymentInformationResponse)
|
58
58
|
end
|
59
59
|
|
60
|
+
# Refund a payment information
|
61
|
+
# @param merchant_id [String] The merchant identifier
|
62
|
+
# @param commerce_case_id [String] The commerce case identifier
|
63
|
+
# @param checkout_id [String] The checkout identifier
|
64
|
+
# @param payment_information_id [String] The payment information identifier
|
65
|
+
# @param payload [PCPServerSDK::Models::PaymentInformationRefundRequest] The refund request
|
66
|
+
# @return [PCPServerSDK::Models::PaymentInformationRefundResponse] The refund response
|
67
|
+
def refund_payment_information(merchant_id, commerce_case_id, checkout_id, payment_information_id, payload)
|
68
|
+
validate_ids(merchant_id, commerce_case_id, checkout_id)
|
69
|
+
raise TypeError, PAYMENT_INFORMATION_ID_REQUIRED_ERROR if payment_information_id.nil? || payment_information_id.empty?
|
70
|
+
raise TypeError, PAYLOAD_REQUIRED_ERROR if payload.nil?
|
71
|
+
|
72
|
+
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-information/#{payment_information_id}/refund")
|
73
|
+
|
74
|
+
request_init = {
|
75
|
+
method: 'POST',
|
76
|
+
headers: { 'Content-Type' => 'application/json' },
|
77
|
+
body: JSON.generate(payload)
|
78
|
+
}
|
79
|
+
|
80
|
+
response = make_api_call(url.to_s, request_init)
|
81
|
+
deserialize_json(response, PCPServerSDK::Models::PaymentInformationRefundResponse)
|
82
|
+
end
|
83
|
+
|
84
|
+
|
60
85
|
private
|
61
86
|
|
62
87
|
def validate_ids(merchant_id, commerce_case_id, checkout_id)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module PCPServerSDK
|
5
|
+
module Models
|
6
|
+
class ActionType
|
7
|
+
REDIRECT = "REDIRECT".freeze # The customer needs to be redirected using the details found in redirectData
|
8
|
+
SHOW_FORM = "SHOW_FORM".freeze # The customer needs to be shown a form with the fields found in formFields
|
9
|
+
SHOW_INSTRUCTIONS = "SHOW_INSTRUCTIONS".freeze # The customer needs to be shown payment instruction using the details found in showData
|
10
|
+
SHOW_TRANSACTION_RESULTS = "SHOW_TRANSACTION_RESULTS".freeze # The customer needs to be shown the transaction results using the details found in showData
|
11
|
+
MOBILE_THREEDS_CHALLENGE = "MOBILE_THREEDS_CHALLENGE".freeze # The customer needs to complete a challenge as part of the 3D Secure authentication inside your mobile app
|
12
|
+
CALL_THIRD_PARTY = "CALL_THIRD_PARTY".freeze # The merchant needs to call a third party using the data found in thirdPartyData
|
13
|
+
|
14
|
+
def self.all_vars
|
15
|
+
@all_vars ||= [REDIRECT, SHOW_FORM, SHOW_INSTRUCTIONS, SHOW_TRANSACTION_RESULTS, MOBILE_THREEDS_CHALLENGE, CALL_THIRD_PARTY].freeze
|
16
|
+
end
|
17
|
+
|
18
|
+
# Builds the enum from string
|
19
|
+
# @param [String] The enum value in the form of the string
|
20
|
+
# @return [String] The enum value
|
21
|
+
def self.build_from_hash(value)
|
22
|
+
new.build_from_hash(value)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Builds the enum from string
|
26
|
+
# @param [String] The enum value in the form of the string
|
27
|
+
# @return [String] The enum value
|
28
|
+
def build_from_hash(value)
|
29
|
+
return value if ActionType.all_vars.include?(value)
|
30
|
+
raise "Invalid ENUM value #{value} for class #ActionType"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -8,7 +8,7 @@ module PCPServerSDK
|
|
8
8
|
# Error code
|
9
9
|
attr_accessor :error_code
|
10
10
|
|
11
|
-
# Category the error belongs to. The category should give an indication of the type of error you are dealing with.
|
11
|
+
# Category the error belongs to. The category should give an indication of the type of error you are dealing with. Do not expect a finite set of possible categories, as they are subject to change. Common values are: * DIRECT_PLATFORM_ERROR - indicating that a functional error has occurred in the platform. * PAYMENT_PLATFORM_ERROR - indicating that a functional error has occurred in the payment platform. * IO_ERROR - indicating that a technical error has occurred within the payment platform or between the payment platform and third party systems. * COMMERCE_PLATFORM_ERROR - indicating an error originating from the Commerce Platform. * COMMERCE_PORTAL_BACKEND_ERROR - indicating an error originating from the Commerce Portal Backend.
|
12
12
|
attr_accessor :category
|
13
13
|
|
14
14
|
# HTTP status code for this error that can be used to determine the type of error
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module PCPServerSDK
|
5
|
+
module Models
|
6
|
+
class AvsResult
|
7
|
+
A = "A".freeze # Address (Street) matches, Zip does not
|
8
|
+
B = "B".freeze # Street address match for international transactions—Postal code not verified due to incompatible formats
|
9
|
+
C = "C".freeze # Street address and postal code not verified for international transaction due to incompatible formats
|
10
|
+
D = "D".freeze # Street address and postal code match for international transaction, cardholder name is incorrect
|
11
|
+
E = "E".freeze # AVS error
|
12
|
+
F = "F".freeze # Address does match and five digit ZIP code does match (UK only)
|
13
|
+
G = "G".freeze # Address information is unavailable; international transaction; non-AVS participant
|
14
|
+
H = "H".freeze # Billing address and postal code match, cardholder name is incorrect (Amex)
|
15
|
+
I = "I".freeze # Address information not verified for international transaction
|
16
|
+
K = "K".freeze # Cardholder name matches (Amex)
|
17
|
+
L = "L".freeze # Cardholder name and postal code match (Amex)
|
18
|
+
M = "M".freeze # Cardholder name, street address, and postal code match for international transaction
|
19
|
+
N = "N".freeze # No Match on Address (Street) or Zip
|
20
|
+
O = "O".freeze # Cardholder name and address match (Amex)
|
21
|
+
P = "P".freeze # Postal codes match for international transaction—Street address not verified due to incompatible formats
|
22
|
+
Q = "Q".freeze # Billing address matches, cardholder is incorrect (Amex)
|
23
|
+
R = "R".freeze # Retry, System unavailable or Timed out
|
24
|
+
S = "S".freeze # Service not supported by issuer
|
25
|
+
U = "U".freeze # Address information is unavailable
|
26
|
+
W = "W".freeze # 9 digit Zip matches, Address (Street) does not
|
27
|
+
X = "X".freeze # Exact AVS Match
|
28
|
+
Y = "Y".freeze # Address (Street) and 5 digit Zip match
|
29
|
+
Z = "Z".freeze # 5 digit Zip matches, Address (Street) does not
|
30
|
+
ZERO = "0".freeze # No service available
|
31
|
+
|
32
|
+
def self.all_vars
|
33
|
+
@all_vars ||= [A, B, C, D, E, F, G, H, I, K, L, M, N, O, P, Q, R, S, U, W, X, Y, Z, ZERO].freeze
|
34
|
+
end
|
35
|
+
|
36
|
+
# Builds the enum from string
|
37
|
+
# @param [String] The enum value in the form of the string
|
38
|
+
# @return [String] The enum value
|
39
|
+
def self.build_from_hash(value)
|
40
|
+
new.build_from_hash(value)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Builds the enum from string
|
44
|
+
# @param [String] The enum value in the form of the string
|
45
|
+
# @return [String] The enum value
|
46
|
+
def build_from_hash(value)
|
47
|
+
return value if AvsResult.all_vars.include?(value)
|
48
|
+
raise "Invalid ENUM value #{value} for class #AvsResult"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
1
|
require 'date'
|
3
2
|
require 'time'
|
3
|
+
|
4
4
|
module PCPServerSDK
|
5
5
|
module Models
|
6
6
|
# Object containing information about the end customer's bank account.
|
@@ -11,11 +11,15 @@ module PCPServerSDK
|
|
11
11
|
# Account holder of the bank account with the given IBAN. Does not necessarily have to be the end customer (e.g. joint accounts).
|
12
12
|
attr_accessor :account_holder
|
13
13
|
|
14
|
+
# BIC (Bank Identification Code)
|
15
|
+
attr_accessor :bic
|
16
|
+
|
14
17
|
# Attribute mapping from ruby-style variable name to JSON key.
|
15
18
|
def self.attribute_map
|
16
19
|
{
|
17
20
|
:'iban' => :'iban',
|
18
|
-
:'account_holder' => :'accountHolder'
|
21
|
+
:'account_holder' => :'accountHolder',
|
22
|
+
:'bic' => :'bic'
|
19
23
|
}
|
20
24
|
end
|
21
25
|
|
@@ -28,7 +32,8 @@ module PCPServerSDK
|
|
28
32
|
def self.openapi_types
|
29
33
|
{
|
30
34
|
:'iban' => :'String',
|
31
|
-
:'account_holder' => :'String'
|
35
|
+
:'account_holder' => :'String',
|
36
|
+
:'bic' => :'String'
|
32
37
|
}
|
33
38
|
end
|
34
39
|
|
@@ -64,6 +69,12 @@ module PCPServerSDK
|
|
64
69
|
else
|
65
70
|
self.account_holder = nil
|
66
71
|
end
|
72
|
+
|
73
|
+
if attributes.key?(:'bic')
|
74
|
+
self.bic = attributes[:'bic']
|
75
|
+
else
|
76
|
+
self.bic = nil
|
77
|
+
end
|
67
78
|
end
|
68
79
|
|
69
80
|
# Checks equality by comparing each attribute.
|
@@ -72,7 +83,8 @@ module PCPServerSDK
|
|
72
83
|
return true if self.equal?(o)
|
73
84
|
self.class == o.class &&
|
74
85
|
iban == o.iban &&
|
75
|
-
account_holder == o.account_holder
|
86
|
+
account_holder == o.account_holder &&
|
87
|
+
bic == o.bic
|
76
88
|
end
|
77
89
|
|
78
90
|
# @see the `==` method
|
@@ -84,7 +96,7 @@ module PCPServerSDK
|
|
84
96
|
# Calculates hash code according to all attributes.
|
85
97
|
# @return [Integer] Hash code
|
86
98
|
def hash
|
87
|
-
[iban, account_holder].hash
|
99
|
+
[iban, account_holder, bic].hash
|
88
100
|
end
|
89
101
|
|
90
102
|
# Builds the object from hash
|
@@ -0,0 +1,198 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module PCPServerSDK
|
5
|
+
module Models
|
6
|
+
# Object containing the specific input details for SEPA transfers.
|
7
|
+
class BankPayoutMethodSpecificInput
|
8
|
+
# Payment product identifier - please check product documentation for a full overview of possible values.
|
9
|
+
attr_accessor :payment_product_id
|
10
|
+
|
11
|
+
# SEPA Transfer Payment Product 772 Specific Input
|
12
|
+
attr_accessor :payment_product772_specific_input
|
13
|
+
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
15
|
+
def self.attribute_map
|
16
|
+
{
|
17
|
+
:'payment_product_id' => :'paymentProductId',
|
18
|
+
:'payment_product772_specific_input' => :'paymentProduct772SpecificInput'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns all the JSON keys this model knows about.
|
23
|
+
def self.acceptable_attributes
|
24
|
+
attribute_map.values
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.openapi_types
|
29
|
+
{
|
30
|
+
:'payment_product_id' => :'Integer',
|
31
|
+
:'payment_product772_specific_input' => :'SepaTransferPaymentProduct772SpecificInput'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# List of attributes with nullable: true.
|
36
|
+
def self.openapi_nullable
|
37
|
+
Set.new([])
|
38
|
+
end
|
39
|
+
|
40
|
+
# Initializes the object.
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash.
|
42
|
+
def initialize(attributes = {})
|
43
|
+
if (!attributes.is_a?(Hash))
|
44
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BankPayoutMethodSpecificInput` initialize method"
|
45
|
+
end
|
46
|
+
|
47
|
+
# Check to see if the attribute exists and convert string to symbol for hash key.
|
48
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
49
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
50
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BankPayoutMethodSpecificInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
51
|
+
end
|
52
|
+
h[k.to_sym] = v
|
53
|
+
}
|
54
|
+
|
55
|
+
if attributes.key?(:'payment_product_id')
|
56
|
+
self.payment_product_id = attributes[:'payment_product_id']
|
57
|
+
else
|
58
|
+
self.payment_product_id = nil
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.key?(:'payment_product772_specific_input')
|
62
|
+
self.payment_product772_specific_input = attributes[:'payment_product772_specific_input']
|
63
|
+
else
|
64
|
+
self.payment_product772_specific_input = nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Checks equality by comparing each attribute.
|
69
|
+
# @param [Object] Object to be compared.
|
70
|
+
def ==(o)
|
71
|
+
return true if self.equal?(o)
|
72
|
+
self.class == o.class &&
|
73
|
+
payment_product_id == o.payment_product_id &&
|
74
|
+
payment_product772_specific_input == o.payment_product772_specific_input
|
75
|
+
end
|
76
|
+
|
77
|
+
# @see the `==` method.
|
78
|
+
# @param [Object] Object to be compared.
|
79
|
+
def eql?(o)
|
80
|
+
self == o
|
81
|
+
end
|
82
|
+
|
83
|
+
# Calculates hash code according to all attributes.
|
84
|
+
# @return [Integer] Hash code.
|
85
|
+
def hash
|
86
|
+
[payment_product_id, payment_product772_specific_input].hash
|
87
|
+
end
|
88
|
+
|
89
|
+
# Builds the object from hash.
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash.
|
91
|
+
# @return [Object] Returns the model itself.
|
92
|
+
def self.build_from_hash(attributes)
|
93
|
+
return nil unless attributes.is_a?(Hash)
|
94
|
+
attributes = attributes.transform_keys(&:to_sym)
|
95
|
+
transformed_hash = {}
|
96
|
+
openapi_types.each_pair do |key, type|
|
97
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
98
|
+
transformed_hash["#{key}"] = nil
|
99
|
+
elsif type =~ /\AArray<(.*)>/i
|
100
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
101
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
102
|
+
end
|
103
|
+
elsif !attributes[attribute_map[key]].nil?
|
104
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
105
|
+
end
|
106
|
+
end
|
107
|
+
new(transformed_hash)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Deserializes the data based on type.
|
111
|
+
# @param string type Data type.
|
112
|
+
# @param string value Value to be deserialized.
|
113
|
+
# @return [Object] Deserialized data.
|
114
|
+
def self._deserialize(type, value)
|
115
|
+
case type.to_sym
|
116
|
+
when :Time
|
117
|
+
Time.parse(value)
|
118
|
+
when :Date
|
119
|
+
Date.parse(value)
|
120
|
+
when :String
|
121
|
+
value.to_s
|
122
|
+
when :Integer
|
123
|
+
value.to_i
|
124
|
+
when :Float
|
125
|
+
value.to_f
|
126
|
+
when :Boolean
|
127
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
128
|
+
true
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
when :Object
|
133
|
+
value
|
134
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
135
|
+
inner_type = Regexp.last_match[:inner_type]
|
136
|
+
value.map { |v| _deserialize(inner_type, v) }
|
137
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
138
|
+
k_type = Regexp.last_match[:k_type]
|
139
|
+
v_type = Regexp.last_match[:v_type]
|
140
|
+
{}.tap do |hash|
|
141
|
+
value.each do |k, v|
|
142
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
else # model
|
146
|
+
klass = PCPServerSDK::Models.const_get(type)
|
147
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns the string representation of the object.
|
152
|
+
# @return [String] String presentation of the object.
|
153
|
+
def to_s
|
154
|
+
to_hash.to_s
|
155
|
+
end
|
156
|
+
|
157
|
+
# to_body is an alias to to_hash (backward compatibility).
|
158
|
+
# @return [Hash] Returns the object in the form of hash.
|
159
|
+
def to_body
|
160
|
+
to_hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the object in the form of hash.
|
164
|
+
# @return [Hash] Returns the object in the form of hash.
|
165
|
+
def to_hash
|
166
|
+
hash = {}
|
167
|
+
self.class.attribute_map.each_pair do |attr, param|
|
168
|
+
value = self.send(attr)
|
169
|
+
if value.nil?
|
170
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
171
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
172
|
+
end
|
173
|
+
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash.
|
180
|
+
# For object, use to_hash. Otherwise, just return the value.
|
181
|
+
# @param [Object] value Any valid value.
|
182
|
+
# @return [Hash] Returns the value in the form of hash.
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map { |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module PCPServerSDK
|
5
|
+
module Models
|
6
|
+
class BusinessRelation
|
7
|
+
B2C = "B2C".freeze # Indicates business to consumer
|
8
|
+
B2B = "B2B".freeze # Indicates business to business
|
9
|
+
|
10
|
+
def self.all_vars
|
11
|
+
@all_vars ||= [B2C, B2B].freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
# Builds the enum from string
|
15
|
+
# @param [String] The enum value in the form of the string
|
16
|
+
# @return [String] The enum value
|
17
|
+
def self.build_from_hash(value)
|
18
|
+
new.build_from_hash(value)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Builds the enum from string
|
22
|
+
# @param [String] The enum value in the form of the string
|
23
|
+
# @return [String] The enum value
|
24
|
+
def build_from_hash(value)
|
25
|
+
return value if BusinessRelation.all_vars.include?(value)
|
26
|
+
raise "Invalid ENUM value #{value} for class #BusinessRelation"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|