pcp-server-ruby-sdk 1.5.0 → 1.7.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/Gemfile +1 -0
- data/api-definition.yaml +169 -18
- data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_header_information.rb +2 -0
- data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_information.rb +6 -0
- data/lib/PCP-server-Ruby-SDK/models/bank_account_information.rb +0 -2
- data/lib/PCP-server-Ruby-SDK/models/bank_payout_method_specific_input.rb +0 -4
- data/lib/PCP-server-Ruby-SDK/models/capture_payment_request.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/capture_payment_response.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/cart_item_input.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/cart_item_patch.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/cart_item_result.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/cart_item_supplier_references.rb +200 -0
- data/lib/PCP-server-Ruby-SDK/models/complete_payment_product840_specific_input.rb +2 -0
- data/lib/PCP-server-Ruby-SDK/models/create_payment_response.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/deliver_request.rb +12 -4
- data/lib/PCP-server-Ruby-SDK/models/fund_distribution.rb +272 -0
- data/lib/PCP-server-Ruby-SDK/models/fund_split.rb +211 -0
- data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_input.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_output.rb +1 -1
- data/lib/PCP-server-Ruby-SDK/models/{network.rb → mobile_payment_network.rb} +4 -4
- data/lib/PCP-server-Ruby-SDK/models/order_request.rb +12 -4
- data/lib/PCP-server-Ruby-SDK/models/pause_payment_request.rb +5 -38
- data/lib/PCP-server-Ruby-SDK/models/payment_execution.rb +15 -4
- data/lib/PCP-server-Ruby-SDK/models/payment_execution_specific_input.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/payment_product302_specific_input.rb +1 -1
- data/lib/PCP-server-Ruby-SDK/models/payment_product5002_specific_input.rb +209 -0
- data/lib/PCP-server-Ruby-SDK/models/refund_payment_response.rb +12 -4
- data/lib/PCP-server-Ruby-SDK/models/refund_request.rb +13 -4
- data/lib/PCP-server-Ruby-SDK/models/return_request.rb +204 -191
- 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 +5 -1
- data/package-lock.json +17 -18
- data/package.json +1 -1
- data/scripts.sh +2 -2
- data/spec/transformer/apple_pay_transformer_spec.rb +1 -1
- metadata +11 -7
|
@@ -9,11 +9,14 @@ module PCPServerSDK
|
|
|
9
9
|
|
|
10
10
|
attr_accessor :order_line_details
|
|
11
11
|
|
|
12
|
+
attr_accessor :supplier_references
|
|
13
|
+
|
|
12
14
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
13
15
|
def self.attribute_map
|
|
14
16
|
{
|
|
15
17
|
:'invoice_data' => :'invoiceData',
|
|
16
|
-
:'order_line_details' => :'orderLineDetails'
|
|
18
|
+
:'order_line_details' => :'orderLineDetails',
|
|
19
|
+
:'supplier_references' => :'supplierReferences'
|
|
17
20
|
}
|
|
18
21
|
end
|
|
19
22
|
|
|
@@ -26,7 +29,8 @@ module PCPServerSDK
|
|
|
26
29
|
def self.openapi_types
|
|
27
30
|
{
|
|
28
31
|
:'invoice_data' => :'CartItemInvoiceData',
|
|
29
|
-
:'order_line_details' => :'OrderLineDetailsResult'
|
|
32
|
+
:'order_line_details' => :'OrderLineDetailsResult',
|
|
33
|
+
:'supplier_references' => :'CartItemSupplierReferences'
|
|
30
34
|
}
|
|
31
35
|
end
|
|
32
36
|
|
|
@@ -58,6 +62,10 @@ module PCPServerSDK
|
|
|
58
62
|
if attributes.key?(:'order_line_details')
|
|
59
63
|
self.order_line_details = attributes[:'order_line_details']
|
|
60
64
|
end
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:'supplier_references')
|
|
67
|
+
self.supplier_references = attributes[:'supplier_references']
|
|
68
|
+
end
|
|
61
69
|
end
|
|
62
70
|
|
|
63
71
|
# Checks equality by comparing each attribute.
|
|
@@ -66,7 +74,8 @@ module PCPServerSDK
|
|
|
66
74
|
return true if self.equal?(o)
|
|
67
75
|
self.class == o.class &&
|
|
68
76
|
invoice_data == o.invoice_data &&
|
|
69
|
-
order_line_details == o.order_line_details
|
|
77
|
+
order_line_details == o.order_line_details &&
|
|
78
|
+
supplier_references == o.supplier_references
|
|
70
79
|
end
|
|
71
80
|
|
|
72
81
|
# @see the `==` method
|
|
@@ -78,7 +87,7 @@ module PCPServerSDK
|
|
|
78
87
|
# Calculates hash code according to all attributes.
|
|
79
88
|
# @return [Integer] Hash code
|
|
80
89
|
def hash
|
|
81
|
-
[invoice_data, order_line_details].hash
|
|
90
|
+
[invoice_data, order_line_details, supplier_references].hash
|
|
82
91
|
end
|
|
83
92
|
|
|
84
93
|
# Builds the object from hash
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
|
|
2
|
+
require 'date'
|
|
3
|
+
require 'time'
|
|
4
|
+
|
|
5
|
+
module PCPServerSDK
|
|
6
|
+
module Models
|
|
7
|
+
# This object contains references of the seller of the cart item.
|
|
8
|
+
class CartItemSupplierReferences
|
|
9
|
+
# Unique identifier for the supplier.
|
|
10
|
+
attr_accessor :supplier_id
|
|
11
|
+
|
|
12
|
+
# Reference of the order for the supplier.
|
|
13
|
+
attr_accessor :order_reference
|
|
14
|
+
|
|
15
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
16
|
+
def self.attribute_map
|
|
17
|
+
{
|
|
18
|
+
:'supplier_id' => :'supplierId',
|
|
19
|
+
:'order_reference' => :'orderReference'
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Returns all the JSON keys this model knows about
|
|
24
|
+
def self.acceptable_attributes
|
|
25
|
+
attribute_map.values
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Attribute type mapping.
|
|
29
|
+
def self.openapi_types
|
|
30
|
+
{
|
|
31
|
+
:'supplier_id' => :'String',
|
|
32
|
+
:'order_reference' => :'String'
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# List of attributes with nullable: true
|
|
37
|
+
def self.openapi_nullable
|
|
38
|
+
Set.new([
|
|
39
|
+
])
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Initializes the object
|
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
44
|
+
def initialize(attributes = {})
|
|
45
|
+
if (!attributes.is_a?(Hash))
|
|
46
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `CartItemSupplierReferences` initialize method"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
50
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
51
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
52
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `CartItemSupplierReferences`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
53
|
+
end
|
|
54
|
+
h[k.to_sym] = v
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if attributes.key?(:'supplier_id')
|
|
58
|
+
self.supplier_id = attributes[:'supplier_id']
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'order_reference')
|
|
62
|
+
self.order_reference = attributes[:'order_reference']
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Checks equality by comparing each attribute.
|
|
67
|
+
# @param [Object] Object to be compared
|
|
68
|
+
def ==(o)
|
|
69
|
+
return true if self.equal?(o)
|
|
70
|
+
self.class == o.class &&
|
|
71
|
+
supplier_id == o.supplier_id &&
|
|
72
|
+
order_reference == o.order_reference
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @see the `==` method
|
|
76
|
+
# @param [Object] Object to be compared
|
|
77
|
+
def eql?(o)
|
|
78
|
+
self == o
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Calculates hash code according to all attributes.
|
|
82
|
+
# @return [Integer] Hash code
|
|
83
|
+
def hash
|
|
84
|
+
[supplier_id, order_reference].hash
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Builds the object from hash
|
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
89
|
+
# @return [Object] Returns the model itself
|
|
90
|
+
def self.build_from_hash(attributes)
|
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
|
92
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
93
|
+
transformed_hash = {}
|
|
94
|
+
openapi_types.each_pair do |key, type|
|
|
95
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
96
|
+
transformed_hash["#{key}"] = nil
|
|
97
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
98
|
+
# check to ensure the input is an array given that the attribute
|
|
99
|
+
# is documented as an array but the input is not
|
|
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
|
+
# generic object (usually a Hash), return directly
|
|
134
|
+
value
|
|
135
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
136
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
137
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
138
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
139
|
+
k_type = Regexp.last_match[:k_type]
|
|
140
|
+
v_type = Regexp.last_match[:v_type]
|
|
141
|
+
{}.tap do |hash|
|
|
142
|
+
value.each do |k, v|
|
|
143
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
else # model
|
|
147
|
+
# models (e.g. Pet) or oneOf
|
|
148
|
+
klass = PCPServerSDK::Models.const_get(type)
|
|
149
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Returns the string representation of the object
|
|
154
|
+
# @return [String] String presentation of the object
|
|
155
|
+
def to_s
|
|
156
|
+
to_hash.to_s
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
|
161
|
+
def to_body
|
|
162
|
+
to_hash
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Returns the object in the form of hash
|
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
|
167
|
+
def to_hash
|
|
168
|
+
hash = {}
|
|
169
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
170
|
+
value = self.send(attr)
|
|
171
|
+
if value.nil?
|
|
172
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
173
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
hash[param] = _to_hash(value)
|
|
177
|
+
end
|
|
178
|
+
hash
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Outputs non-array value in the form of hash
|
|
182
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
183
|
+
# @param [Object] value Any valid value
|
|
184
|
+
# @return [Hash] Returns the value in the form of hash
|
|
185
|
+
def _to_hash(value)
|
|
186
|
+
if value.is_a?(Array)
|
|
187
|
+
value.compact.map { |v| _to_hash(v) }
|
|
188
|
+
elsif value.is_a?(Hash)
|
|
189
|
+
{}.tap do |hash|
|
|
190
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
191
|
+
end
|
|
192
|
+
elsif value.respond_to? :to_hash
|
|
193
|
+
value.to_hash
|
|
194
|
+
else
|
|
195
|
+
value
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
@@ -14,13 +14,16 @@ module PCPServerSDK
|
|
|
14
14
|
# reference to the paymentExecution.
|
|
15
15
|
attr_accessor :payment_execution_id
|
|
16
16
|
|
|
17
|
+
attr_accessor :fund_split
|
|
18
|
+
|
|
17
19
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
18
20
|
def self.attribute_map
|
|
19
21
|
{
|
|
20
22
|
:'creation_output' => :'creationOutput',
|
|
21
23
|
:'merchant_action' => :'merchantAction',
|
|
22
24
|
:'payment' => :'payment',
|
|
23
|
-
:'payment_execution_id' => :'paymentExecutionId'
|
|
25
|
+
:'payment_execution_id' => :'paymentExecutionId',
|
|
26
|
+
:'fund_split' => :'fundSplit'
|
|
24
27
|
}
|
|
25
28
|
end
|
|
26
29
|
|
|
@@ -35,7 +38,8 @@ module PCPServerSDK
|
|
|
35
38
|
:'creation_output' => :'PaymentCreationOutput',
|
|
36
39
|
:'merchant_action' => :'MerchantAction',
|
|
37
40
|
:'payment' => :'PaymentResponse',
|
|
38
|
-
:'payment_execution_id' => :'String'
|
|
41
|
+
:'payment_execution_id' => :'String',
|
|
42
|
+
:'fund_split' => :'FundSplit'
|
|
39
43
|
}
|
|
40
44
|
end
|
|
41
45
|
|
|
@@ -75,6 +79,10 @@ module PCPServerSDK
|
|
|
75
79
|
if attributes.key?(:'payment_execution_id')
|
|
76
80
|
self.payment_execution_id = attributes[:'payment_execution_id']
|
|
77
81
|
end
|
|
82
|
+
|
|
83
|
+
if attributes.key?(:'fund_split')
|
|
84
|
+
self.fund_split = attributes[:'fund_split']
|
|
85
|
+
end
|
|
78
86
|
end
|
|
79
87
|
|
|
80
88
|
# Checks equality by comparing each attribute.
|
|
@@ -85,7 +93,8 @@ module PCPServerSDK
|
|
|
85
93
|
creation_output == o.creation_output &&
|
|
86
94
|
merchant_action == o.merchant_action &&
|
|
87
95
|
payment == o.payment &&
|
|
88
|
-
payment_execution_id == o.payment_execution_id
|
|
96
|
+
payment_execution_id == o.payment_execution_id &&
|
|
97
|
+
fund_split == o.fund_split
|
|
89
98
|
end
|
|
90
99
|
|
|
91
100
|
# @see the `==` method
|
|
@@ -97,7 +106,7 @@ module PCPServerSDK
|
|
|
97
106
|
# Calculates hash code according to all attributes.
|
|
98
107
|
# @return [Integer] Hash code
|
|
99
108
|
def hash
|
|
100
|
-
[creation_output, merchant_action, payment, payment_execution_id].hash
|
|
109
|
+
[creation_output, merchant_action, payment, payment_execution_id, fund_split].hash
|
|
101
110
|
end
|
|
102
111
|
|
|
103
112
|
# Builds the object from hash
|
|
@@ -15,6 +15,7 @@ module PCPServerSDK
|
|
|
15
15
|
|
|
16
16
|
attr_accessor :deliver_items
|
|
17
17
|
|
|
18
|
+
attr_accessor :fund_split
|
|
18
19
|
|
|
19
20
|
class EnumAttributeValidator
|
|
20
21
|
attr_reader :datatype
|
|
@@ -44,7 +45,8 @@ module PCPServerSDK
|
|
|
44
45
|
:'deliver_type' => :'deliverType',
|
|
45
46
|
:'is_final' => :'isFinal',
|
|
46
47
|
:'cancellation_reason' => :'cancellationReason',
|
|
47
|
-
:'deliver_items' => :'deliverItems'
|
|
48
|
+
:'deliver_items' => :'deliverItems',
|
|
49
|
+
:'fund_split' => :'fundSplit'
|
|
48
50
|
}
|
|
49
51
|
end
|
|
50
52
|
|
|
@@ -59,7 +61,8 @@ module PCPServerSDK
|
|
|
59
61
|
:'deliver_type' => :'DeliverType',
|
|
60
62
|
:'is_final' => :'Boolean',
|
|
61
63
|
:'cancellation_reason' => :'CancellationReason',
|
|
62
|
-
:'deliver_items' => :'Array<DeliverItem>'
|
|
64
|
+
:'deliver_items' => :'Array<DeliverItem>',
|
|
65
|
+
:'fund_split' => :'FundSplit'
|
|
63
66
|
}
|
|
64
67
|
end
|
|
65
68
|
|
|
@@ -103,6 +106,10 @@ module PCPServerSDK
|
|
|
103
106
|
self.deliver_items = value
|
|
104
107
|
end
|
|
105
108
|
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'fund_split')
|
|
111
|
+
self.fund_split = attributes[:'fund_split']
|
|
112
|
+
end
|
|
106
113
|
end
|
|
107
114
|
|
|
108
115
|
# Checks equality by comparing each attribute.
|
|
@@ -113,7 +120,8 @@ module PCPServerSDK
|
|
|
113
120
|
deliver_type == o.deliver_type &&
|
|
114
121
|
is_final == o.is_final &&
|
|
115
122
|
cancellation_reason == o.cancellation_reason &&
|
|
116
|
-
deliver_items == o.deliver_items
|
|
123
|
+
deliver_items == o.deliver_items &&
|
|
124
|
+
fund_split == o.fund_split
|
|
117
125
|
end
|
|
118
126
|
|
|
119
127
|
# @see the `==` method
|
|
@@ -125,7 +133,7 @@ module PCPServerSDK
|
|
|
125
133
|
# Calculates hash code according to all attributes.
|
|
126
134
|
# @return [Integer] Hash code
|
|
127
135
|
def hash
|
|
128
|
-
[deliver_type, is_final, cancellation_reason, deliver_items].hash
|
|
136
|
+
[deliver_type, is_final, cancellation_reason, deliver_items, fund_split].hash
|
|
129
137
|
end
|
|
130
138
|
|
|
131
139
|
# Builds the object from hash
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
|
|
2
|
+
require 'date'
|
|
3
|
+
require 'time'
|
|
4
|
+
|
|
5
|
+
module PCPServerSDK
|
|
6
|
+
module Models
|
|
7
|
+
# Instructions for distributing funds to multiple sellers or partners in a marketplace context.
|
|
8
|
+
class FundDistribution
|
|
9
|
+
# Unique ID of the fund distribution (read-only).
|
|
10
|
+
attr_accessor :id
|
|
11
|
+
|
|
12
|
+
# Unique identifier of the beneficiary (seller/partner/sub-account) to receive funds (e.g., payout account ID).
|
|
13
|
+
attr_accessor :account_id
|
|
14
|
+
|
|
15
|
+
# Human-readable description for reconciliation. Appears on reports.
|
|
16
|
+
attr_accessor :description
|
|
17
|
+
|
|
18
|
+
# Amount in cents and always having 2 decimals, in the currency of the original transaction.
|
|
19
|
+
attr_accessor :amount
|
|
20
|
+
|
|
21
|
+
# Classification or purpose of the fund distribution to the receiving account within a given order.
|
|
22
|
+
attr_accessor :type
|
|
23
|
+
|
|
24
|
+
# Unique reference of the part of the fund/payment to be distributed.
|
|
25
|
+
attr_accessor :merchant_reference
|
|
26
|
+
|
|
27
|
+
# Additional parameters for the transaction in JSON format.
|
|
28
|
+
attr_accessor :merchant_parameters
|
|
29
|
+
|
|
30
|
+
class EnumAttributeValidator
|
|
31
|
+
attr_reader :datatype
|
|
32
|
+
attr_reader :allowable_values
|
|
33
|
+
|
|
34
|
+
def initialize(datatype, allowable_values)
|
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
|
36
|
+
case datatype.to_s
|
|
37
|
+
when /Integer/i
|
|
38
|
+
value.to_i
|
|
39
|
+
when /Float/i
|
|
40
|
+
value.to_f
|
|
41
|
+
else
|
|
42
|
+
value
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def valid?(value)
|
|
48
|
+
!value || allowable_values.include?(value)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
53
|
+
def self.attribute_map
|
|
54
|
+
{
|
|
55
|
+
:'id' => :'id',
|
|
56
|
+
:'account_id' => :'accountId',
|
|
57
|
+
:'description' => :'description',
|
|
58
|
+
:'amount' => :'amount',
|
|
59
|
+
:'type' => :'type',
|
|
60
|
+
:'merchant_reference' => :'merchantReference',
|
|
61
|
+
:'merchant_parameters' => :'merchantParameters'
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Returns all the JSON keys this model knows about
|
|
66
|
+
def self.acceptable_attributes
|
|
67
|
+
attribute_map.values
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Attribute type mapping.
|
|
71
|
+
def self.openapi_types
|
|
72
|
+
{
|
|
73
|
+
:'id' => :'String',
|
|
74
|
+
:'account_id' => :'String',
|
|
75
|
+
:'description' => :'String',
|
|
76
|
+
:'amount' => :'Integer',
|
|
77
|
+
:'type' => :'String',
|
|
78
|
+
:'merchant_reference' => :'String',
|
|
79
|
+
:'merchant_parameters' => :'String'
|
|
80
|
+
}
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# List of attributes with nullable: true
|
|
84
|
+
def self.openapi_nullable
|
|
85
|
+
Set.new([
|
|
86
|
+
])
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Initializes the object
|
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
91
|
+
def initialize(attributes = {})
|
|
92
|
+
if (!attributes.is_a?(Hash))
|
|
93
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FundDistribution` initialize method"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
97
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
98
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
99
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FundDistribution`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
100
|
+
end
|
|
101
|
+
h[k.to_sym] = v
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'id')
|
|
105
|
+
self.id = attributes[:'id']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'account_id')
|
|
109
|
+
self.account_id = attributes[:'account_id']
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'description')
|
|
113
|
+
self.description = attributes[:'description']
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'amount')
|
|
117
|
+
self.amount = attributes[:'amount']
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'type')
|
|
121
|
+
self.type = attributes[:'type']
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'merchant_reference')
|
|
125
|
+
self.merchant_reference = attributes[:'merchant_reference']
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'merchant_parameters')
|
|
129
|
+
self.merchant_parameters = attributes[:'merchant_parameters']
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Checks equality by comparing each attribute.
|
|
134
|
+
# @param [Object] Object to be compared
|
|
135
|
+
def ==(o)
|
|
136
|
+
return true if self.equal?(o)
|
|
137
|
+
self.class == o.class &&
|
|
138
|
+
id == o.id &&
|
|
139
|
+
account_id == o.account_id &&
|
|
140
|
+
description == o.description &&
|
|
141
|
+
amount == o.amount &&
|
|
142
|
+
type == o.type &&
|
|
143
|
+
merchant_reference == o.merchant_reference &&
|
|
144
|
+
merchant_parameters == o.merchant_parameters
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# @see the `==` method
|
|
148
|
+
# @param [Object] Object to be compared
|
|
149
|
+
def eql?(o)
|
|
150
|
+
self == o
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Calculates hash code according to all attributes.
|
|
154
|
+
# @return [Integer] Hash code
|
|
155
|
+
def hash
|
|
156
|
+
[id, account_id, description, amount, type, merchant_reference, merchant_parameters].hash
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Builds the object from hash
|
|
160
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
161
|
+
# @return [Object] Returns the model itself
|
|
162
|
+
def self.build_from_hash(attributes)
|
|
163
|
+
return nil unless attributes.is_a?(Hash)
|
|
164
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
165
|
+
transformed_hash = {}
|
|
166
|
+
openapi_types.each_pair do |key, type|
|
|
167
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
168
|
+
transformed_hash["#{key}"] = nil
|
|
169
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
170
|
+
# check to ensure the input is an array given that the attribute
|
|
171
|
+
# is documented as an array but the input is not
|
|
172
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
173
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
174
|
+
end
|
|
175
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
176
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
new(transformed_hash)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Deserializes the data based on type
|
|
183
|
+
# @param string type Data type
|
|
184
|
+
# @param string value Value to be deserialized
|
|
185
|
+
# @return [Object] Deserialized data
|
|
186
|
+
def self._deserialize(type, value)
|
|
187
|
+
case type.to_sym
|
|
188
|
+
when :Time
|
|
189
|
+
Time.parse(value)
|
|
190
|
+
when :Date
|
|
191
|
+
Date.parse(value)
|
|
192
|
+
when :String
|
|
193
|
+
value.to_s
|
|
194
|
+
when :Integer
|
|
195
|
+
value.to_i
|
|
196
|
+
when :Float
|
|
197
|
+
value.to_f
|
|
198
|
+
when :Boolean
|
|
199
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
200
|
+
true
|
|
201
|
+
else
|
|
202
|
+
false
|
|
203
|
+
end
|
|
204
|
+
when :Object
|
|
205
|
+
# generic object (usually a Hash), return directly
|
|
206
|
+
value
|
|
207
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
208
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
209
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
210
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
211
|
+
k_type = Regexp.last_match[:k_type]
|
|
212
|
+
v_type = Regexp.last_match[:v_type]
|
|
213
|
+
{}.tap do |hash|
|
|
214
|
+
value.each do |k, v|
|
|
215
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
else # model
|
|
219
|
+
# models (e.g. Pet) or oneOf
|
|
220
|
+
klass = PCPServerSDK::Models.const_get(type)
|
|
221
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Returns the string representation of the object
|
|
226
|
+
# @return [String] String presentation of the object
|
|
227
|
+
def to_s
|
|
228
|
+
to_hash.to_s
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
232
|
+
# @return [Hash] Returns the object in the form of hash
|
|
233
|
+
def to_body
|
|
234
|
+
to_hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Returns the object in the form of hash
|
|
238
|
+
# @return [Hash] Returns the object in the form of hash
|
|
239
|
+
def to_hash
|
|
240
|
+
hash = {}
|
|
241
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
242
|
+
value = self.send(attr)
|
|
243
|
+
if value.nil?
|
|
244
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
245
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
hash[param] = _to_hash(value)
|
|
249
|
+
end
|
|
250
|
+
hash
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Outputs non-array value in the form of hash
|
|
254
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
255
|
+
# @param [Object] value Any valid value
|
|
256
|
+
# @return [Hash] Returns the value in the form of hash
|
|
257
|
+
def _to_hash(value)
|
|
258
|
+
if value.is_a?(Array)
|
|
259
|
+
value.compact.map { |v| _to_hash(v) }
|
|
260
|
+
elsif value.is_a?(Hash)
|
|
261
|
+
{}.tap do |hash|
|
|
262
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
263
|
+
end
|
|
264
|
+
elsif value.respond_to? :to_hash
|
|
265
|
+
value.to_hash
|
|
266
|
+
else
|
|
267
|
+
value
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
end
|