Sha256: e1bc1b65e5e96d6d19f9313de2dffcdcdfec3e833aa094a11400159fa63c2aba

Contents?: true

Size: 788 Bytes

Versions: 4

Compression:

Stored size: 788 Bytes

Contents

module MPower
  class DirectPay
    include MPower::Utilities
    attr_accessor :status, :response_text, :response_code, :transaction_id, :description

    def credit_account(payee_account,amount)
      payload = {
        :account_alias => payee_account,
        :amount => amount
      }

      result = http_json_request(MPower::Setup.direct_pay_credit_base_url,payload)
      if result["response_code"] == "00"
        @transaction_id = result["transaction_id"]
        @description = result["description"]
        @response_code = result["response_code"]
        @status = MPower::SUCCESS
        true
      else
        @response_text = result["response_text"]
        @response_code = result["response_code"]
        @status = MPower::FAIL
        false
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mpower-1.2.0 lib/mpower/direct_pay.rb
mpower-1.1.2 lib/mpower/direct_pay.rb
mpower-1.1.1 lib/mpower/direct_pay.rb
mpower-1.1.0 lib/mpower/direct_pay.rb