pcp-server-ruby-sdk 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/api-definition.yaml +4737 -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/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/capture_output.rb +45 -41
- data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_output.rb +43 -40
- 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/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 +196 -243
- 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 +19 -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)
|
@@ -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
|
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
1
|
require 'date'
|
3
2
|
require 'time'
|
3
|
+
|
4
4
|
module PCPServerSDK
|
5
5
|
module Models
|
6
|
-
# Object containing Capture details.
|
6
|
+
# Object containing Capture details.
|
7
7
|
class CaptureOutput
|
8
8
|
attr_accessor :amount_of_money
|
9
9
|
|
@@ -15,17 +15,20 @@ module PCPServerSDK
|
|
15
15
|
# Payment method identifier used by our payment engine.
|
16
16
|
attr_accessor :payment_method
|
17
17
|
|
18
|
+
attr_accessor :payment_instructions
|
19
|
+
|
18
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|
19
21
|
def self.attribute_map
|
20
22
|
{
|
21
23
|
:'amount_of_money' => :'amountOfMoney',
|
22
24
|
:'merchant_parameters' => :'merchantParameters',
|
23
25
|
:'references' => :'references',
|
24
|
-
:'payment_method' => :'paymentMethod'
|
26
|
+
:'payment_method' => :'paymentMethod',
|
27
|
+
:'payment_instructions' => :'paymentInstructions'
|
25
28
|
}
|
26
29
|
end
|
27
30
|
|
28
|
-
# Returns all the JSON keys this model knows about
|
31
|
+
# Returns all the JSON keys this model knows about.
|
29
32
|
def self.acceptable_attributes
|
30
33
|
attribute_map.values
|
31
34
|
end
|
@@ -36,24 +39,24 @@ module PCPServerSDK
|
|
36
39
|
:'amount_of_money' => :'AmountOfMoney',
|
37
40
|
:'merchant_parameters' => :'String',
|
38
41
|
:'references' => :'PaymentReferences',
|
39
|
-
:'payment_method' => :'String'
|
42
|
+
:'payment_method' => :'String',
|
43
|
+
:'payment_instructions' => :'PaymentInstructions'
|
40
44
|
}
|
41
45
|
end
|
42
46
|
|
43
|
-
# List of attributes with nullable: true
|
47
|
+
# List of attributes with nullable: true.
|
44
48
|
def self.openapi_nullable
|
45
|
-
Set.new([
|
46
|
-
])
|
49
|
+
Set.new([])
|
47
50
|
end
|
48
51
|
|
49
|
-
# Initializes the object
|
50
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
# Initializes the object.
|
53
|
+
# @param [Hash] attributes Model attributes in the form of hash.
|
51
54
|
def initialize(attributes = {})
|
52
55
|
if (!attributes.is_a?(Hash))
|
53
56
|
fail ArgumentError, "The input argument (attributes) must be a hash in `CaptureOutput` initialize method"
|
54
57
|
end
|
55
58
|
|
56
|
-
#
|
59
|
+
# Check to see if the attribute exists and convert string to symbol for hash key.
|
57
60
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
61
|
if (!self.class.attribute_map.key?(k.to_sym))
|
59
62
|
fail ArgumentError, "`#{k}` is not a valid attribute in `CaptureOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
@@ -76,34 +79,39 @@ module PCPServerSDK
|
|
76
79
|
if attributes.key?(:'payment_method')
|
77
80
|
self.payment_method = attributes[:'payment_method']
|
78
81
|
end
|
82
|
+
|
83
|
+
if attributes.key?(:'payment_instructions')
|
84
|
+
self.payment_instructions = attributes[:'payment_instructions']
|
85
|
+
end
|
79
86
|
end
|
80
87
|
|
81
88
|
# Checks equality by comparing each attribute.
|
82
|
-
# @param [Object] Object to be compared
|
89
|
+
# @param [Object] Object to be compared.
|
83
90
|
def ==(o)
|
84
91
|
return true if self.equal?(o)
|
85
92
|
self.class == o.class &&
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
93
|
+
amount_of_money == o.amount_of_money &&
|
94
|
+
merchant_parameters == o.merchant_parameters &&
|
95
|
+
references == o.references &&
|
96
|
+
payment_method == o.payment_method &&
|
97
|
+
payment_instructions == o.payment_instructions
|
90
98
|
end
|
91
99
|
|
92
|
-
# @see the `==` method
|
93
|
-
# @param [Object] Object to be compared
|
100
|
+
# @see the `==` method.
|
101
|
+
# @param [Object] Object to be compared.
|
94
102
|
def eql?(o)
|
95
103
|
self == o
|
96
104
|
end
|
97
105
|
|
98
106
|
# Calculates hash code according to all attributes.
|
99
|
-
# @return [Integer] Hash code
|
107
|
+
# @return [Integer] Hash code.
|
100
108
|
def hash
|
101
|
-
[amount_of_money, merchant_parameters, references, payment_method].hash
|
109
|
+
[amount_of_money, merchant_parameters, references, payment_method, payment_instructions].hash
|
102
110
|
end
|
103
111
|
|
104
|
-
# Builds the object from hash
|
105
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
-
# @return [Object] Returns the model itself
|
112
|
+
# Builds the object from hash.
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash.
|
114
|
+
# @return [Object] Returns the model itself.
|
107
115
|
def self.build_from_hash(attributes)
|
108
116
|
return nil unless attributes.is_a?(Hash)
|
109
117
|
attributes = attributes.transform_keys(&:to_sym)
|
@@ -112,8 +120,6 @@ module PCPServerSDK
|
|
112
120
|
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
113
121
|
transformed_hash["#{key}"] = nil
|
114
122
|
elsif type =~ /\AArray<(.*)>/i
|
115
|
-
# check to ensure the input is an array given that the attribute
|
116
|
-
# is documented as an array but the input is not
|
117
123
|
if attributes[attribute_map[key]].is_a?(Array)
|
118
124
|
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
119
125
|
end
|
@@ -124,10 +130,10 @@ module PCPServerSDK
|
|
124
130
|
new(transformed_hash)
|
125
131
|
end
|
126
132
|
|
127
|
-
# Deserializes the data based on type
|
128
|
-
# @param string type Data type
|
129
|
-
# @param string value Value to be deserialized
|
130
|
-
# @return [Object] Deserialized data
|
133
|
+
# Deserializes the data based on type.
|
134
|
+
# @param string type Data type.
|
135
|
+
# @param string value Value to be deserialized.
|
136
|
+
# @return [Object] Deserialized data.
|
131
137
|
def self._deserialize(type, value)
|
132
138
|
case type.to_sym
|
133
139
|
when :Time
|
@@ -147,7 +153,6 @@ module PCPServerSDK
|
|
147
153
|
false
|
148
154
|
end
|
149
155
|
when :Object
|
150
|
-
# generic object (usually a Hash), return directly
|
151
156
|
value
|
152
157
|
when /\AArray<(?<inner_type>.+)>\z/
|
153
158
|
inner_type = Regexp.last_match[:inner_type]
|
@@ -161,26 +166,25 @@ module PCPServerSDK
|
|
161
166
|
end
|
162
167
|
end
|
163
168
|
else # model
|
164
|
-
# models (e.g. Pet) or oneOf
|
165
169
|
klass = PCPServerSDK::Models.const_get(type)
|
166
170
|
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
167
171
|
end
|
168
172
|
end
|
169
173
|
|
170
|
-
# Returns the string representation of the object
|
171
|
-
# @return [String] String presentation of the object
|
174
|
+
# Returns the string representation of the object.
|
175
|
+
# @return [String] String presentation of the object.
|
172
176
|
def to_s
|
173
177
|
to_hash.to_s
|
174
178
|
end
|
175
179
|
|
176
|
-
# to_body is an alias to to_hash (backward compatibility)
|
177
|
-
# @return [Hash] Returns the object in the form of hash
|
180
|
+
# to_body is an alias to to_hash (backward compatibility).
|
181
|
+
# @return [Hash] Returns the object in the form of hash.
|
178
182
|
def to_body
|
179
183
|
to_hash
|
180
184
|
end
|
181
185
|
|
182
|
-
# Returns the object in the form of hash
|
183
|
-
# @return [Hash] Returns the object in the form of hash
|
186
|
+
# Returns the object in the form of hash.
|
187
|
+
# @return [Hash] Returns the object in the form of hash.
|
184
188
|
def to_hash
|
185
189
|
hash = {}
|
186
190
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -195,10 +199,10 @@ module PCPServerSDK
|
|
195
199
|
hash
|
196
200
|
end
|
197
201
|
|
198
|
-
# Outputs non-array value in the form of hash
|
199
|
-
# For object, use to_hash. Otherwise, just return the value
|
200
|
-
# @param [Object] value Any valid value
|
201
|
-
# @return [Hash] Returns the value in the form of hash
|
202
|
+
# Outputs non-array value in the form of hash.
|
203
|
+
# For object, use to_hash. Otherwise, just return the value.
|
204
|
+
# @param [Object] value Any valid value.
|
205
|
+
# @return [Hash] Returns the value in the form of hash.
|
202
206
|
def _to_hash(value)
|
203
207
|
if value.is_a?(Array)
|
204
208
|
value.compact.map { |v| _to_hash(v) }
|