processout 2.28.0 → 2.30.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c7f68dd1c2ad91a3abcc9c4ebad513d00d8022c78e861173c0b215dcad99f2c
4
- data.tar.gz: d6bcdb8de73326652f745663fffd0069bfda7276eadd914512bbbcbaf4d08d3b
3
+ metadata.gz: 9daae4f6b38dea2683271dd9a4bbb57d54ce2cb08e457c8a62f19536e3ab3d37
4
+ data.tar.gz: 9b47f6293d6c347b5a5cc6a6cf9372ee4d9a97e2dc35f63c5666764f6635f327
5
5
  SHA512:
6
- metadata.gz: a5f99c4c073dc9b293160993deae41cf14cc4a6c9312f8fd4aacd503c6bf3bb3d24fd83208736f2bb1cbf8b0eeba1bd8b60bf3132993508bdb1322c20ced8839
7
- data.tar.gz: c9ca949e957f07e84c76ff47e8a6e151cefbf66464a39ee5f8bd16474334bbbd837119609293a523b3307c7048214f0d4764a6dc63be3069ac1772271df70a4f
6
+ metadata.gz: 43e1abcc1b8ab960f28889a95a157c97d66b400b72d44cecddf1724fea1658a2e79aab2cb067dcc9890fe5e7257b17b8577815a0bca64ad2f43754cc30c8c644
7
+ data.tar.gz: 6c36a1140484dfe0c759afb150cf76a63dcc35a342f1d39d18ac0137f6f87377514277bae7f32aec3f6fe3d3cadeb06729ee73dffeffeb06be6771e5f1ad3642
@@ -0,0 +1,125 @@
1
+ # The content of this file was automatically generated
2
+
3
+ require "cgi"
4
+ require "json"
5
+ require "processout/networking/request"
6
+ require "processout/networking/response"
7
+
8
+ module ProcessOut
9
+ class CardContact
10
+
11
+ attr_reader :address1
12
+ attr_reader :address2
13
+ attr_reader :city
14
+ attr_reader :state
15
+ attr_reader :country_code
16
+ attr_reader :zip
17
+
18
+
19
+ def address1=(val)
20
+ @address1 = val
21
+ end
22
+
23
+ def address2=(val)
24
+ @address2 = val
25
+ end
26
+
27
+ def city=(val)
28
+ @city = val
29
+ end
30
+
31
+ def state=(val)
32
+ @state = val
33
+ end
34
+
35
+ def country_code=(val)
36
+ @country_code = val
37
+ end
38
+
39
+ def zip=(val)
40
+ @zip = val
41
+ end
42
+
43
+
44
+ # Initializes the CardContact object
45
+ # Params:
46
+ # +client+:: +ProcessOut+ client instance
47
+ # +data+:: data that can be used to fill the object
48
+ def initialize(client, data = {})
49
+ @client = client
50
+
51
+ self.address1 = data.fetch(:address1, nil)
52
+ self.address2 = data.fetch(:address2, nil)
53
+ self.city = data.fetch(:city, nil)
54
+ self.state = data.fetch(:state, nil)
55
+ self.country_code = data.fetch(:country_code, nil)
56
+ self.zip = data.fetch(:zip, nil)
57
+
58
+ end
59
+
60
+ # Create a new CardContact using the current client
61
+ def new(data = {})
62
+ CardContact.new(@client, data)
63
+ end
64
+
65
+ # Overrides the JSON marshaller to only send the fields we want
66
+ def to_json(options)
67
+ {
68
+ "address1": self.address1,
69
+ "address2": self.address2,
70
+ "city": self.city,
71
+ "state": self.state,
72
+ "country_code": self.country_code,
73
+ "zip": self.zip,
74
+ }.to_json
75
+ end
76
+
77
+ # Fills the object with data coming from the API
78
+ # Params:
79
+ # +data+:: +Hash+ of data coming from the API
80
+ def fill_with_data(data)
81
+ if data.nil?
82
+ return self
83
+ end
84
+ if data.include? "address1"
85
+ self.address1 = data["address1"]
86
+ end
87
+ if data.include? "address2"
88
+ self.address2 = data["address2"]
89
+ end
90
+ if data.include? "city"
91
+ self.city = data["city"]
92
+ end
93
+ if data.include? "state"
94
+ self.state = data["state"]
95
+ end
96
+ if data.include? "country_code"
97
+ self.country_code = data["country_code"]
98
+ end
99
+ if data.include? "zip"
100
+ self.zip = data["zip"]
101
+ end
102
+
103
+ self
104
+ end
105
+
106
+ # Prefills the object with the data passed as parameters
107
+ # Params:
108
+ # +data+:: +Hash+ of data
109
+ def prefill(data)
110
+ if data.nil?
111
+ return self
112
+ end
113
+ self.address1 = data.fetch(:address1, self.address1)
114
+ self.address2 = data.fetch(:address2, self.address2)
115
+ self.city = data.fetch(:city, self.city)
116
+ self.state = data.fetch(:state, self.state)
117
+ self.country_code = data.fetch(:country_code, self.country_code)
118
+ self.zip = data.fetch(:zip, self.zip)
119
+
120
+ self
121
+ end
122
+
123
+
124
+ end
125
+ end
@@ -0,0 +1,324 @@
1
+ # The content of this file was automatically generated
2
+
3
+ require "cgi"
4
+ require "json"
5
+ require "processout/networking/request"
6
+ require "processout/networking/response"
7
+
8
+ module ProcessOut
9
+ class CardCreateRequest
10
+
11
+ attr_reader :device
12
+ attr_reader :name
13
+ attr_reader :number
14
+ attr_reader :exp_day
15
+ attr_reader :exp_month
16
+ attr_reader :exp_year
17
+ attr_reader :cvc2
18
+ attr_reader :preferred_scheme
19
+ attr_reader :metadata
20
+ attr_reader :token_type
21
+ attr_reader :eci
22
+ attr_reader :cryptogram
23
+ attr_reader :applepay_response
24
+ attr_reader :applepay_mid
25
+ attr_reader :payment_token
26
+ attr_reader :contact
27
+ attr_reader :shipping
28
+
29
+
30
+ def device=(val)
31
+ if val.nil?
32
+ @device = val
33
+ return
34
+ end
35
+
36
+ if val.instance_of? Device
37
+ @device = val
38
+ else
39
+ obj = Device.new(@client)
40
+ obj.fill_with_data(val)
41
+ @device = obj
42
+ end
43
+
44
+ end
45
+
46
+ def name=(val)
47
+ @name = val
48
+ end
49
+
50
+ def number=(val)
51
+ @number = val
52
+ end
53
+
54
+ def exp_day=(val)
55
+ @exp_day = val
56
+ end
57
+
58
+ def exp_month=(val)
59
+ @exp_month = val
60
+ end
61
+
62
+ def exp_year=(val)
63
+ @exp_year = val
64
+ end
65
+
66
+ def cvc2=(val)
67
+ @cvc2 = val
68
+ end
69
+
70
+ def preferred_scheme=(val)
71
+ @preferred_scheme = val
72
+ end
73
+
74
+ def metadata=(val)
75
+ @metadata = val
76
+ end
77
+
78
+ def token_type=(val)
79
+ @token_type = val
80
+ end
81
+
82
+ def eci=(val)
83
+ @eci = val
84
+ end
85
+
86
+ def cryptogram=(val)
87
+ @cryptogram = val
88
+ end
89
+
90
+ def applepay_response=(val)
91
+ @applepay_response = val
92
+ end
93
+
94
+ def applepay_mid=(val)
95
+ @applepay_mid = val
96
+ end
97
+
98
+ def payment_token=(val)
99
+ @payment_token = val
100
+ end
101
+
102
+ def contact=(val)
103
+ if val.nil?
104
+ @contact = val
105
+ return
106
+ end
107
+
108
+ if val.instance_of? CardContact
109
+ @contact = val
110
+ else
111
+ obj = CardContact.new(@client)
112
+ obj.fill_with_data(val)
113
+ @contact = obj
114
+ end
115
+
116
+ end
117
+
118
+ def shipping=(val)
119
+ if val.nil?
120
+ @shipping = val
121
+ return
122
+ end
123
+
124
+ if val.instance_of? CardShipping
125
+ @shipping = val
126
+ else
127
+ obj = CardShipping.new(@client)
128
+ obj.fill_with_data(val)
129
+ @shipping = obj
130
+ end
131
+
132
+ end
133
+
134
+
135
+ # Initializes the CardCreateRequest object
136
+ # Params:
137
+ # +client+:: +ProcessOut+ client instance
138
+ # +data+:: data that can be used to fill the object
139
+ def initialize(client, data = {})
140
+ @client = client
141
+
142
+ self.device = data.fetch(:device, nil)
143
+ self.name = data.fetch(:name, nil)
144
+ self.number = data.fetch(:number, nil)
145
+ self.exp_day = data.fetch(:exp_day, nil)
146
+ self.exp_month = data.fetch(:exp_month, nil)
147
+ self.exp_year = data.fetch(:exp_year, nil)
148
+ self.cvc2 = data.fetch(:cvc2, nil)
149
+ self.preferred_scheme = data.fetch(:preferred_scheme, nil)
150
+ self.metadata = data.fetch(:metadata, nil)
151
+ self.token_type = data.fetch(:token_type, nil)
152
+ self.eci = data.fetch(:eci, nil)
153
+ self.cryptogram = data.fetch(:cryptogram, nil)
154
+ self.applepay_response = data.fetch(:applepay_response, nil)
155
+ self.applepay_mid = data.fetch(:applepay_mid, nil)
156
+ self.payment_token = data.fetch(:payment_token, nil)
157
+ self.contact = data.fetch(:contact, nil)
158
+ self.shipping = data.fetch(:shipping, nil)
159
+
160
+ end
161
+
162
+ # Create a new CardCreateRequest using the current client
163
+ def new(data = {})
164
+ CardCreateRequest.new(@client, data)
165
+ end
166
+
167
+ # Overrides the JSON marshaller to only send the fields we want
168
+ def to_json(options)
169
+ {
170
+ "device": self.device,
171
+ "name": self.name,
172
+ "number": self.number,
173
+ "exp_day": self.exp_day,
174
+ "exp_month": self.exp_month,
175
+ "exp_year": self.exp_year,
176
+ "cvc2": self.cvc2,
177
+ "preferred_scheme": self.preferred_scheme,
178
+ "metadata": self.metadata,
179
+ "token_type": self.token_type,
180
+ "eci": self.eci,
181
+ "cryptogram": self.cryptogram,
182
+ "applepay_response": self.applepay_response,
183
+ "applepay_mid": self.applepay_mid,
184
+ "payment_token": self.payment_token,
185
+ "contact": self.contact,
186
+ "shipping": self.shipping,
187
+ }.to_json
188
+ end
189
+
190
+ # Fills the object with data coming from the API
191
+ # Params:
192
+ # +data+:: +Hash+ of data coming from the API
193
+ def fill_with_data(data)
194
+ if data.nil?
195
+ return self
196
+ end
197
+ if data.include? "device"
198
+ self.device = data["device"]
199
+ end
200
+ if data.include? "name"
201
+ self.name = data["name"]
202
+ end
203
+ if data.include? "number"
204
+ self.number = data["number"]
205
+ end
206
+ if data.include? "exp_day"
207
+ self.exp_day = data["exp_day"]
208
+ end
209
+ if data.include? "exp_month"
210
+ self.exp_month = data["exp_month"]
211
+ end
212
+ if data.include? "exp_year"
213
+ self.exp_year = data["exp_year"]
214
+ end
215
+ if data.include? "cvc2"
216
+ self.cvc2 = data["cvc2"]
217
+ end
218
+ if data.include? "preferred_scheme"
219
+ self.preferred_scheme = data["preferred_scheme"]
220
+ end
221
+ if data.include? "metadata"
222
+ self.metadata = data["metadata"]
223
+ end
224
+ if data.include? "token_type"
225
+ self.token_type = data["token_type"]
226
+ end
227
+ if data.include? "eci"
228
+ self.eci = data["eci"]
229
+ end
230
+ if data.include? "cryptogram"
231
+ self.cryptogram = data["cryptogram"]
232
+ end
233
+ if data.include? "applepay_response"
234
+ self.applepay_response = data["applepay_response"]
235
+ end
236
+ if data.include? "applepay_mid"
237
+ self.applepay_mid = data["applepay_mid"]
238
+ end
239
+ if data.include? "payment_token"
240
+ self.payment_token = data["payment_token"]
241
+ end
242
+ if data.include? "contact"
243
+ self.contact = data["contact"]
244
+ end
245
+ if data.include? "shipping"
246
+ self.shipping = data["shipping"]
247
+ end
248
+
249
+ self
250
+ end
251
+
252
+ # Prefills the object with the data passed as parameters
253
+ # Params:
254
+ # +data+:: +Hash+ of data
255
+ def prefill(data)
256
+ if data.nil?
257
+ return self
258
+ end
259
+ self.device = data.fetch(:device, self.device)
260
+ self.name = data.fetch(:name, self.name)
261
+ self.number = data.fetch(:number, self.number)
262
+ self.exp_day = data.fetch(:exp_day, self.exp_day)
263
+ self.exp_month = data.fetch(:exp_month, self.exp_month)
264
+ self.exp_year = data.fetch(:exp_year, self.exp_year)
265
+ self.cvc2 = data.fetch(:cvc2, self.cvc2)
266
+ self.preferred_scheme = data.fetch(:preferred_scheme, self.preferred_scheme)
267
+ self.metadata = data.fetch(:metadata, self.metadata)
268
+ self.token_type = data.fetch(:token_type, self.token_type)
269
+ self.eci = data.fetch(:eci, self.eci)
270
+ self.cryptogram = data.fetch(:cryptogram, self.cryptogram)
271
+ self.applepay_response = data.fetch(:applepay_response, self.applepay_response)
272
+ self.applepay_mid = data.fetch(:applepay_mid, self.applepay_mid)
273
+ self.payment_token = data.fetch(:payment_token, self.payment_token)
274
+ self.contact = data.fetch(:contact, self.contact)
275
+ self.shipping = data.fetch(:shipping, self.shipping)
276
+
277
+ self
278
+ end
279
+
280
+ # Create a new card.
281
+ # Params:
282
+ # +options+:: +Hash+ of options
283
+ def create(options = {})
284
+ self.prefill(options)
285
+
286
+ request = Request.new(@client)
287
+ path = "/cards"
288
+ data = {
289
+ "device" => @device,
290
+ "name" => @name,
291
+ "number" => @number,
292
+ "exp_day" => @exp_day,
293
+ "exp_month" => @exp_month,
294
+ "exp_year" => @exp_year,
295
+ "cvc2" => @cvc2,
296
+ "preferred_scheme" => @preferred_scheme,
297
+ "metadata" => @metadata,
298
+ "token_type" => @token_type,
299
+ "eci" => @eci,
300
+ "cryptogram" => @cryptogram,
301
+ "applepay_response" => @applepay_response,
302
+ "applepay_mid" => @applepay_mid,
303
+ "payment_token" => @payment_token,
304
+ "contact" => @contact,
305
+ "shipping" => @shipping
306
+ }
307
+
308
+ response = Response.new(request.post(path, data, options))
309
+ return_values = Array.new
310
+
311
+ body = response.body
312
+ body = body["card"]
313
+
314
+
315
+ return_values.push(self.fill_with_data(body))
316
+
317
+
318
+
319
+ return_values[0]
320
+ end
321
+
322
+
323
+ end
324
+ end
@@ -0,0 +1,148 @@
1
+ # The content of this file was automatically generated
2
+
3
+ require "cgi"
4
+ require "json"
5
+ require "processout/networking/request"
6
+ require "processout/networking/response"
7
+
8
+ module ProcessOut
9
+ class CardShipping
10
+
11
+ attr_reader :address1
12
+ attr_reader :address2
13
+ attr_reader :city
14
+ attr_reader :state
15
+ attr_reader :country_code
16
+ attr_reader :zip
17
+ attr_reader :phone
18
+
19
+
20
+ def address1=(val)
21
+ @address1 = val
22
+ end
23
+
24
+ def address2=(val)
25
+ @address2 = val
26
+ end
27
+
28
+ def city=(val)
29
+ @city = val
30
+ end
31
+
32
+ def state=(val)
33
+ @state = val
34
+ end
35
+
36
+ def country_code=(val)
37
+ @country_code = val
38
+ end
39
+
40
+ def zip=(val)
41
+ @zip = val
42
+ end
43
+
44
+ def phone=(val)
45
+ if val.nil?
46
+ @phone = val
47
+ return
48
+ end
49
+
50
+ if val.instance_of? Phone
51
+ @phone = val
52
+ else
53
+ obj = Phone.new(@client)
54
+ obj.fill_with_data(val)
55
+ @phone = obj
56
+ end
57
+
58
+ end
59
+
60
+
61
+ # Initializes the CardShipping object
62
+ # Params:
63
+ # +client+:: +ProcessOut+ client instance
64
+ # +data+:: data that can be used to fill the object
65
+ def initialize(client, data = {})
66
+ @client = client
67
+
68
+ self.address1 = data.fetch(:address1, nil)
69
+ self.address2 = data.fetch(:address2, nil)
70
+ self.city = data.fetch(:city, nil)
71
+ self.state = data.fetch(:state, nil)
72
+ self.country_code = data.fetch(:country_code, nil)
73
+ self.zip = data.fetch(:zip, nil)
74
+ self.phone = data.fetch(:phone, nil)
75
+
76
+ end
77
+
78
+ # Create a new CardShipping using the current client
79
+ def new(data = {})
80
+ CardShipping.new(@client, data)
81
+ end
82
+
83
+ # Overrides the JSON marshaller to only send the fields we want
84
+ def to_json(options)
85
+ {
86
+ "address1": self.address1,
87
+ "address2": self.address2,
88
+ "city": self.city,
89
+ "state": self.state,
90
+ "country_code": self.country_code,
91
+ "zip": self.zip,
92
+ "phone": self.phone,
93
+ }.to_json
94
+ end
95
+
96
+ # Fills the object with data coming from the API
97
+ # Params:
98
+ # +data+:: +Hash+ of data coming from the API
99
+ def fill_with_data(data)
100
+ if data.nil?
101
+ return self
102
+ end
103
+ if data.include? "address1"
104
+ self.address1 = data["address1"]
105
+ end
106
+ if data.include? "address2"
107
+ self.address2 = data["address2"]
108
+ end
109
+ if data.include? "city"
110
+ self.city = data["city"]
111
+ end
112
+ if data.include? "state"
113
+ self.state = data["state"]
114
+ end
115
+ if data.include? "country_code"
116
+ self.country_code = data["country_code"]
117
+ end
118
+ if data.include? "zip"
119
+ self.zip = data["zip"]
120
+ end
121
+ if data.include? "phone"
122
+ self.phone = data["phone"]
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Prefills the object with the data passed as parameters
129
+ # Params:
130
+ # +data+:: +Hash+ of data
131
+ def prefill(data)
132
+ if data.nil?
133
+ return self
134
+ end
135
+ self.address1 = data.fetch(:address1, self.address1)
136
+ self.address2 = data.fetch(:address2, self.address2)
137
+ self.city = data.fetch(:city, self.city)
138
+ self.state = data.fetch(:state, self.state)
139
+ self.country_code = data.fetch(:country_code, self.country_code)
140
+ self.zip = data.fetch(:zip, self.zip)
141
+ self.phone = data.fetch(:phone, self.phone)
142
+
143
+ self
144
+ end
145
+
146
+
147
+ end
148
+ end