CroemincRubyGem 0.1.2
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 +7 -0
- data/.gitignore +11 -0
- data/.idea/.gitignore +3 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/MetropagoRubyGem.iml +19 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/metropago-gateway-rubygem-sdk.iml +19 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CroemincRubyGem.gemspec +42 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +6 -0
- data/SDKDemo.rb +464 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/Catalogs/environment_type.rb +3 -0
- data/lib/Certificates/ca-bundle.crt +3866 -0
- data/lib/Config/application.yml +2 -0
- data/lib/CroemincRubyGem/version.rb +3 -0
- data/lib/CroemincRubyGem.rb +13 -0
- data/lib/Entities/ach.rb +37 -0
- data/lib/Entities/address.rb +97 -0
- data/lib/Entities/amount_range_filter.rb +60 -0
- data/lib/Entities/base_entity.rb +15 -0
- data/lib/Entities/beneficiary.rb +89 -0
- data/lib/Entities/credit_card.rb +150 -0
- data/lib/Entities/customer.rb +218 -0
- data/lib/Entities/customer_entity.rb +130 -0
- data/lib/Entities/customer_entity_response.rb +79 -0
- data/lib/Entities/customer_response.rb +90 -0
- data/lib/Entities/customer_search.rb +80 -0
- data/lib/Entities/customer_search_option.rb +55 -0
- data/lib/Entities/date_range_filter.rb +59 -0
- data/lib/Entities/instruction.rb +136 -0
- data/lib/Entities/instruction_response.rb +63 -0
- data/lib/Entities/instrument.rb +73 -0
- data/lib/Entities/instrument_response.rb +70 -0
- data/lib/Entities/request_model.rb +80 -0
- data/lib/Entities/response_model.rb +39 -0
- data/lib/Entities/service.rb +70 -0
- data/lib/Entities/text_filter.rb +45 -0
- data/lib/Entities/transaction.rb +162 -0
- data/lib/Entities/transaction_options.rb +49 -0
- data/lib/Entities/transaction_response.rb +79 -0
- data/lib/Entities/transaction_search_request.rb +57 -0
- data/lib/Entities/validation_error.rb +60 -0
- data/lib/Entities/wallet.rb +20 -0
- data/lib/Gateway/croeminc_gateway.rb +56 -0
- data/lib/Helpers/api_helper.rb +96 -0
- data/lib/Helpers/jso_nable.rb +56 -0
- data/lib/Helpers/model_parser.rb +235 -0
- data/lib/Managers/customer_manager.rb +148 -0
- data/lib/Managers/transaction_manager.rb +264 -0
- data/lib/MetropagoRubyGem/version.rb +3 -0
- data/lib/Test/customer_operations.rb +395 -0
- data/lib/Test/transaction_operations.rb +259 -0
- metadata +146 -0
@@ -0,0 +1,259 @@
|
|
1
|
+
require_relative '../Entities/customer'
|
2
|
+
require_relative '../Gateway/Croeminc_gateway'
|
3
|
+
require_relative '../Managers/customer_manager'
|
4
|
+
require_relative '../Entities/customer_search'
|
5
|
+
require_relative '../Entities/customer_search_option'
|
6
|
+
require_relative '../Entities/text_filter'
|
7
|
+
require_relative '../Entities/transaction'
|
8
|
+
require_relative '../Entities/transaction_options'
|
9
|
+
require_relative '../Entities/transaction_response'
|
10
|
+
require_relative '../Managers/transaction_manager'
|
11
|
+
require_relative '../Entities/amount_range_filter'
|
12
|
+
require_relative '../Entities/date_range_filter'
|
13
|
+
require_relative '../Entities/transaction_search_request'
|
14
|
+
|
15
|
+
class TransactionOperations
|
16
|
+
|
17
|
+
def initialize(metropaGatewayObj)
|
18
|
+
@CroemincGateway = metropaGatewayObj
|
19
|
+
@preAuth_TransactionId=""
|
20
|
+
end
|
21
|
+
|
22
|
+
def PerformSale(customerId)
|
23
|
+
|
24
|
+
tranxRequest = Transaction.new
|
25
|
+
customer = Customer.new
|
26
|
+
|
27
|
+
#card Info
|
28
|
+
creditCards = []
|
29
|
+
card = CreditCard.new
|
30
|
+
card.Token = "A2478342-617A-4EE5-BC1B-ECD3D132D9CF"
|
31
|
+
creditCards << card
|
32
|
+
|
33
|
+
#Account Info
|
34
|
+
accounts = []
|
35
|
+
account = CustomerEntity.new
|
36
|
+
account.Id = "10752"
|
37
|
+
accounts << account
|
38
|
+
|
39
|
+
#customer Info
|
40
|
+
customer.CustomerId = customerId
|
41
|
+
customer.CreditCards = creditCards
|
42
|
+
#customer.CustomerEntities = accounts
|
43
|
+
|
44
|
+
#Transaction Info
|
45
|
+
tranxRequest.CustomerData = customer
|
46
|
+
tranxRequest.Amount = 1.00
|
47
|
+
tranxRequest.OrderTrackingNumber = "777AAAAA"
|
48
|
+
|
49
|
+
tranxMgr = TransactionManager.new(@CroemincGateway)
|
50
|
+
responseTranxModel = tranxMgr.Sale(tranxRequest)
|
51
|
+
|
52
|
+
|
53
|
+
puts 'RESULT - Perform Sale:'
|
54
|
+
responseDetails = responseTranxModel.getResponseDetails
|
55
|
+
|
56
|
+
if(responseDetails && responseDetails.getIsSuccess == true)
|
57
|
+
puts 'Transaction Processed Successfullly. Transaction Id: ' + responseDetails.getTransactionId
|
58
|
+
|
59
|
+
#example accessing inner models
|
60
|
+
if(responseTranxModel.getCustomerData)
|
61
|
+
customerCards = responseTranxModel.getCustomerData.getCreditCards
|
62
|
+
puts customerCards[0].getCardHolder
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
else
|
67
|
+
puts responseDetails.getResponseSummary
|
68
|
+
end
|
69
|
+
|
70
|
+
if(responseDetails.getValidationErrors)
|
71
|
+
vErrors = responseDetails.getValidationErrors
|
72
|
+
if(vErrors.getErrorDetails)
|
73
|
+
|
74
|
+
vErrors.getErrorDetails.each do |ed|
|
75
|
+
|
76
|
+
puts "Error Summary:"
|
77
|
+
puts ed.getErrorSummary
|
78
|
+
puts "Error Description: "
|
79
|
+
puts ed.getErrorDescription
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
def PerformPreAuthorization(customerId)
|
90
|
+
|
91
|
+
tranxRequest = Transaction.new
|
92
|
+
customer = Customer.new
|
93
|
+
|
94
|
+
#card Info
|
95
|
+
creditCards = []
|
96
|
+
card = CreditCard.new
|
97
|
+
card.Token = "A2478342-617A-4EE5-BC1B-ECD3D132D9CF"
|
98
|
+
creditCards << card
|
99
|
+
|
100
|
+
#Account Info
|
101
|
+
accounts = []
|
102
|
+
account = CustomerEntity.new
|
103
|
+
account.Id = "9680"
|
104
|
+
accounts << account
|
105
|
+
|
106
|
+
#customer Info
|
107
|
+
customer.CustomerId = customerId
|
108
|
+
customer.CreditCards = creditCards
|
109
|
+
#customer.CustomerEntities = accounts
|
110
|
+
|
111
|
+
#Transaction Info
|
112
|
+
tranxRequest.CustomerData = customer
|
113
|
+
tranxRequest.Amount = 1.00
|
114
|
+
tranxRequest.OrderTrackingNumber = "777AAAAA"
|
115
|
+
|
116
|
+
tranxMgr = TransactionManager.new(@CroemincGateway)
|
117
|
+
responseTranxModel = tranxMgr.PreAuthorization(tranxRequest)
|
118
|
+
|
119
|
+
|
120
|
+
puts 'RESULT - PreAuthorization:'
|
121
|
+
responseDetails = responseTranxModel.getResponseDetails
|
122
|
+
|
123
|
+
if(responseDetails.getIsSuccess == true)
|
124
|
+
puts 'Transaction Processed Successfullly. Transaction Id: ' + responseDetails.getTransactionId
|
125
|
+
@preAuth_TransactionId = responseDetails.getTransactionId
|
126
|
+
else
|
127
|
+
puts responseDetails.getResponseSummary
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
def PerformRebill(customerId)
|
134
|
+
|
135
|
+
tranxRequest = Transaction.new
|
136
|
+
customer = Customer.new
|
137
|
+
|
138
|
+
#card Info
|
139
|
+
creditCards = []
|
140
|
+
card = CreditCard.new
|
141
|
+
card.Token = "A2478342-617A-4EE5-BC1B-ECD3D132D9CF"
|
142
|
+
creditCards << card
|
143
|
+
|
144
|
+
#Account Info
|
145
|
+
accounts = []
|
146
|
+
account = CustomerEntity.new
|
147
|
+
account.Id = "9680"
|
148
|
+
accounts << account
|
149
|
+
|
150
|
+
#customer Info
|
151
|
+
customer.CustomerId = customerId
|
152
|
+
customer.CreditCards = creditCards
|
153
|
+
customer.CustomerEntities = accounts
|
154
|
+
|
155
|
+
#Transaction Info
|
156
|
+
tranxRequest.CustomerData = customer
|
157
|
+
tranxRequest.Amount = 1.00
|
158
|
+
tranxRequest.OrderTrackingNumber = "777AAAAA"
|
159
|
+
|
160
|
+
tranxMgr = TransactionManager.new(@CroemincGateway)
|
161
|
+
responseTranxModel = tranxMgr.Rebill(tranxRequest)
|
162
|
+
|
163
|
+
|
164
|
+
puts 'RESULT - Rebill:'
|
165
|
+
responseDetails = responseTranxModel.getResponseDetails
|
166
|
+
|
167
|
+
if(responseDetails.getIsSuccess == true)
|
168
|
+
puts 'Transaction Processed Successfullly. Transaction Id: ' + responseDetails.getTransactionId
|
169
|
+
else
|
170
|
+
puts responseDetails.getResponseSummary
|
171
|
+
end
|
172
|
+
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
def PerformAdjustment(customerId)
|
177
|
+
|
178
|
+
tranxRequest = Transaction.new
|
179
|
+
tranxRequest.TransactionId = @preAuth_TransactionId
|
180
|
+
tranxRequest.Amount = 1.00
|
181
|
+
|
182
|
+
tranxMgr = TransactionManager.new(@CroemincGateway)
|
183
|
+
responseTranxModel = tranxMgr.Adjustment(tranxRequest)
|
184
|
+
|
185
|
+
puts 'RESULT - Adjustment:'
|
186
|
+
responseDetails = responseTranxModel.getResponseDetails
|
187
|
+
|
188
|
+
if(responseDetails.getIsSuccess == true)
|
189
|
+
puts 'Transaction Processed Successfullly. Transaction Id: ' + responseDetails.getTransactionId
|
190
|
+
else
|
191
|
+
puts responseDetails.getResponseSummary
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
def PerformRefund(customerId)
|
197
|
+
|
198
|
+
tranxRequest = Transaction.new
|
199
|
+
tranxRequest.TransactionId = @preAuth_TransactionId
|
200
|
+
tranxRequest.Amount = 1.00
|
201
|
+
|
202
|
+
tranxMgr = TransactionManager.new(@CroemincGateway)
|
203
|
+
responseTranxModel = tranxMgr.Refund(tranxRequest)
|
204
|
+
|
205
|
+
puts 'RESULT - Refund:'
|
206
|
+
responseDetails = responseTranxModel.getResponseDetails
|
207
|
+
|
208
|
+
if(responseDetails.getIsSuccess == true)
|
209
|
+
puts 'Transaction Processed Successfullly. Transaction Id: ' + responseDetails.getTransactionId
|
210
|
+
else
|
211
|
+
puts responseDetails.getResponseSummary
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
216
|
+
def SearchTransactions(cutomerId)
|
217
|
+
|
218
|
+
searchRequest = TransactionSearchRequest.new
|
219
|
+
searchRequest.Amount = AmountRangeFilter.new.Between(0.00, 2.00)
|
220
|
+
searchRequest.CardHolderName = TextFilter.new.StartsWith("ZEE")
|
221
|
+
|
222
|
+
#searchRequest.TransactionId = "102747816"
|
223
|
+
|
224
|
+
searchRequest.CustomerId = cutomerId
|
225
|
+
|
226
|
+
tranxMgr = TransactionManager.new(@CroemincGateway)
|
227
|
+
transactions = tranxMgr.SearchTransaction(searchRequest)
|
228
|
+
|
229
|
+
transactions.each do |tranx|
|
230
|
+
puts tranx.getTransactionId + " - " + tranx.getAmount.to_s + " - " + tranx.getCreditCardDetail.to_json
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
|
236
|
+
def PerformUpdateTransaction(customerId)
|
237
|
+
|
238
|
+
tranxRequest = Transaction.new
|
239
|
+
tranxRequest.ThirdPartyDescription = "Account Payment ABC123"
|
240
|
+
tranxRequest.ThirdPartyStatus = "POSTED"
|
241
|
+
tranxRequest.TransactionId = "102747859"
|
242
|
+
|
243
|
+
|
244
|
+
tranxMgr = TransactionManager.new(@CroemincGateway)
|
245
|
+
responseTranxModel = tranxMgr.UpdateTransaction(tranxRequest)
|
246
|
+
|
247
|
+
puts 'RESULT - Update Transaction:'
|
248
|
+
responseDetails = responseTranxModel.getResponseDetails
|
249
|
+
|
250
|
+
if(responseDetails.getIsSuccess == true)
|
251
|
+
puts 'Transaction Updated Successfullly. Transaction Id: ' + responseDetails.getTransactionId
|
252
|
+
else
|
253
|
+
puts responseDetails.getResponseSummary
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
|
259
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: CroemincRubyGem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Croem inc
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: 'TO_DO: Write a longer description or delete this line.'
|
56
|
+
email:
|
57
|
+
- ccsupport@croeminc.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".idea/.gitignore"
|
64
|
+
- ".idea/.rakeTasks"
|
65
|
+
- ".idea/MetropagoRubyGem.iml"
|
66
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
67
|
+
- ".idea/metropago-gateway-rubygem-sdk.iml"
|
68
|
+
- ".idea/misc.xml"
|
69
|
+
- ".idea/modules.xml"
|
70
|
+
- ".idea/vcs.xml"
|
71
|
+
- ".rspec"
|
72
|
+
- ".travis.yml"
|
73
|
+
- CODE_OF_CONDUCT.md
|
74
|
+
- CroemincRubyGem.gemspec
|
75
|
+
- Gemfile
|
76
|
+
- Gemfile.lock
|
77
|
+
- LICENSE.txt
|
78
|
+
- Rakefile
|
79
|
+
- SDKDemo.rb
|
80
|
+
- bin/console
|
81
|
+
- bin/setup
|
82
|
+
- lib/Catalogs/environment_type.rb
|
83
|
+
- lib/Certificates/ca-bundle.crt
|
84
|
+
- lib/Config/application.yml
|
85
|
+
- lib/CroemincRubyGem.rb
|
86
|
+
- lib/CroemincRubyGem/version.rb
|
87
|
+
- lib/Entities/ach.rb
|
88
|
+
- lib/Entities/address.rb
|
89
|
+
- lib/Entities/amount_range_filter.rb
|
90
|
+
- lib/Entities/base_entity.rb
|
91
|
+
- lib/Entities/beneficiary.rb
|
92
|
+
- lib/Entities/credit_card.rb
|
93
|
+
- lib/Entities/customer.rb
|
94
|
+
- lib/Entities/customer_entity.rb
|
95
|
+
- lib/Entities/customer_entity_response.rb
|
96
|
+
- lib/Entities/customer_response.rb
|
97
|
+
- lib/Entities/customer_search.rb
|
98
|
+
- lib/Entities/customer_search_option.rb
|
99
|
+
- lib/Entities/date_range_filter.rb
|
100
|
+
- lib/Entities/instruction.rb
|
101
|
+
- lib/Entities/instruction_response.rb
|
102
|
+
- lib/Entities/instrument.rb
|
103
|
+
- lib/Entities/instrument_response.rb
|
104
|
+
- lib/Entities/request_model.rb
|
105
|
+
- lib/Entities/response_model.rb
|
106
|
+
- lib/Entities/service.rb
|
107
|
+
- lib/Entities/text_filter.rb
|
108
|
+
- lib/Entities/transaction.rb
|
109
|
+
- lib/Entities/transaction_options.rb
|
110
|
+
- lib/Entities/transaction_response.rb
|
111
|
+
- lib/Entities/transaction_search_request.rb
|
112
|
+
- lib/Entities/validation_error.rb
|
113
|
+
- lib/Entities/wallet.rb
|
114
|
+
- lib/Gateway/croeminc_gateway.rb
|
115
|
+
- lib/Helpers/api_helper.rb
|
116
|
+
- lib/Helpers/jso_nable.rb
|
117
|
+
- lib/Helpers/model_parser.rb
|
118
|
+
- lib/Managers/customer_manager.rb
|
119
|
+
- lib/Managers/transaction_manager.rb
|
120
|
+
- lib/MetropagoRubyGem/version.rb
|
121
|
+
- lib/Test/customer_operations.rb
|
122
|
+
- lib/Test/transaction_operations.rb
|
123
|
+
homepage:
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubygems_version: 3.5.11
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: 'TO_DO: Write a short summary, because RubyGems requires one.'
|
146
|
+
test_files: []
|