Paycargo is a ruby gem client library to talk with Paycargo API. Paycargo wraps the Paycargos’s REST API and follows Ruby convention.
Install via Rubygems
gem install paycargo
Or add to your application’s Gemfile:
gem 'paycargo'
And then execute:
bundle install
Access the library in Ruby:
require 'paycargo'
Initialize client to make requets:
client = Paycargo::Client.new(token: "JWT TOKEN")
client.transactions.list()
Most methods return a Resource
object which provides dot notation and [] access for fields returned in the API response.
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. Token validity time is 8 hours.
client.users.login(username: 'username', password: 'password')
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.
client.user.retreive(userId: 272360)
Retrieve a list of permissions for the selected user. Endpoint requires to pass a valid user id parameter.
client.users.permissions(272360)
Get all Transactions for a client.
client.transactions.list()
Get a transaction by id
client.transactions.retreive(473943)
Get transaction by number
client.transactions.by_number(number: 9292323, vendorID: 279366)
Get transactions history
client.transactions.history(476296)
Create Transaction
client.transactions.create(
vendorId: 279546,
type: 'Other',
subcategory: 'I-432188',
number: '929-83294551',
departureDate: '2018-04-01',
arrivalDate: '2018-04-24',
total: 100,
direction: 'Outbound',
paymentDueDate: '2018-04-24',
hasArrived: 'Y',
shipperRefNumber: 'tdfgfdgfd'
)
Approve a Transaction
client.transactions.apporve(489479, paymentType: 'OVERNIGHT')
Batch Approves a list of transactions, for the same Vendor. Available payment methods: OVERNIGHT, PREPAID.
client.transactions.batch_approve(batchPaymentType: 'OVERNIGHT', transactionIds: '515168,515169')
Puting a transaction to proof
client.transactions.proof(500744)
Get transactions fees
client.transactions.fees(
paymentType: 'OVERNIGHT',
transactionId: 123456,
numberOfTransactions: 2,
payerId: 123456,
vendorId: 123456,
total: 70
)
paymentType
: payment type for transaction: OVERNIGHT, PREPAID, CREDITCARD, PAYCARGO_CREDIT.transactionId
: transaction id if exists.numberOfTransactions
: number of transaction. Used to define if batch flat fee can be applied.payerID
: payer IDvendorID
: vendor IDtotal
: total amount used to calculate fees for PAYCARGO_CREDIT and CREDITCARD payment type.
Void Transaction
client.transactions.void(483212)
Get Funds Availability
client.payer.funds(281783)
This endpoint retrieves the following data, per payer, per payment method:
- get funds availability
- get funds limit
Get all vendors
client.vendors.list()
Get vendor by id
client.vendors.retreive(279824)
Get Payer ACH Report
client.reports.payer(
startDate: '10/01/2020',
endDate: '11/01/2020',
client_id: 284347,
report_action_name: 'getACHReconciliation',
type: 'SHIPPER',
accountName: 'all'
)
fleet_id
: Account fleet id ( payerId)startDate
: Start Date in MM/DD/YYYY formatendDate
: End Date in MM/DD/YYYY formatclient_id
: Account client idreport_action_name
: PayCargo report type name, for ACH report : getACHReconciliationtype
: Account type : SHIPPER or CARRIERaccountName
: Account name of branch if any. Apply “all” to get data from branches for HQfleetLimit
: fleet_idproviderLimit
: provier_id
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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 the created tag, and push the gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/lepepe/paycargo.
The gem is available as open source under the terms of the MIT License.