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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +52 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Dockerfile +7 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/Makefile +4 -0
  9. data/README.md +12 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/lib/processout/activity.rb +206 -0
  14. data/lib/processout/addon.rb +401 -0
  15. data/lib/processout/alternative_merchant_certificate.rb +115 -0
  16. data/lib/processout/api_request.rb +295 -0
  17. data/lib/processout/api_version.rb +92 -0
  18. data/lib/processout/apple_pay_alternative_merchant_certificates.rb +121 -0
  19. data/lib/processout/balance.rb +92 -0
  20. data/lib/processout/balances.rb +111 -0
  21. data/lib/processout/card.rb +503 -0
  22. data/lib/processout/card_information.rb +164 -0
  23. data/lib/processout/coupon.rb +352 -0
  24. data/lib/processout/customer.rb +755 -0
  25. data/lib/processout/customer_action.rb +81 -0
  26. data/lib/processout/discount.rb +360 -0
  27. data/lib/processout/dunning_action.rb +81 -0
  28. data/lib/processout/errors/authentication_error.rb +9 -0
  29. data/lib/processout/errors/generic_error.rb +9 -0
  30. data/lib/processout/errors/internal_error.rb +9 -0
  31. data/lib/processout/errors/notfound_error.rb +9 -0
  32. data/lib/processout/errors/validation_error.rb +9 -0
  33. data/lib/processout/event.rb +237 -0
  34. data/lib/processout/gateway.rb +210 -0
  35. data/lib/processout/gateway_configuration.rb +346 -0
  36. data/lib/processout/gateway_request.rb +26 -0
  37. data/lib/processout/invoice.rb +984 -0
  38. data/lib/processout/invoice_detail.rb +235 -0
  39. data/lib/processout/invoice_device.rb +92 -0
  40. data/lib/processout/invoice_external_fraud_tools.rb +70 -0
  41. data/lib/processout/invoice_risk.rb +81 -0
  42. data/lib/processout/invoice_shipping.rb +202 -0
  43. data/lib/processout/invoice_tax.rb +81 -0
  44. data/lib/processout/networking/request.rb +102 -0
  45. data/lib/processout/networking/response.rb +67 -0
  46. data/lib/processout/payment_data_network_authentication.rb +70 -0
  47. data/lib/processout/payment_data_three_ds_authentication.rb +70 -0
  48. data/lib/processout/payment_data_three_ds_request.rb +103 -0
  49. data/lib/processout/payout.rb +379 -0
  50. data/lib/processout/payout_item.rb +238 -0
  51. data/lib/processout/plan.rb +368 -0
  52. data/lib/processout/product.rb +368 -0
  53. data/lib/processout/project.rb +353 -0
  54. data/lib/processout/refund.rb +277 -0
  55. data/lib/processout/subscription.rb +910 -0
  56. data/lib/processout/three_ds.rb +158 -0
  57. data/lib/processout/token.rb +493 -0
  58. data/lib/processout/transaction.rb +905 -0
  59. data/lib/processout/transaction_operation.rb +418 -0
  60. data/lib/processout/version.rb +3 -0
  61. data/lib/processout/webhook.rb +237 -0
  62. data/lib/processout/webhook_endpoint.rb +149 -0
  63. data/lib/processout.rb +263 -0
  64. data/processout.gemspec +26 -0
  65. metadata +66 -3
@@ -0,0 +1,149 @@
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 WebhookEndpoint
10
+
11
+ attr_reader :id
12
+ attr_reader :project
13
+ attr_reader :project_id
14
+ attr_reader :url
15
+ attr_reader :events_whitelist
16
+ attr_reader :sandbox
17
+ attr_reader :created_at
18
+
19
+
20
+ def id=(val)
21
+ @id = val
22
+ end
23
+
24
+ def project=(val)
25
+ if val.nil?
26
+ @project = val
27
+ return
28
+ end
29
+
30
+ if val.instance_of? Project
31
+ @project = val
32
+ else
33
+ obj = Project.new(@client)
34
+ obj.fill_with_data(val)
35
+ @project = obj
36
+ end
37
+
38
+ end
39
+
40
+ def project_id=(val)
41
+ @project_id = val
42
+ end
43
+
44
+ def url=(val)
45
+ @url = val
46
+ end
47
+
48
+ def events_whitelist=(val)
49
+ @events_whitelist = val
50
+
51
+ end
52
+
53
+ def sandbox=(val)
54
+ @sandbox = val
55
+ end
56
+
57
+ def created_at=(val)
58
+ @created_at = val
59
+ end
60
+
61
+
62
+ # Initializes the WebhookEndpoint object
63
+ # Params:
64
+ # +client+:: +ProcessOut+ client instance
65
+ # +data+:: data that can be used to fill the object
66
+ def initialize(client, data = {})
67
+ @client = client
68
+
69
+ self.id = data.fetch(:id, nil)
70
+ self.project = data.fetch(:project, nil)
71
+ self.project_id = data.fetch(:project_id, nil)
72
+ self.url = data.fetch(:url, nil)
73
+ self.events_whitelist = data.fetch(:events_whitelist, nil)
74
+ self.sandbox = data.fetch(:sandbox, nil)
75
+ self.created_at = data.fetch(:created_at, nil)
76
+
77
+ end
78
+
79
+ # Create a new WebhookEndpoint using the current client
80
+ def new(data = {})
81
+ WebhookEndpoint.new(@client, data)
82
+ end
83
+
84
+ # Overrides the JSON marshaller to only send the fields we want
85
+ def to_json(options)
86
+ {
87
+ "id": self.id,
88
+ "project": self.project,
89
+ "project_id": self.project_id,
90
+ "url": self.url,
91
+ "events_whitelist": self.events_whitelist,
92
+ "sandbox": self.sandbox,
93
+ "created_at": self.created_at,
94
+ }.to_json
95
+ end
96
+
97
+ # Fills the object with data coming from the API
98
+ # Params:
99
+ # +data+:: +Hash+ of data coming from the API
100
+ def fill_with_data(data)
101
+ if data.nil?
102
+ return self
103
+ end
104
+ if data.include? "id"
105
+ self.id = data["id"]
106
+ end
107
+ if data.include? "project"
108
+ self.project = data["project"]
109
+ end
110
+ if data.include? "project_id"
111
+ self.project_id = data["project_id"]
112
+ end
113
+ if data.include? "url"
114
+ self.url = data["url"]
115
+ end
116
+ if data.include? "events_whitelist"
117
+ self.events_whitelist = data["events_whitelist"]
118
+ end
119
+ if data.include? "sandbox"
120
+ self.sandbox = data["sandbox"]
121
+ end
122
+ if data.include? "created_at"
123
+ self.created_at = data["created_at"]
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Prefills the object with the data passed as parameters
130
+ # Params:
131
+ # +data+:: +Hash+ of data
132
+ def prefill(data)
133
+ if data.nil?
134
+ return self
135
+ end
136
+ self.id = data.fetch(:id, self.id)
137
+ self.project = data.fetch(:project, self.project)
138
+ self.project_id = data.fetch(:project_id, self.project_id)
139
+ self.url = data.fetch(:url, self.url)
140
+ self.events_whitelist = data.fetch(:events_whitelist, self.events_whitelist)
141
+ self.sandbox = data.fetch(:sandbox, self.sandbox)
142
+ self.created_at = data.fetch(:created_at, self.created_at)
143
+
144
+ self
145
+ end
146
+
147
+
148
+ end
149
+ end
data/lib/processout.rb ADDED
@@ -0,0 +1,263 @@
1
+ require "processout/version"
2
+ require "processout/gateway_request"
3
+ require "processout/activity"
4
+ require "processout/addon"
5
+ require "processout/api_request"
6
+ require "processout/api_version"
7
+ require "processout/apple_pay_alternative_merchant_certificates"
8
+ require "processout/alternative_merchant_certificate"
9
+ require "processout/balances"
10
+ require "processout/balance"
11
+ require "processout/card"
12
+ require "processout/card_information"
13
+ require "processout/coupon"
14
+ require "processout/customer"
15
+ require "processout/token"
16
+ require "processout/discount"
17
+ require "processout/event"
18
+ require "processout/gateway"
19
+ require "processout/gateway_configuration"
20
+ require "processout/invoice"
21
+ require "processout/invoice_tax"
22
+ require "processout/invoice_external_fraud_tools"
23
+ require "processout/invoice_risk"
24
+ require "processout/invoice_device"
25
+ require "processout/invoice_shipping"
26
+ require "processout/invoice_detail"
27
+ require "processout/customer_action"
28
+ require "processout/dunning_action"
29
+ require "processout/payout"
30
+ require "processout/payout_item"
31
+ require "processout/plan"
32
+ require "processout/product"
33
+ require "processout/project"
34
+ require "processout/refund"
35
+ require "processout/subscription"
36
+ require "processout/transaction"
37
+ require "processout/three_ds"
38
+ require "processout/payment_data_three_ds_request"
39
+ require "processout/payment_data_network_authentication"
40
+ require "processout/payment_data_three_ds_authentication"
41
+ require "processout/transaction_operation"
42
+ require "processout/webhook"
43
+ require "processout/webhook_endpoint"
44
+
45
+ module ProcessOut
46
+ class Client
47
+ attr_reader :host, :project_id, :project_secret
48
+
49
+ def initialize(project_id, project_secret)
50
+ @host = "https://api.processout.com"
51
+
52
+ @project_id = project_id
53
+ @project_secret = project_secret
54
+ end
55
+
56
+ # Create a new Activity instance
57
+ def activity(data = {})
58
+ obj = Activity.new(self, data)
59
+ end
60
+
61
+ # Create a new Addon instance
62
+ def addon(data = {})
63
+ obj = Addon.new(self, data)
64
+ end
65
+
66
+ # Create a new APIRequest instance
67
+ def api_request(data = {})
68
+ obj = APIRequest.new(self, data)
69
+ end
70
+
71
+ # Create a new APIVersion instance
72
+ def api_version(data = {})
73
+ obj = APIVersion.new(self, data)
74
+ end
75
+
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
+
86
+ # Create a new Balances instance
87
+ def balances(data = {})
88
+ obj = Balances.new(self, data)
89
+ end
90
+
91
+ # Create a new Balance instance
92
+ def balance(data = {})
93
+ obj = Balance.new(self, data)
94
+ end
95
+
96
+ # Create a new Card instance
97
+ def card(data = {})
98
+ obj = Card.new(self, data)
99
+ end
100
+
101
+ # Create a new CardInformation instance
102
+ def card_information(data = {})
103
+ obj = CardInformation.new(self, data)
104
+ end
105
+
106
+ # Create a new Coupon instance
107
+ def coupon(data = {})
108
+ obj = Coupon.new(self, data)
109
+ end
110
+
111
+ # Create a new Customer instance
112
+ def customer(data = {})
113
+ obj = Customer.new(self, data)
114
+ end
115
+
116
+ # Create a new Token instance
117
+ def token(data = {})
118
+ obj = Token.new(self, data)
119
+ end
120
+
121
+ # Create a new Discount instance
122
+ def discount(data = {})
123
+ obj = Discount.new(self, data)
124
+ end
125
+
126
+ # Create a new Event instance
127
+ def event(data = {})
128
+ obj = Event.new(self, data)
129
+ end
130
+
131
+ # Create a new Gateway instance
132
+ def gateway(data = {})
133
+ obj = Gateway.new(self, data)
134
+ end
135
+
136
+ # Create a new GatewayConfiguration instance
137
+ def gateway_configuration(data = {})
138
+ obj = GatewayConfiguration.new(self, data)
139
+ end
140
+
141
+ # Create a new Invoice instance
142
+ def invoice(data = {})
143
+ obj = Invoice.new(self, data)
144
+ end
145
+
146
+ # Create a new InvoiceTax instance
147
+ def invoice_tax(data = {})
148
+ obj = InvoiceTax.new(self, data)
149
+ end
150
+
151
+ # Create a new InvoiceExternalFraudTools instance
152
+ def invoice_external_fraud_tools(data = {})
153
+ obj = InvoiceExternalFraudTools.new(self, data)
154
+ end
155
+
156
+ # Create a new InvoiceRisk instance
157
+ def invoice_risk(data = {})
158
+ obj = InvoiceRisk.new(self, data)
159
+ end
160
+
161
+ # Create a new InvoiceDevice instance
162
+ def invoice_device(data = {})
163
+ obj = InvoiceDevice.new(self, data)
164
+ end
165
+
166
+ # Create a new InvoiceShipping instance
167
+ def invoice_shipping(data = {})
168
+ obj = InvoiceShipping.new(self, data)
169
+ end
170
+
171
+ # Create a new InvoiceDetail instance
172
+ def invoice_detail(data = {})
173
+ obj = InvoiceDetail.new(self, data)
174
+ end
175
+
176
+ # Create a new CustomerAction instance
177
+ def customer_action(data = {})
178
+ obj = CustomerAction.new(self, data)
179
+ end
180
+
181
+ # Create a new DunningAction instance
182
+ def dunning_action(data = {})
183
+ obj = DunningAction.new(self, data)
184
+ end
185
+
186
+ # Create a new Payout instance
187
+ def payout(data = {})
188
+ obj = Payout.new(self, data)
189
+ end
190
+
191
+ # Create a new PayoutItem instance
192
+ def payout_item(data = {})
193
+ obj = PayoutItem.new(self, data)
194
+ end
195
+
196
+ # Create a new Plan instance
197
+ def plan(data = {})
198
+ obj = Plan.new(self, data)
199
+ end
200
+
201
+ # Create a new Product instance
202
+ def product(data = {})
203
+ obj = Product.new(self, data)
204
+ end
205
+
206
+ # Create a new Project instance
207
+ def project(data = {})
208
+ obj = Project.new(self, data)
209
+ end
210
+
211
+ # Create a new Refund instance
212
+ def refund(data = {})
213
+ obj = Refund.new(self, data)
214
+ end
215
+
216
+ # Create a new Subscription instance
217
+ def subscription(data = {})
218
+ obj = Subscription.new(self, data)
219
+ end
220
+
221
+ # Create a new Transaction instance
222
+ def transaction(data = {})
223
+ obj = Transaction.new(self, data)
224
+ end
225
+
226
+ # Create a new ThreeDS instance
227
+ def three_ds(data = {})
228
+ obj = ThreeDS.new(self, data)
229
+ end
230
+
231
+ # Create a new PaymentDataThreeDSRequest instance
232
+ def payment_data_three_ds_request(data = {})
233
+ obj = PaymentDataThreeDSRequest.new(self, data)
234
+ end
235
+
236
+ # Create a new PaymentDataNetworkAuthentication instance
237
+ def payment_data_network_authentication(data = {})
238
+ obj = PaymentDataNetworkAuthentication.new(self, data)
239
+ end
240
+
241
+ # Create a new PaymentDataThreeDSAuthentication instance
242
+ def payment_data_three_ds_authentication(data = {})
243
+ obj = PaymentDataThreeDSAuthentication.new(self, data)
244
+ end
245
+
246
+ # Create a new TransactionOperation instance
247
+ def transaction_operation(data = {})
248
+ obj = TransactionOperation.new(self, data)
249
+ end
250
+
251
+ # Create a new Webhook instance
252
+ def webhook(data = {})
253
+ obj = Webhook.new(self, data)
254
+ end
255
+
256
+ # Create a new WebhookEndpoint instance
257
+ def webhook_endpoint(data = {})
258
+ obj = WebhookEndpoint.new(self, data)
259
+ end
260
+
261
+
262
+ end
263
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'processout/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "processout"
8
+ spec.version = ProcessOut::VERSION
9
+ spec.authors = ["Manuel HUEZ"]
10
+ spec.email = ["manuel@processout.com"]
11
+
12
+ spec.summary = "Ruby bindings for the ProcessOut API"
13
+ spec.homepage = "https://docs.processout.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.13"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ 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.20.0
4
+ version: 2.21.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: 2022-07-26 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,7 +58,70 @@ email:
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
- files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Dockerfile
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - Makefile
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/setup
73
+ - lib/processout.rb
74
+ - lib/processout/activity.rb
75
+ - lib/processout/addon.rb
76
+ - lib/processout/alternative_merchant_certificate.rb
77
+ - lib/processout/api_request.rb
78
+ - lib/processout/api_version.rb
79
+ - lib/processout/apple_pay_alternative_merchant_certificates.rb
80
+ - lib/processout/balance.rb
81
+ - lib/processout/balances.rb
82
+ - lib/processout/card.rb
83
+ - lib/processout/card_information.rb
84
+ - lib/processout/coupon.rb
85
+ - lib/processout/customer.rb
86
+ - lib/processout/customer_action.rb
87
+ - lib/processout/discount.rb
88
+ - lib/processout/dunning_action.rb
89
+ - lib/processout/errors/authentication_error.rb
90
+ - lib/processout/errors/generic_error.rb
91
+ - lib/processout/errors/internal_error.rb
92
+ - lib/processout/errors/notfound_error.rb
93
+ - lib/processout/errors/validation_error.rb
94
+ - lib/processout/event.rb
95
+ - lib/processout/gateway.rb
96
+ - lib/processout/gateway_configuration.rb
97
+ - lib/processout/gateway_request.rb
98
+ - lib/processout/invoice.rb
99
+ - lib/processout/invoice_detail.rb
100
+ - lib/processout/invoice_device.rb
101
+ - lib/processout/invoice_external_fraud_tools.rb
102
+ - lib/processout/invoice_risk.rb
103
+ - lib/processout/invoice_shipping.rb
104
+ - lib/processout/invoice_tax.rb
105
+ - lib/processout/networking/request.rb
106
+ - lib/processout/networking/response.rb
107
+ - lib/processout/payment_data_network_authentication.rb
108
+ - lib/processout/payment_data_three_ds_authentication.rb
109
+ - lib/processout/payment_data_three_ds_request.rb
110
+ - lib/processout/payout.rb
111
+ - lib/processout/payout_item.rb
112
+ - lib/processout/plan.rb
113
+ - lib/processout/product.rb
114
+ - lib/processout/project.rb
115
+ - lib/processout/refund.rb
116
+ - lib/processout/subscription.rb
117
+ - lib/processout/three_ds.rb
118
+ - lib/processout/token.rb
119
+ - lib/processout/transaction.rb
120
+ - lib/processout/transaction_operation.rb
121
+ - lib/processout/version.rb
122
+ - lib/processout/webhook.rb
123
+ - lib/processout/webhook_endpoint.rb
124
+ - processout.gemspec
62
125
  homepage: https://docs.processout.com
63
126
  licenses:
64
127
  - MIT