cayan 1.0.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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +86 -0
- data/MIT-LICENSE +20 -0
- data/README.md +343 -0
- data/Rakefile +11 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cayan.gemspec +31 -0
- data/lib/cayan/merchantware/credit/client.rb +132 -0
- data/lib/cayan/merchantware.rb +6 -0
- data/lib/cayan/version.rb +3 -0
- data/lib/cayan.rb +6 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a1ad0c2d4a7cd5c5024c36d6c7c8ce296baa1d21
|
4
|
+
data.tar.gz: 6b3ed7615e87ff6dbcd52c6eaf68188b36d741c3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 984ea5e07dade7578602ef435fe499d5bfc575fd7d4c2ba6727d16538a801309a009d345dfc9611125321a816b7d5c5d2cede3723b92cc30deb9b03b5df58942
|
7
|
+
data.tar.gz: '043878344d08b98d8436179ab93bfbd9b657c2f4bc145f524beae2903c2d03d4bb75c654d61f4aa3c7cf861ca96ffdf9fd1f807071340d2e45a7eafcf7be34d4'
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cayan (0.1.0)
|
5
|
+
savon (~> 2.12.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
akami (1.3.1)
|
13
|
+
gyoku (>= 0.4.0)
|
14
|
+
nokogiri
|
15
|
+
builder (3.2.3)
|
16
|
+
coderay (1.1.2)
|
17
|
+
coveralls (0.8.22)
|
18
|
+
json (>= 1.8, < 3)
|
19
|
+
simplecov (~> 0.16.1)
|
20
|
+
term-ansicolor (~> 1.3)
|
21
|
+
thor (~> 0.19.4)
|
22
|
+
tins (~> 1.6)
|
23
|
+
crack (0.4.3)
|
24
|
+
safe_yaml (~> 1.0.0)
|
25
|
+
docile (1.3.1)
|
26
|
+
gyoku (1.3.1)
|
27
|
+
builder (>= 2.1.2)
|
28
|
+
hashdiff (0.3.7)
|
29
|
+
httpi (2.4.4)
|
30
|
+
rack
|
31
|
+
socksify
|
32
|
+
json (2.1.0)
|
33
|
+
method_source (0.9.0)
|
34
|
+
mini_portile2 (2.3.0)
|
35
|
+
minitest (5.11.3)
|
36
|
+
nokogiri (1.8.4)
|
37
|
+
mini_portile2 (~> 2.3.0)
|
38
|
+
nori (2.6.0)
|
39
|
+
pry (0.11.3)
|
40
|
+
coderay (~> 1.1.0)
|
41
|
+
method_source (~> 0.9.0)
|
42
|
+
public_suffix (3.0.3)
|
43
|
+
rack (2.0.5)
|
44
|
+
rake (10.5.0)
|
45
|
+
safe_yaml (1.0.4)
|
46
|
+
savon (2.12.0)
|
47
|
+
akami (~> 1.2)
|
48
|
+
builder (>= 2.1.2)
|
49
|
+
gyoku (~> 1.2)
|
50
|
+
httpi (~> 2.3)
|
51
|
+
nokogiri (>= 1.8.1)
|
52
|
+
nori (~> 2.4)
|
53
|
+
wasabi (~> 3.4)
|
54
|
+
simplecov (0.16.1)
|
55
|
+
docile (~> 1.1)
|
56
|
+
json (>= 1.8, < 3)
|
57
|
+
simplecov-html (~> 0.10.0)
|
58
|
+
simplecov-html (0.10.2)
|
59
|
+
socksify (1.7.1)
|
60
|
+
term-ansicolor (1.6.0)
|
61
|
+
tins (~> 1.0)
|
62
|
+
thor (0.19.4)
|
63
|
+
tins (1.16.3)
|
64
|
+
wasabi (3.5.0)
|
65
|
+
httpi (~> 2.0)
|
66
|
+
nokogiri (>= 1.4.2)
|
67
|
+
webmock (3.4.2)
|
68
|
+
addressable (>= 2.3.6)
|
69
|
+
crack (>= 0.3.2)
|
70
|
+
hashdiff
|
71
|
+
|
72
|
+
PLATFORMS
|
73
|
+
ruby
|
74
|
+
|
75
|
+
DEPENDENCIES
|
76
|
+
bundler (~> 1.16)
|
77
|
+
cayan!
|
78
|
+
coveralls
|
79
|
+
minitest (~> 5.0)
|
80
|
+
pry (= 0.11.3)
|
81
|
+
rake (~> 10.0)
|
82
|
+
simplecov
|
83
|
+
webmock (~> 3.4.2)
|
84
|
+
|
85
|
+
BUNDLED WITH
|
86
|
+
1.16.6
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2018 Cohub, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,343 @@
|
|
1
|
+
# Cayan
|
2
|
+
|
3
|
+
A Ruby gem for talking to the Cayan Merchantware API
|
4
|
+
|
5
|
+
[](https://travis-ci.com/cohubinc/cayan-ruby)
|
6
|
+
[](https://coveralls.io/github/cohubinc/cayan-ruby?branch=master)
|
7
|
+
|
8
|
+
## Installation (not published yet)
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'cayan'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
```shell
|
19
|
+
$ bundle
|
20
|
+
```
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
```shell
|
25
|
+
$ gem install cayan
|
26
|
+
```
|
27
|
+
|
28
|
+
## Merchantware Credit Usage
|
29
|
+
|
30
|
+
- [Initialize a Merchantware Credit Client](#initialize-a-merchantware-credit-client)
|
31
|
+
- [AdjustTip](#adjusttip)
|
32
|
+
- [AttachSignature](#attachsignature)
|
33
|
+
- [Authorize](#authorize)
|
34
|
+
- [BoardCard](#boardcard)
|
35
|
+
- [Capture](#capture)
|
36
|
+
- [FindBoardedCard](#findboardedcard)
|
37
|
+
- [UpdateBoardedCard](#updatedboardedcard)
|
38
|
+
- [ForceCapture](#forcecapture)
|
39
|
+
- [Refund](#refund)
|
40
|
+
- [Sale](#sale)
|
41
|
+
- [SettleBatch](#settlebatch)
|
42
|
+
- [UnboardCard](#unboardcard)
|
43
|
+
- [Void](#void)
|
44
|
+
|
45
|
+
### Initialize a Merchantware Credit Client
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
@client = Cayan::Merchantware::Credit::Client.new({
|
49
|
+
merchant_name: 'Zero Inc',
|
50
|
+
merchant_site_id: '00000000',
|
51
|
+
merchant_key: '00000-00000-00000-00000-00000'
|
52
|
+
})
|
53
|
+
```
|
54
|
+
|
55
|
+
### AdjustTip
|
56
|
+
|
57
|
+
Adds or alters the tip amount to a prior transaction
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
result = @client.adjust_tip({ token: '1236559', amount: '1.00' })
|
61
|
+
|
62
|
+
result[:approval_status] # 'APPROVED'
|
63
|
+
result[:token] # '1236560'
|
64
|
+
result[:transaction_date] # '3/14/2016 7:54:23 PM'
|
65
|
+
```
|
66
|
+
|
67
|
+
### AttachSignature
|
68
|
+
|
69
|
+
Appends a signature record to an existing transaction
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
result = @client.attach_signature({
|
73
|
+
token: '608957',
|
74
|
+
vector_image_data: '10,10^110,110^0,65535^10,110^110,10^0,65535^~'
|
75
|
+
})
|
76
|
+
|
77
|
+
result[:upload_status] # 'ACCEPTED'
|
78
|
+
result[:token] # '608957'
|
79
|
+
result[:transaction_date] # '3/14/2016 7:57:32 PM'
|
80
|
+
```
|
81
|
+
|
82
|
+
### Authorize
|
83
|
+
|
84
|
+
Applies an authorization to a credit card which can be captured at a later time
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
result = @client.authorize({
|
88
|
+
source: 'Keyed',
|
89
|
+
card_number: '4012000033330026',
|
90
|
+
expiration_date: '1218',
|
91
|
+
card_holder: 'John Doe',
|
92
|
+
avs_street_address: '1 Federal Street',
|
93
|
+
avs_zip_code: '02110',
|
94
|
+
card_verification_value: '123'
|
95
|
+
},
|
96
|
+
{
|
97
|
+
amount: 1.05,
|
98
|
+
invoice_number: '1556',
|
99
|
+
register_number: '35',
|
100
|
+
merchant_transaction_id: '167901',
|
101
|
+
card_acceptor_terminal_id: '3'
|
102
|
+
})
|
103
|
+
|
104
|
+
result[:approval_status] # 'APPROVED'
|
105
|
+
result[:token] # '608958'
|
106
|
+
result[:authorization_code] # 'OK785C'
|
107
|
+
result[:transaction_date] # '3/14/2016 7:58:33 PM'
|
108
|
+
result[:amount] # '1.05'
|
109
|
+
result[:card_number] # '************0026'
|
110
|
+
result[:cardholder] # 'John Doe'
|
111
|
+
result[:card_type] # '4'
|
112
|
+
result[:reader_entry_mode] # '1'
|
113
|
+
result[:avs_response] # 'Y'
|
114
|
+
```
|
115
|
+
|
116
|
+
### BoardCard
|
117
|
+
|
118
|
+
Stores payment information for a credit card into the Merchantware Vault
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
result = @client.board_card({
|
122
|
+
source: 'Keyed',
|
123
|
+
card_number: '4012000033330026',
|
124
|
+
expiration_date: '1218',
|
125
|
+
card_holder: 'John Doe',
|
126
|
+
avs_street_address: '1 Federal Street',
|
127
|
+
avs_zip_code: '02110'
|
128
|
+
})
|
129
|
+
|
130
|
+
result[:vault_token] # '1000000000002WSZECPL'
|
131
|
+
```
|
132
|
+
|
133
|
+
### Capture
|
134
|
+
|
135
|
+
Completes a transaction for a prior authorization
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
result = @client.capture({
|
139
|
+
token: '608939',
|
140
|
+
amount: 1.50,
|
141
|
+
invoice_number: '1556',
|
142
|
+
register_number: '35',
|
143
|
+
merchant_transaction_id: '167902',
|
144
|
+
card_acceptor_terminal_id: '3'
|
145
|
+
})
|
146
|
+
result[:approval_status] # 'APPROVED'
|
147
|
+
result[:token] # '608961'
|
148
|
+
result[:authorization_code] # 'OK036C'
|
149
|
+
result[:transaction_date] # '3/14/2016 8:09:31 PM'
|
150
|
+
result[:amount] # '1.50'
|
151
|
+
```
|
152
|
+
|
153
|
+
### FindBoardedCard
|
154
|
+
|
155
|
+
Retrieves the payment data stored inside the Merchantware Vault
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
result = @client.find_boarded_card({ vault_token: '127MMEIIQVEW2WSZECPL' })
|
159
|
+
|
160
|
+
result[:card_number] # '0026'
|
161
|
+
result[:expiration_date] # '1218'
|
162
|
+
result[:card_type] # '4'
|
163
|
+
result[:avs_street_address] # '1 Federal Street'
|
164
|
+
result[:avs_zip_code] # '02110'
|
165
|
+
```
|
166
|
+
|
167
|
+
### UpdateBoardedCard
|
168
|
+
|
169
|
+
Changes the expiration date for an existing payment method stored inside the Merchantware Vault
|
170
|
+
|
171
|
+
```ruby
|
172
|
+
result = @client.update_boarded_card({
|
173
|
+
token: '127MMEIIQVEW2WSZECPL',
|
174
|
+
expiration_date: '0118'
|
175
|
+
})
|
176
|
+
|
177
|
+
result[:vault_token] # '127MMEIIQVEW2WSZECPL'
|
178
|
+
```
|
179
|
+
|
180
|
+
### ForceCapture
|
181
|
+
|
182
|
+
Forces a charge to be issued upon a customer’s credit card
|
183
|
+
|
184
|
+
```ruby
|
185
|
+
result = @client.force_capture(
|
186
|
+
{
|
187
|
+
source: 'Keyed',
|
188
|
+
card_number: '4012000033330026',
|
189
|
+
expiration_date: '1218',
|
190
|
+
card_holder: 'John Doe'
|
191
|
+
}, {
|
192
|
+
amount: '3.06',
|
193
|
+
authorization_code: 'V00546C',
|
194
|
+
invoice_number: '1559',
|
195
|
+
register_number: '35',
|
196
|
+
merchant_transaction_id: '168901',
|
197
|
+
card_acceptor_terminal_id: '3',
|
198
|
+
ecommerce_transaction_indicator: nil
|
199
|
+
}
|
200
|
+
)
|
201
|
+
|
202
|
+
result[:approval_status] # 'APPROVED'
|
203
|
+
result[:token] # '608962'
|
204
|
+
result[:authorization_code] # 'V00546C'
|
205
|
+
result[:transaction_date] # '3/14/2016 8:11:01 PM'
|
206
|
+
result[:amount] # '3.06'
|
207
|
+
result[:card_number] # '************0026'
|
208
|
+
result[:cardholder] # 'John Doe'
|
209
|
+
result[:card_type] # '4'
|
210
|
+
```
|
211
|
+
|
212
|
+
### Refund
|
213
|
+
|
214
|
+
Issues a credit card refund to a customer.
|
215
|
+
|
216
|
+
```ruby
|
217
|
+
result = @client.refund(
|
218
|
+
{
|
219
|
+
source: 'Keyed',
|
220
|
+
card_number: '4012000033330026',
|
221
|
+
expiration_date: '1218',
|
222
|
+
card_holder: 'John Doe'
|
223
|
+
}, {
|
224
|
+
amount: '4.01',
|
225
|
+
invoice_number: '1701',
|
226
|
+
register_number: '35',
|
227
|
+
merchant_transaction_id: '165901',
|
228
|
+
card_acceptor_terminal_id: '3',
|
229
|
+
ecommerce_transaction_indicator: nil
|
230
|
+
}
|
231
|
+
)
|
232
|
+
|
233
|
+
result[:approval_status] # 'APPROVED'
|
234
|
+
result[:token] # '608963'
|
235
|
+
result[:transaction_date] # '3/14/2016 8:12:50 PM'
|
236
|
+
result[:amount] # '4.01'
|
237
|
+
result[:card_number] # '************0026'
|
238
|
+
result[:cardholder] # 'John Doe'
|
239
|
+
result[:card_type] # '4'
|
240
|
+
```
|
241
|
+
|
242
|
+
### Sale
|
243
|
+
|
244
|
+
Charges a credit or debit card
|
245
|
+
|
246
|
+
```ruby
|
247
|
+
result = @client.sale(
|
248
|
+
{
|
249
|
+
source: 'Keyed',
|
250
|
+
card_number: '4012000033330026',
|
251
|
+
expiration_date: '1218',
|
252
|
+
card_holder: 'John Doe',
|
253
|
+
avs_street_address: '1 Federal Street',
|
254
|
+
avs_zip_code: '02110',
|
255
|
+
card_verification_value: '123'
|
256
|
+
}, {
|
257
|
+
amount: '1.05',
|
258
|
+
cashback_amount: '0.00',
|
259
|
+
surcharge_amount: '0.00',
|
260
|
+
tax_amount: '0.00',
|
261
|
+
invoice_number: '1556',
|
262
|
+
purchase_order_number: '17801',
|
263
|
+
customer_code: '20',
|
264
|
+
register_number: '35',
|
265
|
+
merchant_transaction_id: '166901',
|
266
|
+
card_acceptor_terminal_id: '3',
|
267
|
+
enable_partial_authorization: 'False',
|
268
|
+
force_duplicate: 'False',
|
269
|
+
ecommerce_transaction_indicator: nil
|
270
|
+
}
|
271
|
+
)
|
272
|
+
|
273
|
+
result[:approval_status] # 'APPROVED'
|
274
|
+
result[:token] # '608957'
|
275
|
+
result[:authorization_code] # 'OK775C'
|
276
|
+
result[:transaction_date] # '3/14/2016 7:57:22 PM'
|
277
|
+
result[:amount] # '1.05'
|
278
|
+
result[:card_number] # '************0026'
|
279
|
+
result[:cardholder] # 'John Doe'
|
280
|
+
result[:card_type] # '4'
|
281
|
+
result[:avs_response] # 'Y'
|
282
|
+
```
|
283
|
+
|
284
|
+
### SettleBatch
|
285
|
+
|
286
|
+
Batches out a merchant’s outstanding transactions for settlement.
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
result = @client.settle_batch
|
290
|
+
|
291
|
+
result[:batch_status] # 'SUCCESS'
|
292
|
+
result[:authorization_code] # '0314160001'
|
293
|
+
result[:batch_amount] # '2.19'
|
294
|
+
result[:transaction_count] # '8'
|
295
|
+
result[:transaction_date] # '3/14/2016 8:28:30 PM'
|
296
|
+
```
|
297
|
+
|
298
|
+
### UnboardCard
|
299
|
+
|
300
|
+
Removes existing payment information from the Merchantware Vault
|
301
|
+
|
302
|
+
```ruby
|
303
|
+
result = @client.unboard_card({ vault_token: "MYTOKENVALUEX" })
|
304
|
+
|
305
|
+
result[:vault_token] # 'MYTOKENVALUEX'
|
306
|
+
```
|
307
|
+
|
308
|
+
### Void
|
309
|
+
|
310
|
+
Voids a prior unsettled transaction
|
311
|
+
|
312
|
+
```ruby
|
313
|
+
result = @client.void({
|
314
|
+
token: "608973",
|
315
|
+
register_number: '35',
|
316
|
+
merchant_transaction_id: '167901',
|
317
|
+
card_acceptor_terminal_id: '3'
|
318
|
+
})
|
319
|
+
|
320
|
+
result[:approval_status] # 'APPROVED'
|
321
|
+
result[:token] # '608974'
|
322
|
+
result[:authorization_code] # 'VOID'
|
323
|
+
result[:transaction_date] # '3/14/2016 8:30:18 PM'
|
324
|
+
```
|
325
|
+
|
326
|
+
All Credit transactions are supported. Check and GiftCard transactions coming soon.
|
327
|
+
[Cayan Merchantware API Docs](https://cayan.com/developers/merchantware/merchantware-4-5/credit)
|
328
|
+
|
329
|
+
##
|
330
|
+
|
331
|
+
## Development
|
332
|
+
|
333
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
334
|
+
|
335
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
336
|
+
|
337
|
+
## Contributing
|
338
|
+
|
339
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cohubinc/cayan-ruby.
|
340
|
+
|
341
|
+
## Disclaimer
|
342
|
+
|
343
|
+
This software is not developed by or supported by Cayan & TSYS.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cayan"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/cayan.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'cayan/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'cayan'
|
7
|
+
spec.version = Cayan::VERSION
|
8
|
+
spec.authors = ['Cohub, Inc.']
|
9
|
+
spec.email = ['engineering@cohub.com']
|
10
|
+
|
11
|
+
spec.summary = %q{Ruby gem to communicate with Cayan's API's}
|
12
|
+
spec.description = %q{API wrapper for communicating with Cayan's API's}
|
13
|
+
spec.homepage = 'https://github.com/cohubinc/cayan-ruby'
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = 'exe'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
25
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
26
|
+
spec.add_development_dependency 'pry', '0.11.3'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'webmock', '~> 3.4.2'
|
29
|
+
|
30
|
+
spec.add_dependency 'savon', '~> 2.12.0'
|
31
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'savon'
|
2
|
+
|
3
|
+
module Cayan
|
4
|
+
module Merchantware
|
5
|
+
module Credit
|
6
|
+
class Client
|
7
|
+
@client = nil
|
8
|
+
attr_accessor :credentials
|
9
|
+
|
10
|
+
def initialize(credentials)
|
11
|
+
@credentials = credentials
|
12
|
+
@client = Savon.client(
|
13
|
+
wsdl: 'https://ps1.merchantware.net/Merchantware/ws/RetailTransaction/v45/Credit.asmx?WSDL',
|
14
|
+
convert_request_keys_to: :camelcase
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def with_credentials(hash)
|
19
|
+
hash.merge({
|
20
|
+
credentials: credentials
|
21
|
+
})
|
22
|
+
end
|
23
|
+
|
24
|
+
def board_card(payment_data)
|
25
|
+
response = @client.call(:board_card, message: with_credentials({
|
26
|
+
payment_data: payment_data
|
27
|
+
}))
|
28
|
+
|
29
|
+
response.body[:board_card_response][:board_card_result]
|
30
|
+
end
|
31
|
+
|
32
|
+
def find_boarded_card(vault_token_request)
|
33
|
+
response = @client.call(:find_boarded_card, message: with_credentials({
|
34
|
+
request: vault_token_request
|
35
|
+
}))
|
36
|
+
|
37
|
+
response.body[:find_boarded_card_response][:find_boarded_card_result]
|
38
|
+
end
|
39
|
+
|
40
|
+
def adjust_tip(tip_request)
|
41
|
+
response = @client.call(:adjust_tip, message: with_credentials({
|
42
|
+
request: tip_request
|
43
|
+
}))
|
44
|
+
|
45
|
+
response.body[:adjust_tip_response][:adjust_tip_result]
|
46
|
+
end
|
47
|
+
|
48
|
+
def attach_signature(signature_request)
|
49
|
+
response = @client.call(:attach_signature, message: with_credentials({
|
50
|
+
request: signature_request
|
51
|
+
}))
|
52
|
+
|
53
|
+
response.body[:attach_signature_response][:attach_signature_result]
|
54
|
+
end
|
55
|
+
|
56
|
+
def authorize(payment_data, authorization_request)
|
57
|
+
response = @client.call(:authorize, message: with_credentials({
|
58
|
+
payment_data: payment_data,
|
59
|
+
request: authorization_request
|
60
|
+
}))
|
61
|
+
|
62
|
+
response.body[:authorize_response][:authorize_result]
|
63
|
+
end
|
64
|
+
|
65
|
+
def capture(capture_request)
|
66
|
+
response = @client.call(:capture, message: with_credentials({
|
67
|
+
request: capture_request
|
68
|
+
}))
|
69
|
+
|
70
|
+
response.body[:capture_response][:capture_result]
|
71
|
+
end
|
72
|
+
|
73
|
+
def update_boarded_card(update_boarded_card_request)
|
74
|
+
response = @client.call(:update_boarded_card, message: with_credentials({
|
75
|
+
request: update_boarded_card_request
|
76
|
+
}))
|
77
|
+
|
78
|
+
response.body[:update_boarded_card_response][:update_boarded_card_result]
|
79
|
+
end
|
80
|
+
|
81
|
+
def force_capture(payment_data, force_capture_request)
|
82
|
+
response = @client.call(:force_capture, message: with_credentials({
|
83
|
+
payment_data: payment_data,
|
84
|
+
request: force_capture_request
|
85
|
+
}))
|
86
|
+
|
87
|
+
response.body[:force_capture_response][:force_capture_result]
|
88
|
+
end
|
89
|
+
|
90
|
+
def refund(payment_data, refund_request)
|
91
|
+
response = @client.call(:refund, message: with_credentials({
|
92
|
+
payment_data: payment_data,
|
93
|
+
request: refund_request
|
94
|
+
}))
|
95
|
+
|
96
|
+
response.body[:refund_response][:refund_result]
|
97
|
+
end
|
98
|
+
|
99
|
+
def sale(payment_data, sale_request)
|
100
|
+
response = @client.call(:sale, message: with_credentials({
|
101
|
+
payment_data: payment_data,
|
102
|
+
request: sale_request
|
103
|
+
}))
|
104
|
+
|
105
|
+
response.body[:sale_response][:sale_result]
|
106
|
+
end
|
107
|
+
|
108
|
+
def settle_batch
|
109
|
+
response = @client.call(:settle_batch, message: with_credentials({}))
|
110
|
+
|
111
|
+
response.body[:settle_batch_response][:settle_batch_result]
|
112
|
+
end
|
113
|
+
|
114
|
+
def unboard_card(vault_token_request)
|
115
|
+
response = @client.call(:unboard_card, message: with_credentials({
|
116
|
+
request: vault_token_request
|
117
|
+
}))
|
118
|
+
|
119
|
+
response.body[:unboard_card_response][:unboard_card_result]
|
120
|
+
end
|
121
|
+
|
122
|
+
def void(void_request)
|
123
|
+
response = @client.call(:void, message: with_credentials({
|
124
|
+
request: void_request
|
125
|
+
}))
|
126
|
+
|
127
|
+
response.body[:void_response][:void_result]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
data/lib/cayan.rb
ADDED
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cayan
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cohub, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-10-26 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: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.11.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.11.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.4.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.4.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: savon
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.12.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.12.0
|
97
|
+
description: API wrapper for communicating with Cayan's API's
|
98
|
+
email:
|
99
|
+
- engineering@cohub.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- Gemfile.lock
|
108
|
+
- MIT-LICENSE
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- bin/console
|
112
|
+
- bin/setup
|
113
|
+
- cayan.gemspec
|
114
|
+
- lib/cayan.rb
|
115
|
+
- lib/cayan/merchantware.rb
|
116
|
+
- lib/cayan/merchantware/credit/client.rb
|
117
|
+
- lib/cayan/version.rb
|
118
|
+
homepage: https://github.com/cohubinc/cayan-ruby
|
119
|
+
licenses: []
|
120
|
+
metadata: {}
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 2.5.2.3
|
138
|
+
signing_key:
|
139
|
+
specification_version: 4
|
140
|
+
summary: Ruby gem to communicate with Cayan's API's
|
141
|
+
test_files: []
|