processout 2.30.0 → 3.0.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: 9daae4f6b38dea2683271dd9a4bbb57d54ce2cb08e457c8a62f19536e3ab3d37
4
- data.tar.gz: 9b47f6293d6c347b5a5cc6a6cf9372ee4d9a97e2dc35f63c5666764f6635f327
3
+ metadata.gz: 9dbb9789f54c15d86ef3b22a868b8ad6009203fe0dde1d05e8b8a1fdda02c2b1
4
+ data.tar.gz: 41afc68147e44d58033688ffc8a41ffbb0a73d7c83e361dcabf7444dbfa8fcb1
5
5
  SHA512:
6
- metadata.gz: 43e1abcc1b8ab960f28889a95a157c97d66b400b72d44cecddf1724fea1658a2e79aab2cb067dcc9890fe5e7257b17b8577815a0bca64ad2f43754cc30c8c644
7
- data.tar.gz: 6c36a1140484dfe0c759afb150cf76a63dcc35a342f1d39d18ac0137f6f87377514277bae7f32aec3f6fe3d3cadeb06729ee73dffeffeb06be6771e5f1ad3642
6
+ metadata.gz: 5bfde4b669939b09f83b2cbf3317ccca829c1ba422bb9226a60ad386cae6955063f5f8afaba4dec1b479e77b589560edf2e0e13290fd6c641675d5546d64493f
7
+ data.tar.gz: ea7064edc8e1b5eba813a9815ecf3077a0ae58897ca47b7c50683db86a03e067f8bc1b3a4ae397c54574af220b889b0f8a1c8685b038b0ae2a0d5253d33d73cb
@@ -15,6 +15,9 @@ module ProcessOut
15
15
  attr_reader :country_code
16
16
  attr_reader :zip
17
17
  attr_reader :phone
18
+ attr_reader :first_name
19
+ attr_reader :last_name
20
+ attr_reader :email
18
21
 
19
22
 
20
23
  def address1=(val)
@@ -57,6 +60,18 @@ module ProcessOut
57
60
 
58
61
  end
59
62
 
63
+ def first_name=(val)
64
+ @first_name = val
65
+ end
66
+
67
+ def last_name=(val)
68
+ @last_name = val
69
+ end
70
+
71
+ def email=(val)
72
+ @email = val
73
+ end
74
+
60
75
 
61
76
  # Initializes the CardShipping object
62
77
  # Params:
@@ -72,6 +87,9 @@ module ProcessOut
72
87
  self.country_code = data.fetch(:country_code, nil)
73
88
  self.zip = data.fetch(:zip, nil)
74
89
  self.phone = data.fetch(:phone, nil)
90
+ self.first_name = data.fetch(:first_name, nil)
91
+ self.last_name = data.fetch(:last_name, nil)
92
+ self.email = data.fetch(:email, nil)
75
93
 
76
94
  end
77
95
 
@@ -90,6 +108,9 @@ module ProcessOut
90
108
  "country_code": self.country_code,
91
109
  "zip": self.zip,
92
110
  "phone": self.phone,
111
+ "first_name": self.first_name,
112
+ "last_name": self.last_name,
113
+ "email": self.email,
93
114
  }.to_json
94
115
  end
95
116
 
@@ -121,6 +142,15 @@ module ProcessOut
121
142
  if data.include? "phone"
122
143
  self.phone = data["phone"]
123
144
  end
145
+ if data.include? "first_name"
146
+ self.first_name = data["first_name"]
147
+ end
148
+ if data.include? "last_name"
149
+ self.last_name = data["last_name"]
150
+ end
151
+ if data.include? "email"
152
+ self.email = data["email"]
153
+ end
124
154
 
125
155
  self
126
156
  end
@@ -139,6 +169,9 @@ module ProcessOut
139
169
  self.country_code = data.fetch(:country_code, self.country_code)
140
170
  self.zip = data.fetch(:zip, self.zip)
141
171
  self.phone = data.fetch(:phone, self.phone)
172
+ self.first_name = data.fetch(:first_name, self.first_name)
173
+ self.last_name = data.fetch(:last_name, self.last_name)
174
+ self.email = data.fetch(:email, self.email)
142
175
 
143
176
  self
144
177
  end
@@ -8,19 +8,9 @@ require "processout/networking/response"
8
8
  module ProcessOut
9
9
  class CardUpdateRequest
10
10
 
11
- attr_reader :update_type
12
- attr_reader :update_reason
13
11
  attr_reader :preferred_scheme
14
12
 
15
13
 
16
- def update_type=(val)
17
- @update_type = val
18
- end
19
-
20
- def update_reason=(val)
21
- @update_reason = val
22
- end
23
-
24
14
  def preferred_scheme=(val)
25
15
  @preferred_scheme = val
26
16
  end
@@ -33,8 +23,6 @@ module ProcessOut
33
23
  def initialize(client, data = {})
34
24
  @client = client
35
25
 
36
- self.update_type = data.fetch(:update_type, nil)
37
- self.update_reason = data.fetch(:update_reason, nil)
38
26
  self.preferred_scheme = data.fetch(:preferred_scheme, nil)
39
27
 
40
28
  end
@@ -47,8 +35,6 @@ module ProcessOut
47
35
  # Overrides the JSON marshaller to only send the fields we want
48
36
  def to_json(options)
49
37
  {
50
- "update_type": self.update_type,
51
- "update_reason": self.update_reason,
52
38
  "preferred_scheme": self.preferred_scheme,
53
39
  }.to_json
54
40
  end
@@ -60,12 +46,6 @@ module ProcessOut
60
46
  if data.nil?
61
47
  return self
62
48
  end
63
- if data.include? "update_type"
64
- self.update_type = data["update_type"]
65
- end
66
- if data.include? "update_reason"
67
- self.update_reason = data["update_reason"]
68
- end
69
49
  if data.include? "preferred_scheme"
70
50
  self.preferred_scheme = data["preferred_scheme"]
71
51
  end
@@ -80,8 +60,6 @@ module ProcessOut
80
60
  if data.nil?
81
61
  return self
82
62
  end
83
- self.update_type = data.fetch(:update_type, self.update_type)
84
- self.update_reason = data.fetch(:update_reason, self.update_reason)
85
63
  self.preferred_scheme = data.fetch(:preferred_scheme, self.preferred_scheme)
86
64
 
87
65
  self
@@ -97,8 +75,6 @@ module ProcessOut
97
75
  request = Request.new(@client)
98
76
  path = "/cards/" + CGI.escape(card_id) + ""
99
77
  data = {
100
- "update_type" => @update_type,
101
- "update_reason" => @update_reason,
102
78
  "preferred_scheme" => @preferred_scheme
103
79
  }
104
80
 
@@ -21,6 +21,7 @@ module ProcessOut
21
21
  attr_reader :token_id
22
22
  attr_reader :details
23
23
  attr_reader :url
24
+ attr_reader :url_qrcode
24
25
  attr_reader :name
25
26
  attr_reader :order_id
26
27
  attr_reader :amount
@@ -39,6 +40,7 @@ module ProcessOut
39
40
  attr_reader :require_backend_capture
40
41
  attr_reader :sandbox
41
42
  attr_reader :created_at
43
+ attr_reader :expires_at
42
44
  attr_reader :risk
43
45
  attr_reader :shipping
44
46
  attr_reader :device
@@ -55,6 +57,7 @@ module ProcessOut
55
57
  attr_reader :billing
56
58
  attr_reader :unsupported_feature_bypass
57
59
  attr_reader :verification
60
+ attr_reader :auto_capture_at
58
61
 
59
62
 
60
63
  def id=(val)
@@ -185,6 +188,10 @@ module ProcessOut
185
188
  @url = val
186
189
  end
187
190
 
191
+ def url_qrcode=(val)
192
+ @url_qrcode = val
193
+ end
194
+
188
195
  def name=(val)
189
196
  @name = val
190
197
  end
@@ -257,6 +264,10 @@ module ProcessOut
257
264
  @created_at = val
258
265
  end
259
266
 
267
+ def expires_at=(val)
268
+ @expires_at = val
269
+ end
270
+
260
271
  def risk=(val)
261
272
  if val.nil?
262
273
  @risk = val
@@ -417,6 +428,10 @@ module ProcessOut
417
428
  @verification = val
418
429
  end
419
430
 
431
+ def auto_capture_at=(val)
432
+ @auto_capture_at = val
433
+ end
434
+
420
435
 
421
436
  # Initializes the Invoice object
422
437
  # Params:
@@ -438,6 +453,7 @@ module ProcessOut
438
453
  self.token_id = data.fetch(:token_id, nil)
439
454
  self.details = data.fetch(:details, nil)
440
455
  self.url = data.fetch(:url, nil)
456
+ self.url_qrcode = data.fetch(:url_qrcode, nil)
441
457
  self.name = data.fetch(:name, nil)
442
458
  self.order_id = data.fetch(:order_id, nil)
443
459
  self.amount = data.fetch(:amount, nil)
@@ -456,6 +472,7 @@ module ProcessOut
456
472
  self.require_backend_capture = data.fetch(:require_backend_capture, nil)
457
473
  self.sandbox = data.fetch(:sandbox, nil)
458
474
  self.created_at = data.fetch(:created_at, nil)
475
+ self.expires_at = data.fetch(:expires_at, nil)
459
476
  self.risk = data.fetch(:risk, nil)
460
477
  self.shipping = data.fetch(:shipping, nil)
461
478
  self.device = data.fetch(:device, nil)
@@ -472,6 +489,7 @@ module ProcessOut
472
489
  self.billing = data.fetch(:billing, nil)
473
490
  self.unsupported_feature_bypass = data.fetch(:unsupported_feature_bypass, nil)
474
491
  self.verification = data.fetch(:verification, nil)
492
+ self.auto_capture_at = data.fetch(:auto_capture_at, nil)
475
493
 
476
494
  end
477
495
 
@@ -496,6 +514,7 @@ module ProcessOut
496
514
  "token_id": self.token_id,
497
515
  "details": self.details,
498
516
  "url": self.url,
517
+ "url_qrcode": self.url_qrcode,
499
518
  "name": self.name,
500
519
  "order_id": self.order_id,
501
520
  "amount": self.amount,
@@ -514,6 +533,7 @@ module ProcessOut
514
533
  "require_backend_capture": self.require_backend_capture,
515
534
  "sandbox": self.sandbox,
516
535
  "created_at": self.created_at,
536
+ "expires_at": self.expires_at,
517
537
  "risk": self.risk,
518
538
  "shipping": self.shipping,
519
539
  "device": self.device,
@@ -530,6 +550,7 @@ module ProcessOut
530
550
  "billing": self.billing,
531
551
  "unsupported_feature_bypass": self.unsupported_feature_bypass,
532
552
  "verification": self.verification,
553
+ "auto_capture_at": self.auto_capture_at,
533
554
  }.to_json
534
555
  end
535
556
 
@@ -579,6 +600,9 @@ module ProcessOut
579
600
  if data.include? "url"
580
601
  self.url = data["url"]
581
602
  end
603
+ if data.include? "url_qrcode"
604
+ self.url_qrcode = data["url_qrcode"]
605
+ end
582
606
  if data.include? "name"
583
607
  self.name = data["name"]
584
608
  end
@@ -633,6 +657,9 @@ module ProcessOut
633
657
  if data.include? "created_at"
634
658
  self.created_at = data["created_at"]
635
659
  end
660
+ if data.include? "expires_at"
661
+ self.expires_at = data["expires_at"]
662
+ end
636
663
  if data.include? "risk"
637
664
  self.risk = data["risk"]
638
665
  end
@@ -681,6 +708,9 @@ module ProcessOut
681
708
  if data.include? "verification"
682
709
  self.verification = data["verification"]
683
710
  end
711
+ if data.include? "auto_capture_at"
712
+ self.auto_capture_at = data["auto_capture_at"]
713
+ end
684
714
 
685
715
  self
686
716
  end
@@ -705,6 +735,7 @@ module ProcessOut
705
735
  self.token_id = data.fetch(:token_id, self.token_id)
706
736
  self.details = data.fetch(:details, self.details)
707
737
  self.url = data.fetch(:url, self.url)
738
+ self.url_qrcode = data.fetch(:url_qrcode, self.url_qrcode)
708
739
  self.name = data.fetch(:name, self.name)
709
740
  self.order_id = data.fetch(:order_id, self.order_id)
710
741
  self.amount = data.fetch(:amount, self.amount)
@@ -723,6 +754,7 @@ module ProcessOut
723
754
  self.require_backend_capture = data.fetch(:require_backend_capture, self.require_backend_capture)
724
755
  self.sandbox = data.fetch(:sandbox, self.sandbox)
725
756
  self.created_at = data.fetch(:created_at, self.created_at)
757
+ self.expires_at = data.fetch(:expires_at, self.expires_at)
726
758
  self.risk = data.fetch(:risk, self.risk)
727
759
  self.shipping = data.fetch(:shipping, self.shipping)
728
760
  self.device = data.fetch(:device, self.device)
@@ -739,6 +771,7 @@ module ProcessOut
739
771
  self.billing = data.fetch(:billing, self.billing)
740
772
  self.unsupported_feature_bypass = data.fetch(:unsupported_feature_bypass, self.unsupported_feature_bypass)
741
773
  self.verification = data.fetch(:verification, self.verification)
774
+ self.auto_capture_at = data.fetch(:auto_capture_at, self.auto_capture_at)
742
775
 
743
776
  self
744
777
  end
@@ -799,9 +832,13 @@ module ProcessOut
799
832
  body = body["transaction"]
800
833
  transaction = Transaction.new(@client)
801
834
  return_values.push(transaction.fill_with_data(body))
835
+ body = response.body
836
+ body = body["customer_action"]
837
+ customer_action = CustomerAction.new(@client)
838
+ return_values.push(customer_action.fill_with_data(body))
802
839
 
803
840
 
804
- return_values[0]
841
+ return_values
805
842
  end
806
843
 
807
844
  # Capture the invoice using the given source (customer or token)
@@ -835,9 +872,13 @@ module ProcessOut
835
872
  body = body["transaction"]
836
873
  transaction = Transaction.new(@client)
837
874
  return_values.push(transaction.fill_with_data(body))
875
+ body = response.body
876
+ body = body["customer_action"]
877
+ customer_action = CustomerAction.new(@client)
878
+ return_values.push(customer_action.fill_with_data(body))
838
879
 
839
880
 
840
- return_values[0]
881
+ return_values
841
882
  end
842
883
 
843
884
  # Get the customer linked to the invoice.
@@ -961,11 +1002,16 @@ module ProcessOut
961
1002
  return_values = Array.new
962
1003
 
963
1004
  body = response.body
964
- invoices_process_native_payment_response = InvoicesProcessNativePaymentResponse.new(@client)
965
- return_values.push(invoices_process_native_payment_response.fill_with_data(body))
1005
+ body = body["transaction"]
1006
+ transaction = Transaction.new(@client)
1007
+ return_values.push(transaction.fill_with_data(body))
1008
+ body = response.body
1009
+ body = body["native_apm"]
1010
+ native_apm_response = NativeAPMResponse.new(@client)
1011
+ return_values.push(native_apm_response.fill_with_data(body))
966
1012
 
967
1013
 
968
- return_values[0]
1014
+ return_values
969
1015
  end
970
1016
 
971
1017
  # Initiate a 3-D Secure authentication
@@ -1113,7 +1159,9 @@ module ProcessOut
1113
1159
  "payment_type" => @payment_type,
1114
1160
  "billing" => @billing,
1115
1161
  "unsupported_feature_bypass" => @unsupported_feature_bypass,
1116
- "verification" => @verification
1162
+ "verification" => @verification,
1163
+ "auto_capture_at" => @auto_capture_at,
1164
+ "expires_at" => @expires_at
1117
1165
  }
1118
1166
 
1119
1167
  response = Response.new(request.post(path, data, options))
@@ -1155,6 +1203,28 @@ module ProcessOut
1155
1203
 
1156
1204
 
1157
1205
 
1206
+ return_values[0]
1207
+ end
1208
+
1209
+ # Delete an invoice by its ID. Only invoices that have not been used yet can be deleted.
1210
+ # Params:
1211
+ # +invoice_id+:: ID of the invoice
1212
+ # +options+:: +Hash+ of options
1213
+ def delete(invoice_id, options = {})
1214
+ self.prefill(options)
1215
+
1216
+ request = Request.new(@client)
1217
+ path = "/invoices/" + CGI.escape(invoice_id) + ""
1218
+ data = {
1219
+
1220
+ }
1221
+
1222
+ response = Response.new(request.delete(path, data, options))
1223
+ return_values = Array.new
1224
+
1225
+ return_values.push(response.success)
1226
+
1227
+
1158
1228
  return_values[0]
1159
1229
  end
1160
1230
 
@@ -15,14 +15,17 @@ module ProcessOut
15
15
 
16
16
  def forter=(val)
17
17
  @forter = val
18
+
18
19
  end
19
20
 
20
21
  def ravelin=(val)
21
22
  @ravelin = val
23
+
22
24
  end
23
25
 
24
26
  def signifyd=(val)
25
27
  @signifyd = val
28
+
26
29
  end
27
30
 
28
31
 
@@ -22,6 +22,9 @@ module ProcessOut
22
22
  attr_reader :phone
23
23
  attr_reader :expects_shipping_at
24
24
  attr_reader :relay_store_name
25
+ attr_reader :first_name
26
+ attr_reader :last_name
27
+ attr_reader :email
25
28
 
26
29
 
27
30
  def amount=(val)
@@ -92,6 +95,18 @@ module ProcessOut
92
95
  @relay_store_name = val
93
96
  end
94
97
 
98
+ def first_name=(val)
99
+ @first_name = val
100
+ end
101
+
102
+ def last_name=(val)
103
+ @last_name = val
104
+ end
105
+
106
+ def email=(val)
107
+ @email = val
108
+ end
109
+
95
110
 
96
111
  # Initializes the InvoiceShipping object
97
112
  # Params:
@@ -114,6 +129,9 @@ module ProcessOut
114
129
  self.phone = data.fetch(:phone, nil)
115
130
  self.expects_shipping_at = data.fetch(:expects_shipping_at, nil)
116
131
  self.relay_store_name = data.fetch(:relay_store_name, nil)
132
+ self.first_name = data.fetch(:first_name, nil)
133
+ self.last_name = data.fetch(:last_name, nil)
134
+ self.email = data.fetch(:email, nil)
117
135
 
118
136
  end
119
137
 
@@ -139,6 +157,9 @@ module ProcessOut
139
157
  "phone": self.phone,
140
158
  "expects_shipping_at": self.expects_shipping_at,
141
159
  "relay_store_name": self.relay_store_name,
160
+ "first_name": self.first_name,
161
+ "last_name": self.last_name,
162
+ "email": self.email,
142
163
  }.to_json
143
164
  end
144
165
 
@@ -191,6 +212,15 @@ module ProcessOut
191
212
  if data.include? "relay_store_name"
192
213
  self.relay_store_name = data["relay_store_name"]
193
214
  end
215
+ if data.include? "first_name"
216
+ self.first_name = data["first_name"]
217
+ end
218
+ if data.include? "last_name"
219
+ self.last_name = data["last_name"]
220
+ end
221
+ if data.include? "email"
222
+ self.email = data["email"]
223
+ end
194
224
 
195
225
  self
196
226
  end
@@ -216,6 +246,9 @@ module ProcessOut
216
246
  self.phone = data.fetch(:phone, self.phone)
217
247
  self.expects_shipping_at = data.fetch(:expects_shipping_at, self.expects_shipping_at)
218
248
  self.relay_store_name = data.fetch(:relay_store_name, self.relay_store_name)
249
+ self.first_name = data.fetch(:first_name, self.first_name)
250
+ self.last_name = data.fetch(:last_name, self.last_name)
251
+ self.email = data.fetch(:email, self.email)
219
252
 
220
253
  self
221
254
  end
@@ -13,7 +13,7 @@ module ProcessOut
13
13
  req.basic_auth @client.project_id, @client.project_secret
14
14
  req.content_type = "application/json"
15
15
  req["API-Version"] = "1.4.0.0"
16
- req["User-Agent"] = "ProcessOut Ruby-Bindings/2.30.0"
16
+ req["User-Agent"] = "ProcessOut Ruby-Bindings/3.0.0"
17
17
 
18
18
  unless options.nil?
19
19
  req["Idempotency-Key"] = options.fetch(:idempotency_key, "")
@@ -331,7 +331,8 @@ module ProcessOut
331
331
  "name" => @name,
332
332
  "default_currency" => @default_currency,
333
333
  "dunning_configuration" => @dunning_configuration,
334
- "applepay_settings" => options.fetch(:applepay_settings, nil)
334
+ "applepay_settings" => options.fetch(:applepay_settings, nil),
335
+ "public_metadata" => options.fetch(:public_metadata, nil)
335
336
  }
336
337
 
337
338
  response = Response.new(request.post(path, data, options))
@@ -426,7 +426,8 @@ module ProcessOut
426
426
  "verify_metadata" => options.fetch(:verify_metadata, nil),
427
427
  "set_default" => options.fetch(:set_default, nil),
428
428
  "verify_statement_descriptor" => options.fetch(:verify_statement_descriptor, nil),
429
- "invoice_return_url" => options.fetch(:invoice_return_url, nil)
429
+ "invoice_return_url" => options.fetch(:invoice_return_url, nil),
430
+ "summary" => options.fetch(:summary, nil)
430
431
  }
431
432
 
432
433
  response = Response.new(request.post(path, data, options))
@@ -1026,6 +1026,36 @@ module ProcessOut
1026
1026
 
1027
1027
 
1028
1028
 
1029
+ return_values[0]
1030
+ end
1031
+
1032
+ # Get full transactions data for specified list of ids.
1033
+ # Params:
1034
+ # +options+:: +Hash+ of options
1035
+ def list(options = {})
1036
+ self.prefill(options)
1037
+
1038
+ request = Request.new(@client)
1039
+ path = "/transactions"
1040
+ data = {
1041
+
1042
+ }
1043
+
1044
+ response = Response.new(request.post(path, data, options))
1045
+ return_values = Array.new
1046
+
1047
+ a = Array.new
1048
+ body = response.body
1049
+ for v in body['transactions']
1050
+ tmp = Transaction.new(@client)
1051
+ tmp.fill_with_data(v)
1052
+ a.push(tmp)
1053
+ end
1054
+
1055
+ return_values.push(a)
1056
+
1057
+
1058
+
1029
1059
  return_values[0]
1030
1060
  end
1031
1061
 
@@ -1,3 +1,3 @@
1
1
  module ProcessOut
2
- VERSION = "2.30.0"
2
+ VERSION = "3.0.0"
3
3
  end
data/lib/processout.rb CHANGED
@@ -63,7 +63,6 @@ require "processout/category_error_codes"
63
63
  require "processout/native_apm_transaction_details_gateway"
64
64
  require "processout/native_apm_transaction_details_invoice"
65
65
  require "processout/native_apm_transaction_details"
66
- require "processout/invoices_process_native_payment_response"
67
66
 
68
67
  module ProcessOut
69
68
  class Client
@@ -391,11 +390,6 @@ module ProcessOut
391
390
  obj = NativeAPMTransactionDetails.new(self, data)
392
391
  end
393
392
 
394
- # Create a new InvoicesProcessNativePaymentResponse instance
395
- def invoices_process_native_payment_response(data = {})
396
- obj = InvoicesProcessNativePaymentResponse.new(self, data)
397
- end
398
-
399
393
 
400
394
  end
401
395
  end
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: 2.30.0
4
+ version: 3.0.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: 2024-04-03 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,7 +114,6 @@ files:
114
114
  - lib/processout/invoice_shipping.rb
115
115
  - lib/processout/invoice_shipping_phone.rb
116
116
  - lib/processout/invoice_tax.rb
117
- - lib/processout/invoices_process_native_payment_response.rb
118
117
  - lib/processout/native_apm_parameter_definition.rb
119
118
  - lib/processout/native_apm_parameter_value.rb
120
119
  - lib/processout/native_apm_parameter_value_definition.rb
@@ -1,105 +0,0 @@
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 InvoicesProcessNativePaymentResponse
10
-
11
- attr_reader :transaction
12
- attr_reader :native_apm
13
-
14
-
15
- def transaction=(val)
16
- if val.nil?
17
- @transaction = val
18
- return
19
- end
20
-
21
- if val.instance_of? Transaction
22
- @transaction = val
23
- else
24
- obj = Transaction.new(@client)
25
- obj.fill_with_data(val)
26
- @transaction = obj
27
- end
28
-
29
- end
30
-
31
- def native_apm=(val)
32
- if val.nil?
33
- @native_apm = val
34
- return
35
- end
36
-
37
- if val.instance_of? NativeAPMResponse
38
- @native_apm = val
39
- else
40
- obj = NativeAPMResponse.new(@client)
41
- obj.fill_with_data(val)
42
- @native_apm = obj
43
- end
44
-
45
- end
46
-
47
-
48
- # Initializes the InvoicesProcessNativePaymentResponse object
49
- # Params:
50
- # +client+:: +ProcessOut+ client instance
51
- # +data+:: data that can be used to fill the object
52
- def initialize(client, data = {})
53
- @client = client
54
-
55
- self.transaction = data.fetch(:transaction, nil)
56
- self.native_apm = data.fetch(:native_apm, nil)
57
-
58
- end
59
-
60
- # Create a new InvoicesProcessNativePaymentResponse using the current client
61
- def new(data = {})
62
- InvoicesProcessNativePaymentResponse.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
- "transaction": self.transaction,
69
- "native_apm": self.native_apm,
70
- }.to_json
71
- end
72
-
73
- # Fills the object with data coming from the API
74
- # Params:
75
- # +data+:: +Hash+ of data coming from the API
76
- def fill_with_data(data)
77
- if data.nil?
78
- return self
79
- end
80
- if data.include? "transaction"
81
- self.transaction = data["transaction"]
82
- end
83
- if data.include? "native_apm"
84
- self.native_apm = data["native_apm"]
85
- end
86
-
87
- self
88
- end
89
-
90
- # Prefills the object with the data passed as parameters
91
- # Params:
92
- # +data+:: +Hash+ of data
93
- def prefill(data)
94
- if data.nil?
95
- return self
96
- end
97
- self.transaction = data.fetch(:transaction, self.transaction)
98
- self.native_apm = data.fetch(:native_apm, self.native_apm)
99
-
100
- self
101
- end
102
-
103
-
104
- end
105
- end