paycargo 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eadbc8deff19a5208533ae2043ac748cd15e215c5b6007ee0e4d4b2f4fab2388
4
- data.tar.gz: be92bb1cf5be837618a41855f0e14b618410da5251bca4f31b2fb9abe2cb2cea
3
+ metadata.gz: 242ccd14ca0288d61e36ef885ef134cf1040210b50adbd948cb1b8c55ae1b4b1
4
+ data.tar.gz: 7552ecb703ed4632f86fd37e9b0e5fd2b065352a65a45bf2bc038609ece3f7c9
5
5
  SHA512:
6
- metadata.gz: 7f75b05c95bb2f68cf3bb9ad0fb98d4d2facbc478ed382f2902aa9f12ef05b3245983d84ee4a223bc3c7ccda87f6bf5366e8395a7733dd6e6f6b758740ee7a2f
7
- data.tar.gz: 16173dbe091c5e236b2cab4f302869f558fff96ee5de11dae12f79e951cd525e880c10e46b9e8b298948f376fac615ae54ae468931101e45e4ab6062d7bb53c2
6
+ metadata.gz: 7740dd08fa7e37c8ad7cb763411189db79e749afebff16fc23b07babe41039606bb893568ef161bfff346b50436a28902f2c4e7ed015437b6b14ccda2fe613a0
7
+ data.tar.gz: 7308cda5dbd16fb7b0c2701df5b5aaad0a40b8cb790d3124e9b1339a1c0486ae5fd6a1be20c4f11dbc0c9d8fe486839081b58205592324a7a18c67914f315f5b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
- ## [Unreleased]
2
-
3
1
  ## [0.1.0] - 2022-02-04
4
2
 
5
3
  - Initial release
4
+
5
+ ## [0.1.1] - 2022-02-07
6
+
7
+ - Add more resources
data/README.org CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
  Paycargo is a ruby gem client library to talk with Paycargo API. Paycargo wraps the Paycargos's REST API and follows Ruby convention.
10
10
 
11
+ [[https://badge.fury.io/rb/vizion.svg]] [[https://api.codeclimate.com/v1/badges/47845e928292f554631a/maintainability.svg]]
12
+
11
13
  ** Quik start
12
14
 
13
15
  Install via Rubygems
@@ -42,6 +44,24 @@ client.transactions.list()
42
44
  *** Consuming resources
43
45
  Most methods return a =Resource= object which provides dot notation and [] access for fields returned in the API response.
44
46
 
47
+ **** User
48
+
49
+ This resource allows you to send user credentials, if login success you receive a JWT token as a response for sending future requests to this API.
50
+ *Token validity time is 8 hours.*
51
+ #+begin_src ruby
52
+ client.users.login(username: 'username', password: 'password')
53
+ #+end_src
54
+
55
+ This resource allows you to retrieve user information. You need to pass a valid user id so as JWT token. Only users of your account (or your branches if you are a headquarter) are retrievable.
56
+ #+begin_src ruby
57
+ client.user.retreive(userId: 272360)
58
+ #+end_src
59
+
60
+ Retrieve a list of permissions for the selected user. Endpoint requires to pass a valid user id parameter.
61
+ #+begin_src ruby
62
+ client.users.permissions(272360)
63
+ #+end_src
64
+
45
65
  **** Transactions
46
66
 
47
67
  Get all Transactions for a client.
@@ -86,6 +106,11 @@ Approve a Transaction
86
106
  client.transactions.apporve(489479, paymentType: 'OVERNIGHT')
87
107
  #+end_src
88
108
 
109
+ Batch Approves a list of transactions, for the same Vendor. Available payment methods: OVERNIGHT, PREPAID.
110
+ #+begin_src ruby
111
+ client.transactions.batch_approve(batchPaymentType: 'OVERNIGHT', transactionIds: '515168,515169')
112
+ #+end_src
113
+
89
114
  Puting a transaction to =proof=
90
115
  #+begin_src ruby
91
116
  client.transactions.proof(500744)
@@ -110,7 +135,12 @@ client.transactions.fees(
110
135
  + =vendorID=: vendor ID
111
136
  + =total=: total amount used to calculate fees for PAYCARGO_CREDIT and CREDITCARD payment type.
112
137
 
113
- **** Funds
138
+ Void Transaction
139
+ #+begin_src ruby
140
+ client.transactions.void(483212)
141
+ #+end_src
142
+
143
+ **** Payer
114
144
 
115
145
  Get Funds Availability
116
146
  #+begin_src ruby
@@ -121,6 +151,18 @@ This endpoint retrieves the following data, per payer, per payment method:
121
151
  + get funds availability
122
152
  + get funds limit
123
153
 
154
+ **** Vendor
155
+
156
+ Get all vendors
157
+ #+begin_src ruby
158
+ client.vendors.list()
159
+ #+end_src
160
+
161
+ Get vendor by id
162
+ #+begin_src ruby
163
+ client.vendors.retreive(279824)
164
+ #+end_src
165
+
124
166
  **** Reports
125
167
 
126
168
  Get Payer ACH Report
@@ -157,4 +199,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/lepepe
157
199
 
158
200
  ** License
159
201
 
160
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
202
+ The gem is available as open source under the terms of the [[https://opensource.org/licenses/MIT][MIT License]].
data/docs/index.html CHANGED
@@ -3,7 +3,7 @@
3
3
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5
5
  <head>
6
- <!-- 2022-02-07 Mon 16:17 -->
6
+ <!-- 2022-02-07 Mon 22:20 -->
7
7
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1" />
9
9
  <title>Paycargo</title>
@@ -208,21 +208,23 @@
208
208
  <h2>Table of Contents</h2>
209
209
  <div id="text-table-of-contents" role="doc-toc">
210
210
  <ul>
211
- <li><a href="#orgaffc9ae">Quik start</a>
211
+ <li><a href="#org7085458">Quik start</a>
212
212
  <ul>
213
- <li><a href="#org30d08d4">Making requests</a></li>
214
- <li><a href="#org10e0038">Consuming resources</a>
213
+ <li><a href="#org02026c0">Making requests</a></li>
214
+ <li><a href="#orgeb8d7c8">Consuming resources</a>
215
215
  <ul>
216
- <li><a href="#org4159966">Transactions</a></li>
217
- <li><a href="#org3effeb7">Funds</a></li>
218
- <li><a href="#org4939efc">Reports</a></li>
216
+ <li><a href="#org45a5c8a">User</a></li>
217
+ <li><a href="#org7a65695">Transactions</a></li>
218
+ <li><a href="#orgab19021">Payer</a></li>
219
+ <li><a href="#orgfe96115">Vendor</a></li>
220
+ <li><a href="#orgcfc8e5c">Reports</a></li>
219
221
  </ul>
220
222
  </li>
221
223
  </ul>
222
224
  </li>
223
- <li><a href="#org43e6090">Development</a></li>
224
- <li><a href="#orgb5b16b4">Contributing</a></li>
225
- <li><a href="#org624bcb1">License</a></li>
225
+ <li><a href="#org3e42773">Development</a></li>
226
+ <li><a href="#orgc0b92fc">Contributing</a></li>
227
+ <li><a href="#org60410f6">License</a></li>
226
228
  </ul>
227
229
  </div>
228
230
  </div>
@@ -230,9 +232,13 @@
230
232
  Paycargo is a ruby gem client library to talk with Paycargo API. Paycargo wraps the Paycargos&rsquo;s REST API and follows Ruby convention.
231
233
  </p>
232
234
 
233
- <div id="outline-container-orgaffc9ae" class="outline-2">
234
- <h2 id="orgaffc9ae">Quik start</h2>
235
- <div class="outline-text-2" id="text-orgaffc9ae">
235
+ <p>
236
+ <img src="https://badge.fury.io/rb/vizion.svg" alt="vizion.svg" /> <img src="https://api.codeclimate.com/v1/badges/47845e928292f554631a/maintainability.svg" alt="maintainability.svg" />
237
+ </p>
238
+
239
+ <div id="outline-container-org7085458" class="outline-2">
240
+ <h2 id="org7085458">Quik start</h2>
241
+ <div class="outline-text-2" id="text-org7085458">
236
242
  <p>
237
243
  Install via Rubygems
238
244
  </p>
@@ -267,9 +273,9 @@ Access the library in Ruby:
267
273
  </div>
268
274
  </div>
269
275
 
270
- <div id="outline-container-org30d08d4" class="outline-3">
271
- <h3 id="org30d08d4">Making requests</h3>
272
- <div class="outline-text-3" id="text-org30d08d4">
276
+ <div id="outline-container-org02026c0" class="outline-3">
277
+ <h3 id="org02026c0">Making requests</h3>
278
+ <div class="outline-text-3" id="text-org02026c0">
273
279
  <p>
274
280
  Initialize client to make requets:
275
281
  </p>
@@ -282,17 +288,47 @@ client.transactions.list()
282
288
  </div>
283
289
  </div>
284
290
 
285
- <div id="outline-container-org10e0038" class="outline-3">
286
- <h3 id="org10e0038">Consuming resources</h3>
287
- <div class="outline-text-3" id="text-org10e0038">
291
+ <div id="outline-container-orgeb8d7c8" class="outline-3">
292
+ <h3 id="orgeb8d7c8">Consuming resources</h3>
293
+ <div class="outline-text-3" id="text-orgeb8d7c8">
288
294
  <p>
289
295
  Most methods return a <code>Resource</code> object which provides dot notation and [] access for fields returned in the API response.
290
296
  </p>
291
297
  </div>
292
298
 
293
- <div id="outline-container-org4159966" class="outline-4">
294
- <h4 id="org4159966">Transactions</h4>
295
- <div class="outline-text-4" id="text-org4159966">
299
+ <div id="outline-container-org45a5c8a" class="outline-4">
300
+ <h4 id="org45a5c8a">User</h4>
301
+ <div class="outline-text-4" id="text-org45a5c8a">
302
+ <p>
303
+ This resource allows you to send user credentials, if login success you receive a JWT token as a response for sending future requests to this API.
304
+ <b>Token validity time is 8 hours.</b>
305
+ </p>
306
+ <div class="org-src-container">
307
+ <pre class="src src-ruby">client.users.login(<span style="color: #8be9fd;">username:</span> <span style="color: #f1fa8c;">'username'</span>, <span style="color: #8be9fd;">password:</span> <span style="color: #f1fa8c;">'password'</span>)
308
+ </pre>
309
+ </div>
310
+
311
+ <p>
312
+ This resource allows you to retrieve user information. You need to pass a valid user id so as JWT token. Only users of your account (or your branches if you are a headquarter) are retrievable.
313
+ </p>
314
+ <div class="org-src-container">
315
+ <pre class="src src-ruby">client.user.retreive(<span style="color: #8be9fd;">userId:</span> <span style="color: #bd93f9; font-weight: bold;">272360</span>)
316
+ </pre>
317
+ </div>
318
+
319
+ <p>
320
+ Retrieve a list of permissions for the selected user. Endpoint requires to pass a valid user id parameter.
321
+ </p>
322
+ <div class="org-src-container">
323
+ <pre class="src src-ruby">client.users.permissions(<span style="color: #bd93f9; font-weight: bold;">272360</span>)
324
+ </pre>
325
+ </div>
326
+ </div>
327
+ </div>
328
+
329
+ <div id="outline-container-org7a65695" class="outline-4">
330
+ <h4 id="org7a65695">Transactions</h4>
331
+ <div class="outline-text-4" id="text-org7a65695">
296
332
  <p>
297
333
  Get all Transactions for a client.
298
334
  </p>
@@ -353,6 +389,14 @@ Approve a Transaction
353
389
  </pre>
354
390
  </div>
355
391
 
392
+ <p>
393
+ Batch Approves a list of transactions, for the same Vendor. Available payment methods: OVERNIGHT, PREPAID.
394
+ </p>
395
+ <div class="org-src-container">
396
+ <pre class="src src-ruby">client.transactions.batch_approve(<span style="color: #8be9fd;">batchPaymentType:</span> <span style="color: #f1fa8c;">'OVERNIGHT'</span>, <span style="color: #8be9fd;">transactionIds:</span> <span style="color: #f1fa8c;">'515168,515169'</span>)
397
+ </pre>
398
+ </div>
399
+
356
400
  <p>
357
401
  Puting a transaction to <code>proof</code>
358
402
  </p>
@@ -384,12 +428,20 @@ Get transactions fees
384
428
  <li><code>vendorID</code>: vendor ID</li>
385
429
  <li><code>total</code>: total amount used to calculate fees for PAYCARGO<sub>CREDIT</sub> and CREDITCARD payment type.</li>
386
430
  </ul>
431
+
432
+ <p>
433
+ Void Transaction
434
+ </p>
435
+ <div class="org-src-container">
436
+ <pre class="src src-ruby">client.transactions.void(<span style="color: #bd93f9; font-weight: bold;">483212</span>)
437
+ </pre>
438
+ </div>
387
439
  </div>
388
440
  </div>
389
441
 
390
- <div id="outline-container-org3effeb7" class="outline-4">
391
- <h4 id="org3effeb7">Funds</h4>
392
- <div class="outline-text-4" id="text-org3effeb7">
442
+ <div id="outline-container-orgab19021" class="outline-4">
443
+ <h4 id="orgab19021">Payer</h4>
444
+ <div class="outline-text-4" id="text-orgab19021">
393
445
  <p>
394
446
  Get Funds Availability
395
447
  </p>
@@ -408,9 +460,30 @@ This endpoint retrieves the following data, per payer, per payment method:
408
460
  </div>
409
461
  </div>
410
462
 
411
- <div id="outline-container-org4939efc" class="outline-4">
412
- <h4 id="org4939efc">Reports</h4>
413
- <div class="outline-text-4" id="text-org4939efc">
463
+ <div id="outline-container-orgfe96115" class="outline-4">
464
+ <h4 id="orgfe96115">Vendor</h4>
465
+ <div class="outline-text-4" id="text-orgfe96115">
466
+ <p>
467
+ Get all vendors
468
+ </p>
469
+ <div class="org-src-container">
470
+ <pre class="src src-ruby">client.vendors.list()
471
+ </pre>
472
+ </div>
473
+
474
+ <p>
475
+ Get vendor by id
476
+ </p>
477
+ <div class="org-src-container">
478
+ <pre class="src src-ruby">client.vendors.retreive(<span style="color: #bd93f9; font-weight: bold;">279824</span>)
479
+ </pre>
480
+ </div>
481
+ </div>
482
+ </div>
483
+
484
+ <div id="outline-container-orgcfc8e5c" class="outline-4">
485
+ <h4 id="orgcfc8e5c">Reports</h4>
486
+ <div class="outline-text-4" id="text-orgcfc8e5c">
414
487
  <p>
415
488
  Get Payer ACH Report
416
489
  </p>
@@ -442,9 +515,9 @@ Get Payer ACH Report
442
515
  </div>
443
516
  </div>
444
517
 
445
- <div id="outline-container-org43e6090" class="outline-2">
446
- <h2 id="org43e6090">Development</h2>
447
- <div class="outline-text-2" id="text-org43e6090">
518
+ <div id="outline-container-org3e42773" class="outline-2">
519
+ <h2 id="org3e42773">Development</h2>
520
+ <div class="outline-text-2" id="text-org3e42773">
448
521
  <p>
449
522
  After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
450
523
  </p>
@@ -455,27 +528,27 @@ To install this gem onto your local machine, run <code>bundle exec rake install<
455
528
  </div>
456
529
  </div>
457
530
 
458
- <div id="outline-container-orgb5b16b4" class="outline-2">
459
- <h2 id="orgb5b16b4">Contributing</h2>
460
- <div class="outline-text-2" id="text-orgb5b16b4">
531
+ <div id="outline-container-orgc0b92fc" class="outline-2">
532
+ <h2 id="orgc0b92fc">Contributing</h2>
533
+ <div class="outline-text-2" id="text-orgc0b92fc">
461
534
  <p>
462
535
  Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/lepepe/paycargo">https://github.com/lepepe/paycargo</a>.
463
536
  </p>
464
537
  </div>
465
538
  </div>
466
539
 
467
- <div id="outline-container-org624bcb1" class="outline-2">
468
- <h2 id="org624bcb1">License</h2>
469
- <div class="outline-text-2" id="text-org624bcb1">
540
+ <div id="outline-container-org60410f6" class="outline-2">
541
+ <h2 id="org60410f6">License</h2>
542
+ <div class="outline-text-2" id="text-org60410f6">
470
543
  <p>
471
- The gem is available as open source under the terms of the [MIT License](<a href="https://opensource.org/licenses/MIT">https://opensource.org/licenses/MIT</a>).
544
+ The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.
472
545
  </p>
473
546
  </div>
474
547
  </div>
475
548
  </div>
476
549
  <div id="postamble" class="status">
477
550
  <p class="author">Author: Jose Perez</p>
478
- <p class="date">Created: 2022-02-07 Mon 16:17</p>
551
+ <p class="date">Created: 2022-02-07 Mon 22:20</p>
479
552
  </div>
480
553
  </body>
481
554
  </html>
@@ -24,6 +24,14 @@ module Paycargo
24
24
  ReportsResource.new(self)
25
25
  end
26
26
 
27
+ def users
28
+ UsersResource.new(self)
29
+ end
30
+
31
+ def vendors
32
+ VendorsResource.new(self)
33
+ end
34
+
27
35
  def connection
28
36
  @connection ||= Faraday.new do |con|
29
37
  con.url_prefix = BASE_URL
@@ -0,0 +1,4 @@
1
+ module Paycargo
2
+ class User < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Paycargo
2
+ class Vendor < Object
3
+ end
4
+ end
@@ -42,6 +42,14 @@ module Paycargo
42
42
  Transaction.new put_request("transaction/pay/#{id}").body
43
43
  end
44
44
 
45
+ #Batch Approves a list of transactions, for the same Vendor. Available payment methods: OVERNIGHT, PREPAID.
46
+ #BODY
47
+ #- batchPaymentType: OVERNIGHT
48
+ #- transactionIds: 515168,515169
49
+ def batch_approve(**attributes)
50
+ Transaction.new put_request("transactions/batch/pay", body: attributes).body
51
+ end
52
+
45
53
  #Proof Transaction
46
54
  #PUTing a transaction to 'proof'
47
55
  def proof(id)
@@ -63,8 +71,20 @@ module Paycargo
63
71
 
64
72
  #Get Fees for transaction. paymentType and transactionId OR paymentType
65
73
  #and vendorId and payerId are required to getFees
74
+ #PARAMS
75
+ #- paymentType: 'OVERNIGHT',
76
+ #- transactionId: 123456,
77
+ #- numberOfTransactions: 2,
78
+ #- payerId: 123456,
79
+ #- vendorId: 123456,
80
+ #- total: 70
66
81
  def fees(**params)
67
- get_request("transaction/fees", params: params).body
82
+ Transaction.new get_request("transaction/fees", params: params).body
83
+ end
84
+
85
+ # Void transaction
86
+ def void(id, **params)
87
+ Transaction.new put_request("transaction/void/#{id}", params: params).body
68
88
  end
69
89
 
70
90
  end
@@ -0,0 +1,23 @@
1
+ module Paycargo
2
+ class UsersResource < Resource
3
+ #This endpoint allows you to send user credentials, if login success you receive a
4
+ #JWT token as a response for sending future requests to this API. Token validity
5
+ #time is 8 hours.
6
+ def login(**attributes)
7
+ User.new post_request("login", body: attributes).body
8
+ end
9
+
10
+ #This GET endpoint allows you to retrieve user information. You need to pass a
11
+ #valid user id so as JWT token. Only users of your account (or your branches
12
+ #if you are a headquarter) are retrievable.
13
+ def retreive(**params)
14
+ User.new get_request("user", params: params).body
15
+ end
16
+
17
+ #This GET endpoint allows you to retrieve a list of permissions for the selected
18
+ #user. Endpoint requires to pass a valid user id parameter.
19
+ def permissions(id, **params)
20
+ get_request("user/#{id}/permissions", params: params).body
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module Paycargo
2
+ class VendorsResource < Resource
3
+ # List all vendors:w
4
+ def list(**params)
5
+ Collection.from_response get_request("vendors", params: params), type: Vendor
6
+ end
7
+
8
+ # Get vendor by id
9
+ def retreive(id, **params)
10
+ Vendor.new get_request("vendor/#{id}", params: params).body
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paycargo
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/paycargo.rb CHANGED
@@ -12,8 +12,12 @@ module Paycargo
12
12
  autoload :TransactionsResource, "paycargo/resources/transactions"
13
13
  autoload :PayerResource, "paycargo/resources/payer"
14
14
  autoload :ReportsResource, "paycargo/resources/reports"
15
+ autoload :UsersResource, "paycargo/resources/users"
16
+ autoload :VendorsResource, "paycargo/resources/vendors"
15
17
 
16
18
  autoload :Transaction, "paycargo/objects/transaction.rb"
17
19
  autoload :Payer, "paycargo/objects/payer.rb"
18
20
  autoload :Report, "paycargo/objects/report.rb"
21
+ autoload :User, "paycargo/objects/user.rb"
22
+ autoload :Vendor, "paycargo/objects/vendor.rb"
19
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paycargo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Perez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-07 00:00:00.000000000 Z
11
+ date: 2022-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -65,10 +65,14 @@ files:
65
65
  - lib/paycargo/objects/payer.rb
66
66
  - lib/paycargo/objects/report.rb
67
67
  - lib/paycargo/objects/transaction.rb
68
+ - lib/paycargo/objects/user.rb
69
+ - lib/paycargo/objects/vendor.rb
68
70
  - lib/paycargo/resource.rb
69
71
  - lib/paycargo/resources/payer.rb
70
72
  - lib/paycargo/resources/reports.rb
71
73
  - lib/paycargo/resources/transactions.rb
74
+ - lib/paycargo/resources/users.rb
75
+ - lib/paycargo/resources/vendors.rb
72
76
  - lib/paycargo/version.rb
73
77
  - sig/paycargo.rbs
74
78
  homepage: https://lepepe.github.io/paycargo
@@ -77,7 +81,8 @@ licenses:
77
81
  metadata:
78
82
  allowed_push_host: https://rubygems.org
79
83
  homepage_uri: https://lepepe.github.io/paycargo
80
- source_code_uri: https://lepepe.github.io/paycargo
84
+ source_code_uri: https://github.com/lepepe/paycargo
85
+ changelog_uri: https://github.com/lepepe/paycargo/blob/main/CHANGELOG.md
81
86
  post_install_message:
82
87
  rdoc_options: []
83
88
  require_paths: