processout 2.20.0 → 2.21.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/.gitignore +52 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Dockerfile +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/Makefile +4 -0
- data/README.md +12 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/processout/activity.rb +206 -0
- data/lib/processout/addon.rb +401 -0
- data/lib/processout/alternative_merchant_certificate.rb +115 -0
- data/lib/processout/api_request.rb +295 -0
- data/lib/processout/api_version.rb +92 -0
- data/lib/processout/apple_pay_alternative_merchant_certificates.rb +121 -0
- data/lib/processout/balance.rb +92 -0
- data/lib/processout/balances.rb +111 -0
- data/lib/processout/card.rb +503 -0
- data/lib/processout/card_information.rb +164 -0
- data/lib/processout/coupon.rb +352 -0
- data/lib/processout/customer.rb +755 -0
- data/lib/processout/customer_action.rb +81 -0
- data/lib/processout/discount.rb +360 -0
- data/lib/processout/dunning_action.rb +81 -0
- data/lib/processout/errors/authentication_error.rb +9 -0
- data/lib/processout/errors/generic_error.rb +9 -0
- data/lib/processout/errors/internal_error.rb +9 -0
- data/lib/processout/errors/notfound_error.rb +9 -0
- data/lib/processout/errors/validation_error.rb +9 -0
- data/lib/processout/event.rb +237 -0
- data/lib/processout/gateway.rb +210 -0
- data/lib/processout/gateway_configuration.rb +346 -0
- data/lib/processout/gateway_request.rb +26 -0
- data/lib/processout/invoice.rb +984 -0
- data/lib/processout/invoice_detail.rb +235 -0
- data/lib/processout/invoice_device.rb +92 -0
- data/lib/processout/invoice_external_fraud_tools.rb +70 -0
- data/lib/processout/invoice_risk.rb +81 -0
- data/lib/processout/invoice_shipping.rb +202 -0
- data/lib/processout/invoice_tax.rb +81 -0
- data/lib/processout/networking/request.rb +102 -0
- data/lib/processout/networking/response.rb +67 -0
- data/lib/processout/payment_data_network_authentication.rb +70 -0
- data/lib/processout/payment_data_three_ds_authentication.rb +70 -0
- data/lib/processout/payment_data_three_ds_request.rb +103 -0
- data/lib/processout/payout.rb +379 -0
- data/lib/processout/payout_item.rb +238 -0
- data/lib/processout/plan.rb +368 -0
- data/lib/processout/product.rb +368 -0
- data/lib/processout/project.rb +353 -0
- data/lib/processout/refund.rb +277 -0
- data/lib/processout/subscription.rb +910 -0
- data/lib/processout/three_ds.rb +158 -0
- data/lib/processout/token.rb +493 -0
- data/lib/processout/transaction.rb +905 -0
- data/lib/processout/transaction_operation.rb +418 -0
- data/lib/processout/version.rb +3 -0
- data/lib/processout/webhook.rb +237 -0
- data/lib/processout/webhook_endpoint.rb +149 -0
- data/lib/processout.rb +263 -0
- data/processout.gemspec +26 -0
- metadata +66 -3
@@ -0,0 +1,235 @@
|
|
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 InvoiceDetail
|
10
|
+
|
11
|
+
attr_reader :id
|
12
|
+
attr_reader :name
|
13
|
+
attr_reader :type
|
14
|
+
attr_reader :amount
|
15
|
+
attr_reader :quantity
|
16
|
+
attr_reader :metadata
|
17
|
+
attr_reader :reference
|
18
|
+
attr_reader :description
|
19
|
+
attr_reader :brand
|
20
|
+
attr_reader :model
|
21
|
+
attr_reader :discount_amount
|
22
|
+
attr_reader :condition
|
23
|
+
attr_reader :marketplace_merchant
|
24
|
+
attr_reader :marketplace_merchant_is_business
|
25
|
+
attr_reader :marketplace_merchant_created_at
|
26
|
+
attr_reader :category
|
27
|
+
|
28
|
+
|
29
|
+
def id=(val)
|
30
|
+
@id = val
|
31
|
+
end
|
32
|
+
|
33
|
+
def name=(val)
|
34
|
+
@name = val
|
35
|
+
end
|
36
|
+
|
37
|
+
def type=(val)
|
38
|
+
@type = val
|
39
|
+
end
|
40
|
+
|
41
|
+
def amount=(val)
|
42
|
+
@amount = val
|
43
|
+
end
|
44
|
+
|
45
|
+
def quantity=(val)
|
46
|
+
@quantity = val
|
47
|
+
end
|
48
|
+
|
49
|
+
def metadata=(val)
|
50
|
+
@metadata = val
|
51
|
+
end
|
52
|
+
|
53
|
+
def reference=(val)
|
54
|
+
@reference = val
|
55
|
+
end
|
56
|
+
|
57
|
+
def description=(val)
|
58
|
+
@description = val
|
59
|
+
end
|
60
|
+
|
61
|
+
def brand=(val)
|
62
|
+
@brand = val
|
63
|
+
end
|
64
|
+
|
65
|
+
def model=(val)
|
66
|
+
@model = val
|
67
|
+
end
|
68
|
+
|
69
|
+
def discount_amount=(val)
|
70
|
+
@discount_amount = val
|
71
|
+
end
|
72
|
+
|
73
|
+
def condition=(val)
|
74
|
+
@condition = val
|
75
|
+
end
|
76
|
+
|
77
|
+
def marketplace_merchant=(val)
|
78
|
+
@marketplace_merchant = val
|
79
|
+
end
|
80
|
+
|
81
|
+
def marketplace_merchant_is_business=(val)
|
82
|
+
@marketplace_merchant_is_business = val
|
83
|
+
end
|
84
|
+
|
85
|
+
def marketplace_merchant_created_at=(val)
|
86
|
+
@marketplace_merchant_created_at = val
|
87
|
+
end
|
88
|
+
|
89
|
+
def category=(val)
|
90
|
+
@category = val
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
# Initializes the InvoiceDetail object
|
95
|
+
# Params:
|
96
|
+
# +client+:: +ProcessOut+ client instance
|
97
|
+
# +data+:: data that can be used to fill the object
|
98
|
+
def initialize(client, data = {})
|
99
|
+
@client = client
|
100
|
+
|
101
|
+
self.id = data.fetch(:id, nil)
|
102
|
+
self.name = data.fetch(:name, nil)
|
103
|
+
self.type = data.fetch(:type, nil)
|
104
|
+
self.amount = data.fetch(:amount, nil)
|
105
|
+
self.quantity = data.fetch(:quantity, nil)
|
106
|
+
self.metadata = data.fetch(:metadata, nil)
|
107
|
+
self.reference = data.fetch(:reference, nil)
|
108
|
+
self.description = data.fetch(:description, nil)
|
109
|
+
self.brand = data.fetch(:brand, nil)
|
110
|
+
self.model = data.fetch(:model, nil)
|
111
|
+
self.discount_amount = data.fetch(:discount_amount, nil)
|
112
|
+
self.condition = data.fetch(:condition, nil)
|
113
|
+
self.marketplace_merchant = data.fetch(:marketplace_merchant, nil)
|
114
|
+
self.marketplace_merchant_is_business = data.fetch(:marketplace_merchant_is_business, nil)
|
115
|
+
self.marketplace_merchant_created_at = data.fetch(:marketplace_merchant_created_at, nil)
|
116
|
+
self.category = data.fetch(:category, nil)
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
# Create a new InvoiceDetail using the current client
|
121
|
+
def new(data = {})
|
122
|
+
InvoiceDetail.new(@client, data)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Overrides the JSON marshaller to only send the fields we want
|
126
|
+
def to_json(options)
|
127
|
+
{
|
128
|
+
"id": self.id,
|
129
|
+
"name": self.name,
|
130
|
+
"type": self.type,
|
131
|
+
"amount": self.amount,
|
132
|
+
"quantity": self.quantity,
|
133
|
+
"metadata": self.metadata,
|
134
|
+
"reference": self.reference,
|
135
|
+
"description": self.description,
|
136
|
+
"brand": self.brand,
|
137
|
+
"model": self.model,
|
138
|
+
"discount_amount": self.discount_amount,
|
139
|
+
"condition": self.condition,
|
140
|
+
"marketplace_merchant": self.marketplace_merchant,
|
141
|
+
"marketplace_merchant_is_business": self.marketplace_merchant_is_business,
|
142
|
+
"marketplace_merchant_created_at": self.marketplace_merchant_created_at,
|
143
|
+
"category": self.category,
|
144
|
+
}.to_json
|
145
|
+
end
|
146
|
+
|
147
|
+
# Fills the object with data coming from the API
|
148
|
+
# Params:
|
149
|
+
# +data+:: +Hash+ of data coming from the API
|
150
|
+
def fill_with_data(data)
|
151
|
+
if data.nil?
|
152
|
+
return self
|
153
|
+
end
|
154
|
+
if data.include? "id"
|
155
|
+
self.id = data["id"]
|
156
|
+
end
|
157
|
+
if data.include? "name"
|
158
|
+
self.name = data["name"]
|
159
|
+
end
|
160
|
+
if data.include? "type"
|
161
|
+
self.type = data["type"]
|
162
|
+
end
|
163
|
+
if data.include? "amount"
|
164
|
+
self.amount = data["amount"]
|
165
|
+
end
|
166
|
+
if data.include? "quantity"
|
167
|
+
self.quantity = data["quantity"]
|
168
|
+
end
|
169
|
+
if data.include? "metadata"
|
170
|
+
self.metadata = data["metadata"]
|
171
|
+
end
|
172
|
+
if data.include? "reference"
|
173
|
+
self.reference = data["reference"]
|
174
|
+
end
|
175
|
+
if data.include? "description"
|
176
|
+
self.description = data["description"]
|
177
|
+
end
|
178
|
+
if data.include? "brand"
|
179
|
+
self.brand = data["brand"]
|
180
|
+
end
|
181
|
+
if data.include? "model"
|
182
|
+
self.model = data["model"]
|
183
|
+
end
|
184
|
+
if data.include? "discount_amount"
|
185
|
+
self.discount_amount = data["discount_amount"]
|
186
|
+
end
|
187
|
+
if data.include? "condition"
|
188
|
+
self.condition = data["condition"]
|
189
|
+
end
|
190
|
+
if data.include? "marketplace_merchant"
|
191
|
+
self.marketplace_merchant = data["marketplace_merchant"]
|
192
|
+
end
|
193
|
+
if data.include? "marketplace_merchant_is_business"
|
194
|
+
self.marketplace_merchant_is_business = data["marketplace_merchant_is_business"]
|
195
|
+
end
|
196
|
+
if data.include? "marketplace_merchant_created_at"
|
197
|
+
self.marketplace_merchant_created_at = data["marketplace_merchant_created_at"]
|
198
|
+
end
|
199
|
+
if data.include? "category"
|
200
|
+
self.category = data["category"]
|
201
|
+
end
|
202
|
+
|
203
|
+
self
|
204
|
+
end
|
205
|
+
|
206
|
+
# Prefills the object with the data passed as parameters
|
207
|
+
# Params:
|
208
|
+
# +data+:: +Hash+ of data
|
209
|
+
def prefill(data)
|
210
|
+
if data.nil?
|
211
|
+
return self
|
212
|
+
end
|
213
|
+
self.id = data.fetch(:id, self.id)
|
214
|
+
self.name = data.fetch(:name, self.name)
|
215
|
+
self.type = data.fetch(:type, self.type)
|
216
|
+
self.amount = data.fetch(:amount, self.amount)
|
217
|
+
self.quantity = data.fetch(:quantity, self.quantity)
|
218
|
+
self.metadata = data.fetch(:metadata, self.metadata)
|
219
|
+
self.reference = data.fetch(:reference, self.reference)
|
220
|
+
self.description = data.fetch(:description, self.description)
|
221
|
+
self.brand = data.fetch(:brand, self.brand)
|
222
|
+
self.model = data.fetch(:model, self.model)
|
223
|
+
self.discount_amount = data.fetch(:discount_amount, self.discount_amount)
|
224
|
+
self.condition = data.fetch(:condition, self.condition)
|
225
|
+
self.marketplace_merchant = data.fetch(:marketplace_merchant, self.marketplace_merchant)
|
226
|
+
self.marketplace_merchant_is_business = data.fetch(:marketplace_merchant_is_business, self.marketplace_merchant_is_business)
|
227
|
+
self.marketplace_merchant_created_at = data.fetch(:marketplace_merchant_created_at, self.marketplace_merchant_created_at)
|
228
|
+
self.category = data.fetch(:category, self.category)
|
229
|
+
|
230
|
+
self
|
231
|
+
end
|
232
|
+
|
233
|
+
|
234
|
+
end
|
235
|
+
end
|
@@ -0,0 +1,92 @@
|
|
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 InvoiceDevice
|
10
|
+
|
11
|
+
attr_reader :channel
|
12
|
+
attr_reader :ip_address
|
13
|
+
attr_reader :id
|
14
|
+
|
15
|
+
|
16
|
+
def channel=(val)
|
17
|
+
@channel = val
|
18
|
+
end
|
19
|
+
|
20
|
+
def ip_address=(val)
|
21
|
+
@ip_address = val
|
22
|
+
end
|
23
|
+
|
24
|
+
def id=(val)
|
25
|
+
@id = val
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# Initializes the InvoiceDevice object
|
30
|
+
# Params:
|
31
|
+
# +client+:: +ProcessOut+ client instance
|
32
|
+
# +data+:: data that can be used to fill the object
|
33
|
+
def initialize(client, data = {})
|
34
|
+
@client = client
|
35
|
+
|
36
|
+
self.channel = data.fetch(:channel, nil)
|
37
|
+
self.ip_address = data.fetch(:ip_address, nil)
|
38
|
+
self.id = data.fetch(:id, nil)
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
# Create a new InvoiceDevice using the current client
|
43
|
+
def new(data = {})
|
44
|
+
InvoiceDevice.new(@client, data)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Overrides the JSON marshaller to only send the fields we want
|
48
|
+
def to_json(options)
|
49
|
+
{
|
50
|
+
"channel": self.channel,
|
51
|
+
"ip_address": self.ip_address,
|
52
|
+
"id": self.id,
|
53
|
+
}.to_json
|
54
|
+
end
|
55
|
+
|
56
|
+
# Fills the object with data coming from the API
|
57
|
+
# Params:
|
58
|
+
# +data+:: +Hash+ of data coming from the API
|
59
|
+
def fill_with_data(data)
|
60
|
+
if data.nil?
|
61
|
+
return self
|
62
|
+
end
|
63
|
+
if data.include? "channel"
|
64
|
+
self.channel = data["channel"]
|
65
|
+
end
|
66
|
+
if data.include? "ip_address"
|
67
|
+
self.ip_address = data["ip_address"]
|
68
|
+
end
|
69
|
+
if data.include? "id"
|
70
|
+
self.id = data["id"]
|
71
|
+
end
|
72
|
+
|
73
|
+
self
|
74
|
+
end
|
75
|
+
|
76
|
+
# Prefills the object with the data passed as parameters
|
77
|
+
# Params:
|
78
|
+
# +data+:: +Hash+ of data
|
79
|
+
def prefill(data)
|
80
|
+
if data.nil?
|
81
|
+
return self
|
82
|
+
end
|
83
|
+
self.channel = data.fetch(:channel, self.channel)
|
84
|
+
self.ip_address = data.fetch(:ip_address, self.ip_address)
|
85
|
+
self.id = data.fetch(:id, self.id)
|
86
|
+
|
87
|
+
self
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,70 @@
|
|
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 InvoiceExternalFraudTools
|
10
|
+
|
11
|
+
attr_reader :forter
|
12
|
+
|
13
|
+
|
14
|
+
def forter=(val)
|
15
|
+
@forter = val
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
# Initializes the InvoiceExternalFraudTools object
|
20
|
+
# Params:
|
21
|
+
# +client+:: +ProcessOut+ client instance
|
22
|
+
# +data+:: data that can be used to fill the object
|
23
|
+
def initialize(client, data = {})
|
24
|
+
@client = client
|
25
|
+
|
26
|
+
self.forter = data.fetch(:forter, nil)
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
# Create a new InvoiceExternalFraudTools using the current client
|
31
|
+
def new(data = {})
|
32
|
+
InvoiceExternalFraudTools.new(@client, data)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Overrides the JSON marshaller to only send the fields we want
|
36
|
+
def to_json(options)
|
37
|
+
{
|
38
|
+
"forter": self.forter,
|
39
|
+
}.to_json
|
40
|
+
end
|
41
|
+
|
42
|
+
# Fills the object with data coming from the API
|
43
|
+
# Params:
|
44
|
+
# +data+:: +Hash+ of data coming from the API
|
45
|
+
def fill_with_data(data)
|
46
|
+
if data.nil?
|
47
|
+
return self
|
48
|
+
end
|
49
|
+
if data.include? "forter"
|
50
|
+
self.forter = data["forter"]
|
51
|
+
end
|
52
|
+
|
53
|
+
self
|
54
|
+
end
|
55
|
+
|
56
|
+
# Prefills the object with the data passed as parameters
|
57
|
+
# Params:
|
58
|
+
# +data+:: +Hash+ of data
|
59
|
+
def prefill(data)
|
60
|
+
if data.nil?
|
61
|
+
return self
|
62
|
+
end
|
63
|
+
self.forter = data.fetch(:forter, self.forter)
|
64
|
+
|
65
|
+
self
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,81 @@
|
|
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 InvoiceRisk
|
10
|
+
|
11
|
+
attr_reader :score
|
12
|
+
attr_reader :is_legit
|
13
|
+
|
14
|
+
|
15
|
+
def score=(val)
|
16
|
+
@score = val
|
17
|
+
end
|
18
|
+
|
19
|
+
def is_legit=(val)
|
20
|
+
@is_legit = val
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# Initializes the InvoiceRisk object
|
25
|
+
# Params:
|
26
|
+
# +client+:: +ProcessOut+ client instance
|
27
|
+
# +data+:: data that can be used to fill the object
|
28
|
+
def initialize(client, data = {})
|
29
|
+
@client = client
|
30
|
+
|
31
|
+
self.score = data.fetch(:score, nil)
|
32
|
+
self.is_legit = data.fetch(:is_legit, nil)
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
# Create a new InvoiceRisk using the current client
|
37
|
+
def new(data = {})
|
38
|
+
InvoiceRisk.new(@client, data)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Overrides the JSON marshaller to only send the fields we want
|
42
|
+
def to_json(options)
|
43
|
+
{
|
44
|
+
"score": self.score,
|
45
|
+
"is_legit": self.is_legit,
|
46
|
+
}.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
# Fills the object with data coming from the API
|
50
|
+
# Params:
|
51
|
+
# +data+:: +Hash+ of data coming from the API
|
52
|
+
def fill_with_data(data)
|
53
|
+
if data.nil?
|
54
|
+
return self
|
55
|
+
end
|
56
|
+
if data.include? "score"
|
57
|
+
self.score = data["score"]
|
58
|
+
end
|
59
|
+
if data.include? "is_legit"
|
60
|
+
self.is_legit = data["is_legit"]
|
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.score = data.fetch(:score, self.score)
|
74
|
+
self.is_legit = data.fetch(:is_legit, self.is_legit)
|
75
|
+
|
76
|
+
self
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,202 @@
|
|
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 InvoiceShipping
|
10
|
+
|
11
|
+
attr_reader :amount
|
12
|
+
attr_reader :method
|
13
|
+
attr_reader :provider
|
14
|
+
attr_reader :delay
|
15
|
+
attr_reader :address1
|
16
|
+
attr_reader :address2
|
17
|
+
attr_reader :city
|
18
|
+
attr_reader :state
|
19
|
+
attr_reader :country_code
|
20
|
+
attr_reader :zip
|
21
|
+
attr_reader :phone_number
|
22
|
+
attr_reader :expects_shipping_at
|
23
|
+
attr_reader :relay_store_name
|
24
|
+
|
25
|
+
|
26
|
+
def amount=(val)
|
27
|
+
@amount = val
|
28
|
+
end
|
29
|
+
|
30
|
+
def method=(val)
|
31
|
+
@method = val
|
32
|
+
end
|
33
|
+
|
34
|
+
def provider=(val)
|
35
|
+
@provider = val
|
36
|
+
end
|
37
|
+
|
38
|
+
def delay=(val)
|
39
|
+
@delay = val
|
40
|
+
end
|
41
|
+
|
42
|
+
def address1=(val)
|
43
|
+
@address1 = val
|
44
|
+
end
|
45
|
+
|
46
|
+
def address2=(val)
|
47
|
+
@address2 = val
|
48
|
+
end
|
49
|
+
|
50
|
+
def city=(val)
|
51
|
+
@city = val
|
52
|
+
end
|
53
|
+
|
54
|
+
def state=(val)
|
55
|
+
@state = val
|
56
|
+
end
|
57
|
+
|
58
|
+
def country_code=(val)
|
59
|
+
@country_code = val
|
60
|
+
end
|
61
|
+
|
62
|
+
def zip=(val)
|
63
|
+
@zip = val
|
64
|
+
end
|
65
|
+
|
66
|
+
def phone_number=(val)
|
67
|
+
@phone_number = val
|
68
|
+
end
|
69
|
+
|
70
|
+
def expects_shipping_at=(val)
|
71
|
+
@expects_shipping_at = val
|
72
|
+
end
|
73
|
+
|
74
|
+
def relay_store_name=(val)
|
75
|
+
@relay_store_name = val
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
# Initializes the InvoiceShipping object
|
80
|
+
# Params:
|
81
|
+
# +client+:: +ProcessOut+ client instance
|
82
|
+
# +data+:: data that can be used to fill the object
|
83
|
+
def initialize(client, data = {})
|
84
|
+
@client = client
|
85
|
+
|
86
|
+
self.amount = data.fetch(:amount, nil)
|
87
|
+
self.method = data.fetch(:method, nil)
|
88
|
+
self.provider = data.fetch(:provider, nil)
|
89
|
+
self.delay = data.fetch(:delay, nil)
|
90
|
+
self.address1 = data.fetch(:address1, nil)
|
91
|
+
self.address2 = data.fetch(:address2, nil)
|
92
|
+
self.city = data.fetch(:city, nil)
|
93
|
+
self.state = data.fetch(:state, nil)
|
94
|
+
self.country_code = data.fetch(:country_code, nil)
|
95
|
+
self.zip = data.fetch(:zip, nil)
|
96
|
+
self.phone_number = data.fetch(:phone_number, nil)
|
97
|
+
self.expects_shipping_at = data.fetch(:expects_shipping_at, nil)
|
98
|
+
self.relay_store_name = data.fetch(:relay_store_name, nil)
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
# Create a new InvoiceShipping using the current client
|
103
|
+
def new(data = {})
|
104
|
+
InvoiceShipping.new(@client, data)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Overrides the JSON marshaller to only send the fields we want
|
108
|
+
def to_json(options)
|
109
|
+
{
|
110
|
+
"amount": self.amount,
|
111
|
+
"method": self.method,
|
112
|
+
"provider": self.provider,
|
113
|
+
"delay": self.delay,
|
114
|
+
"address1": self.address1,
|
115
|
+
"address2": self.address2,
|
116
|
+
"city": self.city,
|
117
|
+
"state": self.state,
|
118
|
+
"country_code": self.country_code,
|
119
|
+
"zip": self.zip,
|
120
|
+
"phone_number": self.phone_number,
|
121
|
+
"expects_shipping_at": self.expects_shipping_at,
|
122
|
+
"relay_store_name": self.relay_store_name,
|
123
|
+
}.to_json
|
124
|
+
end
|
125
|
+
|
126
|
+
# Fills the object with data coming from the API
|
127
|
+
# Params:
|
128
|
+
# +data+:: +Hash+ of data coming from the API
|
129
|
+
def fill_with_data(data)
|
130
|
+
if data.nil?
|
131
|
+
return self
|
132
|
+
end
|
133
|
+
if data.include? "amount"
|
134
|
+
self.amount = data["amount"]
|
135
|
+
end
|
136
|
+
if data.include? "method"
|
137
|
+
self.method = data["method"]
|
138
|
+
end
|
139
|
+
if data.include? "provider"
|
140
|
+
self.provider = data["provider"]
|
141
|
+
end
|
142
|
+
if data.include? "delay"
|
143
|
+
self.delay = data["delay"]
|
144
|
+
end
|
145
|
+
if data.include? "address1"
|
146
|
+
self.address1 = data["address1"]
|
147
|
+
end
|
148
|
+
if data.include? "address2"
|
149
|
+
self.address2 = data["address2"]
|
150
|
+
end
|
151
|
+
if data.include? "city"
|
152
|
+
self.city = data["city"]
|
153
|
+
end
|
154
|
+
if data.include? "state"
|
155
|
+
self.state = data["state"]
|
156
|
+
end
|
157
|
+
if data.include? "country_code"
|
158
|
+
self.country_code = data["country_code"]
|
159
|
+
end
|
160
|
+
if data.include? "zip"
|
161
|
+
self.zip = data["zip"]
|
162
|
+
end
|
163
|
+
if data.include? "phone_number"
|
164
|
+
self.phone_number = data["phone_number"]
|
165
|
+
end
|
166
|
+
if data.include? "expects_shipping_at"
|
167
|
+
self.expects_shipping_at = data["expects_shipping_at"]
|
168
|
+
end
|
169
|
+
if data.include? "relay_store_name"
|
170
|
+
self.relay_store_name = data["relay_store_name"]
|
171
|
+
end
|
172
|
+
|
173
|
+
self
|
174
|
+
end
|
175
|
+
|
176
|
+
# Prefills the object with the data passed as parameters
|
177
|
+
# Params:
|
178
|
+
# +data+:: +Hash+ of data
|
179
|
+
def prefill(data)
|
180
|
+
if data.nil?
|
181
|
+
return self
|
182
|
+
end
|
183
|
+
self.amount = data.fetch(:amount, self.amount)
|
184
|
+
self.method = data.fetch(:method, self.method)
|
185
|
+
self.provider = data.fetch(:provider, self.provider)
|
186
|
+
self.delay = data.fetch(:delay, self.delay)
|
187
|
+
self.address1 = data.fetch(:address1, self.address1)
|
188
|
+
self.address2 = data.fetch(:address2, self.address2)
|
189
|
+
self.city = data.fetch(:city, self.city)
|
190
|
+
self.state = data.fetch(:state, self.state)
|
191
|
+
self.country_code = data.fetch(:country_code, self.country_code)
|
192
|
+
self.zip = data.fetch(:zip, self.zip)
|
193
|
+
self.phone_number = data.fetch(:phone_number, self.phone_number)
|
194
|
+
self.expects_shipping_at = data.fetch(:expects_shipping_at, self.expects_shipping_at)
|
195
|
+
self.relay_store_name = data.fetch(:relay_store_name, self.relay_store_name)
|
196
|
+
|
197
|
+
self
|
198
|
+
end
|
199
|
+
|
200
|
+
|
201
|
+
end
|
202
|
+
end
|