khipu-api-client 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,45 @@
1
+ module Khipu
2
+ #
3
+ class AuthorizationError < BaseObject
4
+ attr_accessor :status, :message
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'status' => :'status',
11
+
12
+ #
13
+ :'message' => :'message'
14
+
15
+ }
16
+ end
17
+
18
+ # attribute type
19
+ def self.swagger_types
20
+ {
21
+ :'status' => :'Integer',
22
+ :'message' => :'String'
23
+
24
+ }
25
+ end
26
+
27
+ def initialize(attributes = {})
28
+ return if !attributes.is_a?(Hash) || attributes.empty?
29
+
30
+ # convert string to symbol for hash key
31
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
32
+
33
+
34
+ if attributes[:'status']
35
+ self.status = attributes[:'status']
36
+ end
37
+
38
+ if attributes[:'message']
39
+ self.message = attributes[:'message']
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,69 @@
1
+ module Khipu
2
+ #
3
+ class BankItem < BaseObject
4
+ attr_accessor :name, :message, :min_amount, :type, :parent
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'name' => :'name',
11
+
12
+ #
13
+ :'message' => :'message',
14
+
15
+ #
16
+ :'min_amount' => :'min_amount',
17
+
18
+ #
19
+ :'type' => :'type',
20
+
21
+ #
22
+ :'parent' => :'parent'
23
+
24
+ }
25
+ end
26
+
27
+ # attribute type
28
+ def self.swagger_types
29
+ {
30
+ :'name' => :'String',
31
+ :'message' => :'String',
32
+ :'min_amount' => :'Float',
33
+ :'type' => :'String',
34
+ :'parent' => :'String'
35
+
36
+ }
37
+ end
38
+
39
+ def initialize(attributes = {})
40
+ return if !attributes.is_a?(Hash) || attributes.empty?
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
44
+
45
+
46
+ if attributes[:'name']
47
+ self.name = attributes[:'name']
48
+ end
49
+
50
+ if attributes[:'message']
51
+ self.message = attributes[:'message']
52
+ end
53
+
54
+ if attributes[:'min_amount']
55
+ self.min_amount = attributes[:'min_amount']
56
+ end
57
+
58
+ if attributes[:'type']
59
+ self.type = attributes[:'type']
60
+ end
61
+
62
+ if attributes[:'parent']
63
+ self.parent = attributes[:'parent']
64
+ end
65
+
66
+ end
67
+
68
+ end
69
+ end
@@ -0,0 +1,37 @@
1
+ module Khipu
2
+ #
3
+ class BanksResponse < BaseObject
4
+ attr_accessor :banks
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'banks' => :'banks'
11
+
12
+ }
13
+ end
14
+
15
+ # attribute type
16
+ def self.swagger_types
17
+ {
18
+ :'banks' => :'BankItem'
19
+
20
+ }
21
+ end
22
+
23
+ def initialize(attributes = {})
24
+ return if !attributes.is_a?(Hash) || attributes.empty?
25
+
26
+ # convert string to symbol for hash key
27
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
28
+
29
+
30
+ if attributes[:'banks']
31
+ self.banks = attributes[:'banks']
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,86 @@
1
+ require 'date'
2
+
3
+ module Khipu
4
+ # base class containing fundamental method such as to_hash, build_from_hash and more
5
+ class BaseObject
6
+
7
+ # build the object from hash
8
+ def build_from_hash(attributes)
9
+ return nil unless attributes.is_a?(Hash)
10
+ self.class.swagger_types.each_pair do |key, type|
11
+ if type =~ /^Array<(.*)>/i
12
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
13
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
14
+ else
15
+ #TODO show warning in debug mode
16
+ end
17
+ elsif !attributes[self.class.attribute_map[key]].nil?
18
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
19
+ else
20
+ # data not found in attributes(hash), not an issue as the data can be optional
21
+ end
22
+ end
23
+
24
+ self
25
+ end
26
+
27
+ def _deserialize(type, value)
28
+ case type.to_sym
29
+ when :DateTime
30
+ DateTime.parse(value)
31
+ when :Date
32
+ Date.parse(value)
33
+ when :String
34
+ value.to_s
35
+ when :Integer
36
+ value.to_i
37
+ when :Float
38
+ value.to_f
39
+ when :BOOLEAN
40
+ if value =~ /^(true|t|yes|y|1)$/i
41
+ true
42
+ else
43
+ false
44
+ end
45
+ else # model
46
+ _model = Khipu.const_get(type).new
47
+ _model.build_from_hash(value)
48
+ end
49
+ end
50
+
51
+ def to_s
52
+ to_hash.to_s
53
+ end
54
+
55
+ # to_body is an alias to to_body (backward compatibility))
56
+ def to_body
57
+ to_hash
58
+ end
59
+
60
+ # return the object in the form of hash
61
+ def to_hash
62
+ hash = {}
63
+ self.class.attribute_map.each_pair do |attr, param|
64
+ value = self.send(attr)
65
+ next if value.nil?
66
+ if value.is_a?(Array)
67
+ hash[param] = value.compact.map{ |v| _to_hash(v) }
68
+ else
69
+ hash[param] = _to_hash(value)
70
+ end
71
+ end
72
+ hash
73
+ end
74
+
75
+ # Method to output non-array value in the form of hash
76
+ # For object, use to_hash. Otherwise, just return the value
77
+ def _to_hash(value)
78
+ if value.respond_to? :to_hash
79
+ value.to_hash
80
+ else
81
+ value
82
+ end
83
+ end
84
+
85
+ end
86
+ end
@@ -0,0 +1,77 @@
1
+ module Khipu
2
+ #
3
+ class CreateResponse < BaseObject
4
+ attr_accessor :payment_id, :payment_url, :simplified_transfer_url, :transfer_url, :app_url, :ready_for_terminal
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'payment_id' => :'payment_id',
11
+
12
+ #
13
+ :'payment_url' => :'payment_url',
14
+
15
+ #
16
+ :'simplified_transfer_url' => :'simplified_transfer_url',
17
+
18
+ #
19
+ :'transfer_url' => :'transfer_url',
20
+
21
+ #
22
+ :'app_url' => :'app_url',
23
+
24
+ #
25
+ :'ready_for_terminal' => :'ready_for_terminal'
26
+
27
+ }
28
+ end
29
+
30
+ # attribute type
31
+ def self.swagger_types
32
+ {
33
+ :'payment_id' => :'String',
34
+ :'payment_url' => :'String',
35
+ :'simplified_transfer_url' => :'String',
36
+ :'transfer_url' => :'String',
37
+ :'app_url' => :'String',
38
+ :'ready_for_terminal' => :'BOOLEAN'
39
+
40
+ }
41
+ end
42
+
43
+ def initialize(attributes = {})
44
+ return if !attributes.is_a?(Hash) || attributes.empty?
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
48
+
49
+
50
+ if attributes[:'payment_id']
51
+ self.payment_id = attributes[:'payment_id']
52
+ end
53
+
54
+ if attributes[:'payment_url']
55
+ self.payment_url = attributes[:'payment_url']
56
+ end
57
+
58
+ if attributes[:'simplified_transfer_url']
59
+ self.simplified_transfer_url = attributes[:'simplified_transfer_url']
60
+ end
61
+
62
+ if attributes[:'transfer_url']
63
+ self.transfer_url = attributes[:'transfer_url']
64
+ end
65
+
66
+ if attributes[:'app_url']
67
+ self.app_url = attributes[:'app_url']
68
+ end
69
+
70
+ if attributes[:'ready_for_terminal']
71
+ self.ready_for_terminal = attributes[:'ready_for_terminal']
72
+ end
73
+
74
+ end
75
+
76
+ end
77
+ end
@@ -0,0 +1,45 @@
1
+ module Khipu
2
+ #
3
+ class ErrorItem < BaseObject
4
+ attr_accessor :field, :message
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'field' => :'field',
11
+
12
+ #
13
+ :'message' => :'message'
14
+
15
+ }
16
+ end
17
+
18
+ # attribute type
19
+ def self.swagger_types
20
+ {
21
+ :'field' => :'String',
22
+ :'message' => :'String'
23
+
24
+ }
25
+ end
26
+
27
+ def initialize(attributes = {})
28
+ return if !attributes.is_a?(Hash) || attributes.empty?
29
+
30
+ # convert string to symbol for hash key
31
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
32
+
33
+
34
+ if attributes[:'field']
35
+ self.field = attributes[:'field']
36
+ end
37
+
38
+ if attributes[:'message']
39
+ self.message = attributes[:'message']
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,247 @@
1
+ module Khipu
2
+ #
3
+ class PaymentResponse < BaseObject
4
+ attr_accessor :payment_id, :payment_url, :simplified_transfer_url, :transfer_url, :app_url, :ready_for_terminal, :subject, :amount, :currency, :status, :status_detail, :body, :picture_url, :receipt_url, :return_url, :cancel_url, :notify_url, :notify_api_version, :expires_date, :attachment_urls, :bank, :bank_id, :payer_name, :payer_email, :personal_identifier, :bank_account_number, :out_of_date_conciliation
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'payment_id' => :'payment_id',
11
+
12
+ #
13
+ :'payment_url' => :'payment_url',
14
+
15
+ #
16
+ :'simplified_transfer_url' => :'simplified_transfer_url',
17
+
18
+ #
19
+ :'transfer_url' => :'transfer_url',
20
+
21
+ #
22
+ :'app_url' => :'app_url',
23
+
24
+ #
25
+ :'ready_for_terminal' => :'ready_for_terminal',
26
+
27
+ #
28
+ :'subject' => :'subject',
29
+
30
+ #
31
+ :'amount' => :'amount',
32
+
33
+ #
34
+ :'currency' => :'currency',
35
+
36
+ #
37
+ :'status' => :'status',
38
+
39
+ #
40
+ :'status_detail' => :'status_detail',
41
+
42
+ #
43
+ :'body' => :'body',
44
+
45
+ #
46
+ :'picture_url' => :'picture_url',
47
+
48
+ #
49
+ :'receipt_url' => :'receipt_url',
50
+
51
+ #
52
+ :'return_url' => :'return_url',
53
+
54
+ #
55
+ :'cancel_url' => :'cancel_url',
56
+
57
+ #
58
+ :'notify_url' => :'notify_url',
59
+
60
+ #
61
+ :'notify_api_version' => :'notify_api_version',
62
+
63
+ #
64
+ :'expires_date' => :'expires_date',
65
+
66
+ #
67
+ :'attachment_urls' => :'attachment_urls',
68
+
69
+ #
70
+ :'bank' => :'bank',
71
+
72
+ #
73
+ :'bank_id' => :'bank_id',
74
+
75
+ #
76
+ :'payer_name' => :'payer_name',
77
+
78
+ #
79
+ :'payer_email' => :'payer_email',
80
+
81
+ #
82
+ :'personal_identifier' => :'personal_identifier',
83
+
84
+ #
85
+ :'bank_account_number' => :'bank_account_number',
86
+
87
+ #
88
+ :'out_of_date_conciliation' => :'out_of_date_conciliation'
89
+
90
+ }
91
+ end
92
+
93
+ # attribute type
94
+ def self.swagger_types
95
+ {
96
+ :'payment_id' => :'String',
97
+ :'payment_url' => :'String',
98
+ :'simplified_transfer_url' => :'String',
99
+ :'transfer_url' => :'String',
100
+ :'app_url' => :'String',
101
+ :'ready_for_terminal' => :'BOOLEAN',
102
+ :'subject' => :'String',
103
+ :'amount' => :'Float',
104
+ :'currency' => :'String',
105
+ :'status' => :'String',
106
+ :'status_detail' => :'String',
107
+ :'body' => :'String',
108
+ :'picture_url' => :'String',
109
+ :'receipt_url' => :'String',
110
+ :'return_url' => :'String',
111
+ :'cancel_url' => :'String',
112
+ :'notify_url' => :'String',
113
+ :'notify_api_version' => :'String',
114
+ :'expires_date' => :'DateTime',
115
+ :'attachment_urls' => :'Array<String>',
116
+ :'bank' => :'String',
117
+ :'bank_id' => :'String',
118
+ :'payer_name' => :'String',
119
+ :'payer_email' => :'String',
120
+ :'personal_identifier' => :'String',
121
+ :'bank_account_number' => :'String',
122
+ :'out_of_date_conciliation' => :'BOOLEAN'
123
+
124
+ }
125
+ end
126
+
127
+ def initialize(attributes = {})
128
+ return if !attributes.is_a?(Hash) || attributes.empty?
129
+
130
+ # convert string to symbol for hash key
131
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
132
+
133
+
134
+ if attributes[:'payment_id']
135
+ self.payment_id = attributes[:'payment_id']
136
+ end
137
+
138
+ if attributes[:'payment_url']
139
+ self.payment_url = attributes[:'payment_url']
140
+ end
141
+
142
+ if attributes[:'simplified_transfer_url']
143
+ self.simplified_transfer_url = attributes[:'simplified_transfer_url']
144
+ end
145
+
146
+ if attributes[:'transfer_url']
147
+ self.transfer_url = attributes[:'transfer_url']
148
+ end
149
+
150
+ if attributes[:'app_url']
151
+ self.app_url = attributes[:'app_url']
152
+ end
153
+
154
+ if attributes[:'ready_for_terminal']
155
+ self.ready_for_terminal = attributes[:'ready_for_terminal']
156
+ end
157
+
158
+ if attributes[:'subject']
159
+ self.subject = attributes[:'subject']
160
+ end
161
+
162
+ if attributes[:'amount']
163
+ self.amount = attributes[:'amount']
164
+ end
165
+
166
+ if attributes[:'currency']
167
+ self.currency = attributes[:'currency']
168
+ end
169
+
170
+ if attributes[:'status']
171
+ self.status = attributes[:'status']
172
+ end
173
+
174
+ if attributes[:'status_detail']
175
+ self.status_detail = attributes[:'status_detail']
176
+ end
177
+
178
+ if attributes[:'body']
179
+ self.body = attributes[:'body']
180
+ end
181
+
182
+ if attributes[:'picture_url']
183
+ self.picture_url = attributes[:'picture_url']
184
+ end
185
+
186
+ if attributes[:'receipt_url']
187
+ self.receipt_url = attributes[:'receipt_url']
188
+ end
189
+
190
+ if attributes[:'return_url']
191
+ self.return_url = attributes[:'return_url']
192
+ end
193
+
194
+ if attributes[:'cancel_url']
195
+ self.cancel_url = attributes[:'cancel_url']
196
+ end
197
+
198
+ if attributes[:'notify_url']
199
+ self.notify_url = attributes[:'notify_url']
200
+ end
201
+
202
+ if attributes[:'notify_api_version']
203
+ self.notify_api_version = attributes[:'notify_api_version']
204
+ end
205
+
206
+ if attributes[:'expires_date']
207
+ self.expires_date = attributes[:'expires_date']
208
+ end
209
+
210
+ if attributes[:'attachment_urls']
211
+ if (value = attributes[:'attachment_urls']).is_a?(Array)
212
+ self.attachment_urls = value
213
+ end
214
+ end
215
+
216
+ if attributes[:'bank']
217
+ self.bank = attributes[:'bank']
218
+ end
219
+
220
+ if attributes[:'bank_id']
221
+ self.bank_id = attributes[:'bank_id']
222
+ end
223
+
224
+ if attributes[:'payer_name']
225
+ self.payer_name = attributes[:'payer_name']
226
+ end
227
+
228
+ if attributes[:'payer_email']
229
+ self.payer_email = attributes[:'payer_email']
230
+ end
231
+
232
+ if attributes[:'personal_identifier']
233
+ self.personal_identifier = attributes[:'personal_identifier']
234
+ end
235
+
236
+ if attributes[:'bank_account_number']
237
+ self.bank_account_number = attributes[:'bank_account_number']
238
+ end
239
+
240
+ if attributes[:'out_of_date_conciliation']
241
+ self.out_of_date_conciliation = attributes[:'out_of_date_conciliation']
242
+ end
243
+
244
+ end
245
+
246
+ end
247
+ end