Skip to content

Commit 0e62e76

Browse files
feat: add acquirer_name to transaction
1 parent d371b3e commit 0e62e76

File tree

8 files changed

+253
-3
lines changed

8 files changed

+253
-3
lines changed

lib/processout.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
require "processout/addon"
55
require "processout/api_request"
66
require "processout/api_version"
7+
require "processout/apple_pay_alternative_merchant_certificates"
8+
require "processout/alternative_merchant_certificate"
79
require "processout/balances"
810
require "processout/balance"
911
require "processout/card"
@@ -71,6 +73,16 @@ def api_version(data = {})
7173
obj = APIVersion.new(self, data)
7274
end
7375

76+
# Create a new ApplePayAlternativeMerchantCertificates instance
77+
def apple_pay_alternative_merchant_certificates(data = {})
78+
obj = ApplePayAlternativeMerchantCertificates.new(self, data)
79+
end
80+
81+
# Create a new AlternativeMerchantCertificate instance
82+
def alternative_merchant_certificate(data = {})
83+
obj = AlternativeMerchantCertificate.new(self, data)
84+
end
85+
7486
# Create a new Balances instance
7587
def balances(data = {})
7688
obj = Balances.new(self, data)
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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 AlternativeMerchantCertificate
10+
11+
attr_reader :id
12+
13+
14+
def id=(val)
15+
@id = val
16+
end
17+
18+
19+
# Initializes the AlternativeMerchantCertificate 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.id = data.fetch(:id, nil)
27+
28+
end
29+
30+
# Create a new AlternativeMerchantCertificate using the current client
31+
def new(data = {})
32+
AlternativeMerchantCertificate.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+
"id": self.id,
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? "id"
50+
self.id = data["id"]
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.id = data.fetch(:id, self.id)
64+
65+
self
66+
end
67+
68+
# Save new alternative apple pay certificates
69+
# Params:
70+
# +options+:: +Hash+ of options
71+
def save(options = {})
72+
self.prefill(options)
73+
74+
request = Request.new(@client)
75+
path = "/projects/applepay/alternative-merchant-certificates"
76+
data = {
77+
78+
}
79+
80+
response = Response.new(request.post(path, data, options))
81+
return_values = Array.new
82+
83+
body = response.body
84+
body = body["alternative_merchant_certificate"]
85+
alternative_merchant_certificate = AlternativeMerchantCertificate.new(@client)
86+
return_values.push(alternative_merchant_certificate.fill_with_data(body))
87+
88+
89+
return_values[0]
90+
end
91+
92+
93+
end
94+
end
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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 ApplePayAlternativeMerchantCertificates
10+
11+
attr_reader :alternative_merchant_certificates
12+
13+
14+
def alternative_merchant_certificates=(val)
15+
if val.nil?
16+
@alternative_merchant_certificates = []
17+
return
18+
end
19+
20+
if val.length > 0 and val[0].instance_of? AlternativeMerchantCertificate
21+
@alternative_merchant_certificates = val
22+
else
23+
l = Array.new
24+
for v in val
25+
obj = AlternativeMerchantCertificate.new(@client)
26+
obj.fill_with_data(v)
27+
l.push(obj)
28+
end
29+
@alternative_merchant_certificates = l
30+
end
31+
32+
end
33+
34+
35+
# Initializes the ApplePayAlternativeMerchantCertificates object
36+
# Params:
37+
# +client+:: +ProcessOut+ client instance
38+
# +data+:: data that can be used to fill the object
39+
def initialize(client, data = {})
40+
@client = client
41+
42+
self.alternative_merchant_certificates = data.fetch(:alternative_merchant_certificates, nil)
43+
44+
end
45+
46+
# Create a new ApplePayAlternativeMerchantCertificates using the current client
47+
def new(data = {})
48+
ApplePayAlternativeMerchantCertificates.new(@client, data)
49+
end
50+
51+
# Overrides the JSON marshaller to only send the fields we want
52+
def to_json(options)
53+
{
54+
"alternative_merchant_certificates": self.alternative_merchant_certificates,
55+
}.to_json
56+
end
57+
58+
# Fills the object with data coming from the API
59+
# Params:
60+
# +data+:: +Hash+ of data coming from the API
61+
def fill_with_data(data)
62+
if data.nil?
63+
return self
64+
end
65+
if data.include? "alternative_merchant_certificates"
66+
self.alternative_merchant_certificates = data["alternative_merchant_certificates"]
67+
end
68+
69+
self
70+
end
71+
72+
# Prefills the object with the data passed as parameters
73+
# Params:
74+
# +data+:: +Hash+ of data
75+
def prefill(data)
76+
if data.nil?
77+
return self
78+
end
79+
self.alternative_merchant_certificates = data.fetch(:alternative_merchant_certificates, self.alternative_merchant_certificates)
80+
81+
self
82+
end
83+
84+
# Fetch the project's alternative certificates by ID
85+
# Params:
86+
# +options+:: +Hash+ of options
87+
def fetch(options = {})
88+
self.prefill(options)
89+
90+
request = Request.new(@client)
91+
path = "/projects/applepay/alternative-merchant-certificates"
92+
data = {
93+
94+
}
95+
96+
response = Response.new(request.get(path, data, options))
97+
return_values = Array.new
98+
99+
body = response.body
100+
body = body["applepay_certificates"]
101+
apple_pay_alternative_merchant_certificates = ApplePayAlternativeMerchantCertificates.new(@client)
102+
return_values.push(apple_pay_alternative_merchant_certificates.fill_with_data(body))
103+
104+
105+
return_values[0]
106+
end
107+
108+
109+
end
110+
end

lib/processout/invoice_detail.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
module ProcessOut
99
class InvoiceDetail
1010

11+
attr_reader :id
1112
attr_reader :name
1213
attr_reader :type
1314
attr_reader :amount
@@ -25,6 +26,10 @@ class InvoiceDetail
2526
attr_reader :category
2627

2728

29+
def id=(val)
30+
@id = val
31+
end
32+
2833
def name=(val)
2934
@name = val
3035
end
@@ -93,6 +98,7 @@ def category=(val)
9398
def initialize(client, data = {})
9499
@client = client
95100

101+
self.id = data.fetch(:id, nil)
96102
self.name = data.fetch(:name, nil)
97103
self.type = data.fetch(:type, nil)
98104
self.amount = data.fetch(:amount, nil)
@@ -119,6 +125,7 @@ def new(data = {})
119125
# Overrides the JSON marshaller to only send the fields we want
120126
def to_json(options)
121127
{
128+
"id": self.id,
122129
"name": self.name,
123130
"type": self.type,
124131
"amount": self.amount,
@@ -144,6 +151,9 @@ def fill_with_data(data)
144151
if data.nil?
145152
return self
146153
end
154+
if data.include? "id"
155+
self.id = data["id"]
156+
end
147157
if data.include? "name"
148158
self.name = data["name"]
149159
end
@@ -200,6 +210,7 @@ def prefill(data)
200210
if data.nil?
201211
return self
202212
end
213+
self.id = data.fetch(:id, self.id)
203214
self.name = data.fetch(:name, self.name)
204215
self.type = data.fetch(:type, self.type)
205216
self.amount = data.fetch(:amount, self.amount)

lib/processout/networking/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def apply_headers(req, options)
1313
req.basic_auth @client.project_id, @client.project_secret
1414
req.content_type = "application/json"
1515
req["API-Version"] = "1.4.0.0"
16-
req["User-Agent"] = "ProcessOut Ruby-Bindings/2.18.0"
16+
req["User-Agent"] = "ProcessOut Ruby-Bindings/2.19.0"
1717

1818
unless options.nil?
1919
req["Idempotency-Key"] = options.fetch(:idempotency_key, "")

lib/processout/refund.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Refund
1818
attr_reader :metadata
1919
attr_reader :sandbox
2020
attr_reader :created_at
21+
attr_reader :invoice_detail_ids
2122

2223

2324
def id=(val)
@@ -72,6 +73,10 @@ def created_at=(val)
7273
@created_at = val
7374
end
7475

76+
def invoice_detail_ids=(val)
77+
@invoice_detail_ids = val
78+
end
79+
7580

7681
# Initializes the Refund object
7782
# Params:
@@ -90,6 +95,7 @@ def initialize(client, data = {})
9095
self.metadata = data.fetch(:metadata, nil)
9196
self.sandbox = data.fetch(:sandbox, nil)
9297
self.created_at = data.fetch(:created_at, nil)
98+
self.invoice_detail_ids = data.fetch(:invoice_detail_ids, nil)
9399

94100
end
95101

@@ -111,6 +117,7 @@ def to_json(options)
111117
"metadata": self.metadata,
112118
"sandbox": self.sandbox,
113119
"created_at": self.created_at,
120+
"invoice_detail_ids": self.invoice_detail_ids,
114121
}.to_json
115122
end
116123

@@ -151,6 +158,9 @@ def fill_with_data(data)
151158
if data.include? "created_at"
152159
self.created_at = data["created_at"]
153160
end
161+
if data.include? "invoice_detail_ids"
162+
self.invoice_detail_ids = data["invoice_detail_ids"]
163+
end
154164

155165
self
156166
end
@@ -172,6 +182,7 @@ def prefill(data)
172182
self.metadata = data.fetch(:metadata, self.metadata)
173183
self.sandbox = data.fetch(:sandbox, self.sandbox)
174184
self.created_at = data.fetch(:created_at, self.created_at)
185+
self.invoice_detail_ids = data.fetch(:invoice_detail_ids, self.invoice_detail_ids)
175186

176187
self
177188
end
@@ -248,7 +259,8 @@ def create(options = {})
248259
"amount" => @amount,
249260
"metadata" => @metadata,
250261
"reason" => @reason,
251-
"information" => @information
262+
"information" => @information,
263+
"invoice_detail_ids" => @invoice_detail_ids
252264
}
253265

254266
response = Response.new(request.post(path, data, options))

0 commit comments

Comments
 (0)