processout 1.1.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/lib/processout.rb +12 -0
- data/lib/processout/card.rb +68 -0
- data/lib/processout/card_information.rb +140 -0
- data/lib/processout/discount.rb +10 -0
- data/lib/processout/invoice.rb +23 -24
- data/lib/processout/invoice_detail.rb +82 -0
- data/lib/processout/plan.rb +10 -0
- data/lib/processout/transaction.rb +20 -0
- data/lib/processout/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e1ba190f4190702ba5e558a6f8ab4cd0c56be4a
|
4
|
+
data.tar.gz: 9640c25a700233c8ada87f41165609bc8758af14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b09760c70439f6d2b51c6076490b0659de75d10af5c00c60830566c6e5e1eab4302ccaf897f59f10da5ceee4f3ac2411da1fdc516fa02c946d0e7317db9ed09b
|
7
|
+
data.tar.gz: ae613d8d3e19c635b04b12ceb8f8a8982c9827f135aef0aca9549214b826efa1df5892049a5e7451a049a80b093ef314e00f5688643f7b6e9eb3842340377a21
|
data/lib/processout.rb
CHANGED
@@ -2,6 +2,7 @@ require "processout/version"
|
|
2
2
|
require "processout/activity"
|
3
3
|
require "processout/authorization_request"
|
4
4
|
require "processout/card"
|
5
|
+
require "processout/card_information"
|
5
6
|
require "processout/coupon"
|
6
7
|
require "processout/customer"
|
7
8
|
require "processout/token"
|
@@ -10,6 +11,7 @@ require "processout/event"
|
|
10
11
|
require "processout/gateway"
|
11
12
|
require "processout/gateway_configuration"
|
12
13
|
require "processout/invoice"
|
14
|
+
require "processout/invoice_detail"
|
13
15
|
require "processout/customer_action"
|
14
16
|
require "processout/plan"
|
15
17
|
require "processout/product"
|
@@ -45,6 +47,11 @@ module ProcessOut
|
|
45
47
|
obj = Card.new(self, data)
|
46
48
|
end
|
47
49
|
|
50
|
+
# Create a new CardInformation instance
|
51
|
+
def card_information(data = {})
|
52
|
+
obj = CardInformation.new(self, data)
|
53
|
+
end
|
54
|
+
|
48
55
|
# Create a new Coupon instance
|
49
56
|
def coupon(data = {})
|
50
57
|
obj = Coupon.new(self, data)
|
@@ -85,6 +92,11 @@ module ProcessOut
|
|
85
92
|
obj = Invoice.new(self, data)
|
86
93
|
end
|
87
94
|
|
95
|
+
# Create a new InvoiceDetail instance
|
96
|
+
def invoice_detail(data = {})
|
97
|
+
obj = InvoiceDetail.new(self, data)
|
98
|
+
end
|
99
|
+
|
88
100
|
# Create a new CustomerAction instance
|
89
101
|
def customer_action(data = {})
|
90
102
|
obj = CustomerAction.new(self, data)
|
data/lib/processout/card.rb
CHANGED
@@ -13,6 +13,7 @@ module ProcessOut
|
|
13
13
|
attr_reader :type
|
14
14
|
attr_reader :bank_name
|
15
15
|
attr_reader :brand
|
16
|
+
attr_reader :country
|
16
17
|
attr_reader :iin
|
17
18
|
attr_reader :last_4_digits
|
18
19
|
attr_reader :exp_month
|
@@ -53,6 +54,10 @@ module ProcessOut
|
|
53
54
|
@brand = val
|
54
55
|
end
|
55
56
|
|
57
|
+
def country=(val)
|
58
|
+
@country = val
|
59
|
+
end
|
60
|
+
|
56
61
|
def iin=(val)
|
57
62
|
@iin = val
|
58
63
|
end
|
@@ -95,6 +100,7 @@ module ProcessOut
|
|
95
100
|
self.type = data.fetch(:type, nil)
|
96
101
|
self.bank_name = data.fetch(:bank_name, nil)
|
97
102
|
self.brand = data.fetch(:brand, nil)
|
103
|
+
self.country = data.fetch(:country, nil)
|
98
104
|
self.iin = data.fetch(:iin, nil)
|
99
105
|
self.last_4_digits = data.fetch(:last_4_digits, nil)
|
100
106
|
self.exp_month = data.fetch(:exp_month, nil)
|
@@ -135,6 +141,9 @@ module ProcessOut
|
|
135
141
|
if data.include? "brand"
|
136
142
|
self.brand = data["brand"]
|
137
143
|
end
|
144
|
+
if data.include? "country"
|
145
|
+
self.country = data["country"]
|
146
|
+
end
|
138
147
|
if data.include? "iin"
|
139
148
|
self.iin = data["iin"]
|
140
149
|
end
|
@@ -173,6 +182,7 @@ module ProcessOut
|
|
173
182
|
self.type = data.fetch(:type, self.type)
|
174
183
|
self.bank_name = data.fetch(:bank_name, self.bank_name)
|
175
184
|
self.brand = data.fetch(:brand, self.brand)
|
185
|
+
self.country = data.fetch(:country, self.country)
|
176
186
|
self.iin = data.fetch(:iin, self.iin)
|
177
187
|
self.last_4_digits = data.fetch(:last_4_digits, self.last_4_digits)
|
178
188
|
self.exp_month = data.fetch(:exp_month, self.exp_month)
|
@@ -184,6 +194,64 @@ module ProcessOut
|
|
184
194
|
self
|
185
195
|
end
|
186
196
|
|
197
|
+
# Get all the cards.
|
198
|
+
# Params:
|
199
|
+
# +options+:: +Hash+ of options
|
200
|
+
def all(options = {})
|
201
|
+
self.prefill(options)
|
202
|
+
|
203
|
+
request = Request.new(@client)
|
204
|
+
path = "/cards"
|
205
|
+
data = {
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
response = Response.new(request.get(path, data, options))
|
210
|
+
return_values = Array.new
|
211
|
+
|
212
|
+
a = Array.new
|
213
|
+
body = response.body
|
214
|
+
for v in body['cards']
|
215
|
+
tmp = Card.new(@client)
|
216
|
+
tmp.fill_with_data(v)
|
217
|
+
a.push(tmp)
|
218
|
+
end
|
219
|
+
|
220
|
+
return_values.push(a)
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
return_values[0]
|
225
|
+
end
|
226
|
+
|
227
|
+
# Find a card by its ID.
|
228
|
+
# Params:
|
229
|
+
# +card_id+:: ID of the card
|
230
|
+
# +options+:: +Hash+ of options
|
231
|
+
def find(card_id, options = {})
|
232
|
+
self.prefill(options)
|
233
|
+
|
234
|
+
request = Request.new(@client)
|
235
|
+
path = "/cards/" + CGI.escape(card_id) + ""
|
236
|
+
data = {
|
237
|
+
|
238
|
+
}
|
239
|
+
|
240
|
+
response = Response.new(request.get(path, data, options))
|
241
|
+
return_values = Array.new
|
242
|
+
|
243
|
+
body = response.body
|
244
|
+
body = body["card_information"]
|
245
|
+
|
246
|
+
|
247
|
+
obj = Card.new(@client)
|
248
|
+
return_values.push(obj.fill_with_data(body))
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
return_values[0]
|
253
|
+
end
|
254
|
+
|
187
255
|
|
188
256
|
end
|
189
257
|
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# The content of this file was automatically generated
|
2
|
+
|
3
|
+
require "cgi"
|
4
|
+
require "processout/networking/request"
|
5
|
+
require "processout/networking/response"
|
6
|
+
|
7
|
+
module ProcessOut
|
8
|
+
class CardInformation
|
9
|
+
|
10
|
+
attr_reader :iin
|
11
|
+
attr_reader :scheme
|
12
|
+
attr_reader :type
|
13
|
+
attr_reader :bank_name
|
14
|
+
attr_reader :brand
|
15
|
+
attr_reader :country
|
16
|
+
|
17
|
+
|
18
|
+
def iin=(val)
|
19
|
+
@iin = val
|
20
|
+
end
|
21
|
+
|
22
|
+
def scheme=(val)
|
23
|
+
@scheme = val
|
24
|
+
end
|
25
|
+
|
26
|
+
def type=(val)
|
27
|
+
@type = val
|
28
|
+
end
|
29
|
+
|
30
|
+
def bank_name=(val)
|
31
|
+
@bank_name = val
|
32
|
+
end
|
33
|
+
|
34
|
+
def brand=(val)
|
35
|
+
@brand = val
|
36
|
+
end
|
37
|
+
|
38
|
+
def country=(val)
|
39
|
+
@country = val
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# Initializes the CardInformation object
|
44
|
+
# Params:
|
45
|
+
# +client+:: +ProcessOut+ client instance
|
46
|
+
# +data+:: data that can be used to fill the object
|
47
|
+
def initialize(client, data = {})
|
48
|
+
@client = client
|
49
|
+
|
50
|
+
self.iin = data.fetch(:iin, nil)
|
51
|
+
self.scheme = data.fetch(:scheme, nil)
|
52
|
+
self.type = data.fetch(:type, nil)
|
53
|
+
self.bank_name = data.fetch(:bank_name, nil)
|
54
|
+
self.brand = data.fetch(:brand, nil)
|
55
|
+
self.country = data.fetch(:country, nil)
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
# Create a new CardInformation using the current client
|
60
|
+
def new(data = {})
|
61
|
+
CardInformation.new(@client, data)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Fills the object with data coming from the API
|
65
|
+
# Params:
|
66
|
+
# +data+:: +Hash+ of data coming from the API
|
67
|
+
def fill_with_data(data)
|
68
|
+
if data.nil?
|
69
|
+
return self
|
70
|
+
end
|
71
|
+
if data.include? "iin"
|
72
|
+
self.iin = data["iin"]
|
73
|
+
end
|
74
|
+
if data.include? "scheme"
|
75
|
+
self.scheme = data["scheme"]
|
76
|
+
end
|
77
|
+
if data.include? "type"
|
78
|
+
self.type = data["type"]
|
79
|
+
end
|
80
|
+
if data.include? "bank_name"
|
81
|
+
self.bank_name = data["bank_name"]
|
82
|
+
end
|
83
|
+
if data.include? "brand"
|
84
|
+
self.brand = data["brand"]
|
85
|
+
end
|
86
|
+
if data.include? "country"
|
87
|
+
self.country = data["country"]
|
88
|
+
end
|
89
|
+
|
90
|
+
self
|
91
|
+
end
|
92
|
+
|
93
|
+
# Prefills the object with the data passed as parameters
|
94
|
+
# Params:
|
95
|
+
# +data+:: +Hash+ of data
|
96
|
+
def prefill(data)
|
97
|
+
if data.nil?
|
98
|
+
return self
|
99
|
+
end
|
100
|
+
self.iin = data.fetch(:iin, self.iin)
|
101
|
+
self.scheme = data.fetch(:scheme, self.scheme)
|
102
|
+
self.type = data.fetch(:type, self.type)
|
103
|
+
self.bank_name = data.fetch(:bank_name, self.bank_name)
|
104
|
+
self.brand = data.fetch(:brand, self.brand)
|
105
|
+
self.country = data.fetch(:country, self.country)
|
106
|
+
|
107
|
+
self
|
108
|
+
end
|
109
|
+
|
110
|
+
# Fetch card information from the IIN.
|
111
|
+
# Params:
|
112
|
+
# +iin+:: IIN of the card (first 6 digits)
|
113
|
+
# +options+:: +Hash+ of options
|
114
|
+
def fetch(iin, options = {})
|
115
|
+
self.prefill(options)
|
116
|
+
|
117
|
+
request = Request.new(@client)
|
118
|
+
path = "/iins/" + CGI.escape(iin) + ""
|
119
|
+
data = {
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
response = Response.new(request.get(path, data, options))
|
124
|
+
return_values = Array.new
|
125
|
+
|
126
|
+
body = response.body
|
127
|
+
body = body["coupon"]
|
128
|
+
|
129
|
+
|
130
|
+
obj = CardInformation.new(@client)
|
131
|
+
return_values.push(obj.fill_with_data(body))
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
return_values[0]
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
end
|
140
|
+
end
|
data/lib/processout/discount.rb
CHANGED
@@ -12,6 +12,7 @@ module ProcessOut
|
|
12
12
|
attr_reader :subscription
|
13
13
|
attr_reader :coupon
|
14
14
|
attr_reader :amount
|
15
|
+
attr_reader :percent
|
15
16
|
attr_reader :expires_at
|
16
17
|
attr_reader :metadata
|
17
18
|
attr_reader :sandbox
|
@@ -59,6 +60,10 @@ module ProcessOut
|
|
59
60
|
@amount = val
|
60
61
|
end
|
61
62
|
|
63
|
+
def percent=(val)
|
64
|
+
@percent = val
|
65
|
+
end
|
66
|
+
|
62
67
|
def expires_at=(val)
|
63
68
|
@expires_at = val
|
64
69
|
end
|
@@ -88,6 +93,7 @@ module ProcessOut
|
|
88
93
|
self.subscription = data.fetch(:subscription, nil)
|
89
94
|
self.coupon = data.fetch(:coupon, nil)
|
90
95
|
self.amount = data.fetch(:amount, nil)
|
96
|
+
self.percent = data.fetch(:percent, nil)
|
91
97
|
self.expires_at = data.fetch(:expires_at, nil)
|
92
98
|
self.metadata = data.fetch(:metadata, nil)
|
93
99
|
self.sandbox = data.fetch(:sandbox, nil)
|
@@ -122,6 +128,9 @@ module ProcessOut
|
|
122
128
|
if data.include? "amount"
|
123
129
|
self.amount = data["amount"]
|
124
130
|
end
|
131
|
+
if data.include? "percent"
|
132
|
+
self.percent = data["percent"]
|
133
|
+
end
|
125
134
|
if data.include? "expires_at"
|
126
135
|
self.expires_at = data["expires_at"]
|
127
136
|
end
|
@@ -150,6 +159,7 @@ module ProcessOut
|
|
150
159
|
self.subscription = data.fetch(:subscription, self.subscription)
|
151
160
|
self.coupon = data.fetch(:coupon, self.coupon)
|
152
161
|
self.amount = data.fetch(:amount, self.amount)
|
162
|
+
self.percent = data.fetch(:percent, self.percent)
|
153
163
|
self.expires_at = data.fetch(:expires_at, self.expires_at)
|
154
164
|
self.metadata = data.fetch(:metadata, self.metadata)
|
155
165
|
self.sandbox = data.fetch(:sandbox, self.sandbox)
|
data/lib/processout/invoice.rb
CHANGED
@@ -12,6 +12,7 @@ module ProcessOut
|
|
12
12
|
attr_reader :transaction
|
13
13
|
attr_reader :customer
|
14
14
|
attr_reader :subscription
|
15
|
+
attr_reader :details
|
15
16
|
attr_reader :url
|
16
17
|
attr_reader :name
|
17
18
|
attr_reader :statement_descriptor
|
@@ -22,8 +23,6 @@ module ProcessOut
|
|
22
23
|
attr_reader :amount
|
23
24
|
attr_reader :currency
|
24
25
|
attr_reader :metadata
|
25
|
-
attr_reader :request_email
|
26
|
-
attr_reader :request_shipping
|
27
26
|
attr_reader :return_url
|
28
27
|
attr_reader :cancel_url
|
29
28
|
attr_reader :sandbox
|
@@ -78,6 +77,21 @@ module ProcessOut
|
|
78
77
|
|
79
78
|
end
|
80
79
|
|
80
|
+
def details=(val)
|
81
|
+
if val.length > 0 and val[0].instance_of? InvoiceDetail
|
82
|
+
@details = val
|
83
|
+
else
|
84
|
+
l = Array.new
|
85
|
+
for v in val
|
86
|
+
obj = InvoiceDetail.new(@client)
|
87
|
+
obj.fill_with_data(v)
|
88
|
+
l.push(obj)
|
89
|
+
end
|
90
|
+
@details = l
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
81
95
|
def url=(val)
|
82
96
|
@url = val
|
83
97
|
end
|
@@ -118,14 +132,6 @@ module ProcessOut
|
|
118
132
|
@metadata = val
|
119
133
|
end
|
120
134
|
|
121
|
-
def request_email=(val)
|
122
|
-
@request_email = val
|
123
|
-
end
|
124
|
-
|
125
|
-
def request_shipping=(val)
|
126
|
-
@request_shipping = val
|
127
|
-
end
|
128
|
-
|
129
135
|
def return_url=(val)
|
130
136
|
@return_url = val
|
131
137
|
end
|
@@ -155,6 +161,7 @@ module ProcessOut
|
|
155
161
|
self.transaction = data.fetch(:transaction, nil)
|
156
162
|
self.customer = data.fetch(:customer, nil)
|
157
163
|
self.subscription = data.fetch(:subscription, nil)
|
164
|
+
self.details = data.fetch(:details, nil)
|
158
165
|
self.url = data.fetch(:url, nil)
|
159
166
|
self.name = data.fetch(:name, nil)
|
160
167
|
self.statement_descriptor = data.fetch(:statement_descriptor, nil)
|
@@ -165,8 +172,6 @@ module ProcessOut
|
|
165
172
|
self.amount = data.fetch(:amount, nil)
|
166
173
|
self.currency = data.fetch(:currency, nil)
|
167
174
|
self.metadata = data.fetch(:metadata, nil)
|
168
|
-
self.request_email = data.fetch(:request_email, nil)
|
169
|
-
self.request_shipping = data.fetch(:request_shipping, nil)
|
170
175
|
self.return_url = data.fetch(:return_url, nil)
|
171
176
|
self.cancel_url = data.fetch(:cancel_url, nil)
|
172
177
|
self.sandbox = data.fetch(:sandbox, nil)
|
@@ -201,6 +206,9 @@ module ProcessOut
|
|
201
206
|
if data.include? "subscription"
|
202
207
|
self.subscription = data["subscription"]
|
203
208
|
end
|
209
|
+
if data.include? "details"
|
210
|
+
self.details = data["details"]
|
211
|
+
end
|
204
212
|
if data.include? "url"
|
205
213
|
self.url = data["url"]
|
206
214
|
end
|
@@ -231,12 +239,6 @@ module ProcessOut
|
|
231
239
|
if data.include? "metadata"
|
232
240
|
self.metadata = data["metadata"]
|
233
241
|
end
|
234
|
-
if data.include? "request_email"
|
235
|
-
self.request_email = data["request_email"]
|
236
|
-
end
|
237
|
-
if data.include? "request_shipping"
|
238
|
-
self.request_shipping = data["request_shipping"]
|
239
|
-
end
|
240
242
|
if data.include? "return_url"
|
241
243
|
self.return_url = data["return_url"]
|
242
244
|
end
|
@@ -265,6 +267,7 @@ module ProcessOut
|
|
265
267
|
self.transaction = data.fetch(:transaction, self.transaction)
|
266
268
|
self.customer = data.fetch(:customer, self.customer)
|
267
269
|
self.subscription = data.fetch(:subscription, self.subscription)
|
270
|
+
self.details = data.fetch(:details, self.details)
|
268
271
|
self.url = data.fetch(:url, self.url)
|
269
272
|
self.name = data.fetch(:name, self.name)
|
270
273
|
self.statement_descriptor = data.fetch(:statement_descriptor, self.statement_descriptor)
|
@@ -275,8 +278,6 @@ module ProcessOut
|
|
275
278
|
self.amount = data.fetch(:amount, self.amount)
|
276
279
|
self.currency = data.fetch(:currency, self.currency)
|
277
280
|
self.metadata = data.fetch(:metadata, self.metadata)
|
278
|
-
self.request_email = data.fetch(:request_email, self.request_email)
|
279
|
-
self.request_shipping = data.fetch(:request_shipping, self.request_shipping)
|
280
281
|
self.return_url = data.fetch(:return_url, self.return_url)
|
281
282
|
self.cancel_url = data.fetch(:cancel_url, self.cancel_url)
|
282
283
|
self.sandbox = data.fetch(:sandbox, self.sandbox)
|
@@ -479,13 +480,12 @@ module ProcessOut
|
|
479
480
|
"amount" => @amount,
|
480
481
|
"currency" => @currency,
|
481
482
|
"metadata" => @metadata,
|
483
|
+
"details" => @details,
|
482
484
|
"statement_descriptor" => @statement_descriptor,
|
483
485
|
"statement_descriptor_phone" => @statement_descriptor_phone,
|
484
486
|
"statement_descriptor_city" => @statement_descriptor_city,
|
485
487
|
"statement_descriptor_company" => @statement_descriptor_company,
|
486
488
|
"statement_descriptor_url" => @statement_descriptor_url,
|
487
|
-
"request_email" => @request_email,
|
488
|
-
"request_shipping" => @request_shipping,
|
489
489
|
"return_url" => @return_url,
|
490
490
|
"cancel_url" => @cancel_url,
|
491
491
|
"customer_id" => options.fetch(:customer_id, nil)
|
@@ -519,13 +519,12 @@ module ProcessOut
|
|
519
519
|
"amount" => @amount,
|
520
520
|
"currency" => @currency,
|
521
521
|
"metadata" => @metadata,
|
522
|
+
"details" => @details,
|
522
523
|
"statement_descriptor" => @statement_descriptor,
|
523
524
|
"statement_descriptor_phone" => @statement_descriptor_phone,
|
524
525
|
"statement_descriptor_city" => @statement_descriptor_city,
|
525
526
|
"statement_descriptor_company" => @statement_descriptor_company,
|
526
527
|
"statement_descriptor_url" => @statement_descriptor_url,
|
527
|
-
"request_email" => @request_email,
|
528
|
-
"request_shipping" => @request_shipping,
|
529
528
|
"return_url" => @return_url,
|
530
529
|
"cancel_url" => @cancel_url,
|
531
530
|
"customer_id" => customer_id
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# The content of this file was automatically generated
|
2
|
+
|
3
|
+
require "cgi"
|
4
|
+
require "processout/networking/request"
|
5
|
+
require "processout/networking/response"
|
6
|
+
|
7
|
+
module ProcessOut
|
8
|
+
class InvoiceDetail
|
9
|
+
|
10
|
+
attr_reader :type
|
11
|
+
attr_reader :amount
|
12
|
+
attr_reader :metadata
|
13
|
+
|
14
|
+
|
15
|
+
def type=(val)
|
16
|
+
@type = val
|
17
|
+
end
|
18
|
+
|
19
|
+
def amount=(val)
|
20
|
+
@amount = val
|
21
|
+
end
|
22
|
+
|
23
|
+
def metadata=(val)
|
24
|
+
@metadata = val
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
# Initializes the InvoiceDetail object
|
29
|
+
# Params:
|
30
|
+
# +client+:: +ProcessOut+ client instance
|
31
|
+
# +data+:: data that can be used to fill the object
|
32
|
+
def initialize(client, data = {})
|
33
|
+
@client = client
|
34
|
+
|
35
|
+
self.type = data.fetch(:type, nil)
|
36
|
+
self.amount = data.fetch(:amount, nil)
|
37
|
+
self.metadata = data.fetch(:metadata, nil)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
# Create a new InvoiceDetail using the current client
|
42
|
+
def new(data = {})
|
43
|
+
InvoiceDetail.new(@client, data)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Fills the object with data coming from the API
|
47
|
+
# Params:
|
48
|
+
# +data+:: +Hash+ of data coming from the API
|
49
|
+
def fill_with_data(data)
|
50
|
+
if data.nil?
|
51
|
+
return self
|
52
|
+
end
|
53
|
+
if data.include? "type"
|
54
|
+
self.type = data["type"]
|
55
|
+
end
|
56
|
+
if data.include? "amount"
|
57
|
+
self.amount = data["amount"]
|
58
|
+
end
|
59
|
+
if data.include? "metadata"
|
60
|
+
self.metadata = data["metadata"]
|
61
|
+
end
|
62
|
+
|
63
|
+
self
|
64
|
+
end
|
65
|
+
|
66
|
+
# Prefills the object with the data passed as parameters
|
67
|
+
# Params:
|
68
|
+
# +data+:: +Hash+ of data
|
69
|
+
def prefill(data)
|
70
|
+
if data.nil?
|
71
|
+
return self
|
72
|
+
end
|
73
|
+
self.type = data.fetch(:type, self.type)
|
74
|
+
self.amount = data.fetch(:amount, self.amount)
|
75
|
+
self.metadata = data.fetch(:metadata, self.metadata)
|
76
|
+
|
77
|
+
self
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
data/lib/processout/plan.rb
CHANGED
@@ -9,6 +9,7 @@ module ProcessOut
|
|
9
9
|
|
10
10
|
attr_reader :id
|
11
11
|
attr_reader :project
|
12
|
+
attr_reader :url
|
12
13
|
attr_reader :name
|
13
14
|
attr_reader :amount
|
14
15
|
attr_reader :currency
|
@@ -36,6 +37,10 @@ module ProcessOut
|
|
36
37
|
|
37
38
|
end
|
38
39
|
|
40
|
+
def url=(val)
|
41
|
+
@url = val
|
42
|
+
end
|
43
|
+
|
39
44
|
def name=(val)
|
40
45
|
@name = val
|
41
46
|
end
|
@@ -86,6 +91,7 @@ module ProcessOut
|
|
86
91
|
|
87
92
|
self.id = data.fetch(:id, nil)
|
88
93
|
self.project = data.fetch(:project, nil)
|
94
|
+
self.url = data.fetch(:url, nil)
|
89
95
|
self.name = data.fetch(:name, nil)
|
90
96
|
self.amount = data.fetch(:amount, nil)
|
91
97
|
self.currency = data.fetch(:currency, nil)
|
@@ -117,6 +123,9 @@ module ProcessOut
|
|
117
123
|
if data.include? "project"
|
118
124
|
self.project = data["project"]
|
119
125
|
end
|
126
|
+
if data.include? "url"
|
127
|
+
self.url = data["url"]
|
128
|
+
end
|
120
129
|
if data.include? "name"
|
121
130
|
self.name = data["name"]
|
122
131
|
end
|
@@ -160,6 +169,7 @@ module ProcessOut
|
|
160
169
|
end
|
161
170
|
self.id = data.fetch(:id, self.id)
|
162
171
|
self.project = data.fetch(:project, self.project)
|
172
|
+
self.url = data.fetch(:url, self.url)
|
163
173
|
self.name = data.fetch(:name, self.name)
|
164
174
|
self.amount = data.fetch(:amount, self.amount)
|
165
175
|
self.currency = data.fetch(:currency, self.currency)
|
@@ -21,6 +21,8 @@ module ProcessOut
|
|
21
21
|
attr_reader :authorized
|
22
22
|
attr_reader :captured
|
23
23
|
attr_reader :processout_fee
|
24
|
+
attr_reader :estimated_fee
|
25
|
+
attr_reader :gateway_fee
|
24
26
|
attr_reader :metadata
|
25
27
|
attr_reader :sandbox
|
26
28
|
attr_reader :created_at
|
@@ -117,6 +119,14 @@ module ProcessOut
|
|
117
119
|
@processout_fee = val
|
118
120
|
end
|
119
121
|
|
122
|
+
def estimated_fee=(val)
|
123
|
+
@estimated_fee = val
|
124
|
+
end
|
125
|
+
|
126
|
+
def gateway_fee=(val)
|
127
|
+
@gateway_fee = val
|
128
|
+
end
|
129
|
+
|
120
130
|
def metadata=(val)
|
121
131
|
@metadata = val
|
122
132
|
end
|
@@ -151,6 +161,8 @@ module ProcessOut
|
|
151
161
|
self.authorized = data.fetch(:authorized, nil)
|
152
162
|
self.captured = data.fetch(:captured, nil)
|
153
163
|
self.processout_fee = data.fetch(:processout_fee, nil)
|
164
|
+
self.estimated_fee = data.fetch(:estimated_fee, nil)
|
165
|
+
self.gateway_fee = data.fetch(:gateway_fee, nil)
|
154
166
|
self.metadata = data.fetch(:metadata, nil)
|
155
167
|
self.sandbox = data.fetch(:sandbox, nil)
|
156
168
|
self.created_at = data.fetch(:created_at, nil)
|
@@ -211,6 +223,12 @@ module ProcessOut
|
|
211
223
|
if data.include? "processout_fee"
|
212
224
|
self.processout_fee = data["processout_fee"]
|
213
225
|
end
|
226
|
+
if data.include? "estimated_fee"
|
227
|
+
self.estimated_fee = data["estimated_fee"]
|
228
|
+
end
|
229
|
+
if data.include? "gateway_fee"
|
230
|
+
self.gateway_fee = data["gateway_fee"]
|
231
|
+
end
|
214
232
|
if data.include? "metadata"
|
215
233
|
self.metadata = data["metadata"]
|
216
234
|
end
|
@@ -245,6 +263,8 @@ module ProcessOut
|
|
245
263
|
self.authorized = data.fetch(:authorized, self.authorized)
|
246
264
|
self.captured = data.fetch(:captured, self.captured)
|
247
265
|
self.processout_fee = data.fetch(:processout_fee, self.processout_fee)
|
266
|
+
self.estimated_fee = data.fetch(:estimated_fee, self.estimated_fee)
|
267
|
+
self.gateway_fee = data.fetch(:gateway_fee, self.gateway_fee)
|
248
268
|
self.metadata = data.fetch(:metadata, self.metadata)
|
249
269
|
self.sandbox = data.fetch(:sandbox, self.sandbox)
|
250
270
|
self.created_at = data.fetch(:created_at, self.created_at)
|
data/lib/processout/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: processout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel HUEZ
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/processout/activity.rb
|
73
73
|
- lib/processout/authorization_request.rb
|
74
74
|
- lib/processout/card.rb
|
75
|
+
- lib/processout/card_information.rb
|
75
76
|
- lib/processout/coupon.rb
|
76
77
|
- lib/processout/customer.rb
|
77
78
|
- lib/processout/customer_action.rb
|
@@ -85,6 +86,7 @@ files:
|
|
85
86
|
- lib/processout/gateway.rb
|
86
87
|
- lib/processout/gateway_configuration.rb
|
87
88
|
- lib/processout/invoice.rb
|
89
|
+
- lib/processout/invoice_detail.rb
|
88
90
|
- lib/processout/networking/request.rb
|
89
91
|
- lib/processout/networking/response.rb
|
90
92
|
- lib/processout/plan.rb
|