No release in over a year
Orchard API client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.0
~> 1.21

Runtime

~> 2.6
 Project Readme

Orchard API Client

This api client integrates into appsNmobiles orchard payment solution

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add orchard-api-client-anm

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install orchard-api-client-anm

Usage

#load the gem class
  require 'orchard'

#Create a client object with the secret token, client token, and the url
  params = {
    secret_token: ENV['SECRET_TOKEN'],
    client_token: ENV['CLIENT_TOKEN'],
    url: ENV['ORCHARD_URL']
  }

  client = Orchard::ApiClient.new(params)

#Use client object for various api functions

#optional configuration configurations
  request_configurations = {
    timeout: 30
  }

#Send payment request

  randval_one = rand(999).to_s.center(3, rand(9).to_s)
  strtm = Time.new.strftime("%d%H%M%L")
  processing_id = strtm + randval_one
  trans_type = allowed_parameters['CTM(client to merchant)' / 'MTC(merchant to client)']
  nw = allowed_parameters['MTN','VOD','AIR']

  payment_request_payload = {
    customer_number: '0550000000',
    reference: 'AppsNmobile Pay',
    amount: '1',
    exttrid: processing_id,
    nw: 'MTN',
    trans_type: 'CTM',
    callback_url: '/',
    ts: Time.now.strftime("%Y-%m-%d %H:%M:%S"),
    client_id: ENV['SERVICE_ID'],
    voucher_code: ''
  }

  response = client.send_payment_request(payment_request_payload, request_configurations)

#Send Sms
  sms_payload = {
    sender_id: 'ANM',
    recipient_number: '0550000000',
    msg_body: 'Sample text message',
    trans_type: 'SMS',
    service_id: ENV['SERVICE_ID']
  }

  response = client.send_sms(sms_payload, request_configurations)