module Eghl

X.read A.new.read

Public Class Methods

payment_request() click to toggle source
# File lib/eghl.rb, line 22
def self.payment_request
 
              @Random = rand(1000..9999999)

             @Password = "sit12345"
             @ServiceID = "SIT"
             @PaymentID = "RoR" + "SIT" + "-" + (@Random).to_s
             @MerchantReturnURL = "http://arifall.my/eGHL/success_page.php"
          @MerchantApprovalURL = ""
          @MerchantUnApprovalURL = ""
              @MerchantCallBackURL = "http://arifall.my/eGHL/mp_callback.php"
              @Amount = "1.00"
              @CurrencyCode = "MYR"
          @CustIP = "113.210.6.150"
          @PageTimeout = "900"
          @CardNo = ""
          @Token = ""

          if @CardNo != ""
          @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout+@CardNo #all mandatory fields + cardno
              end

          if @Token != ""
          @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout+@Token #all mandatory fields + token
              end

          if @MerchantApprovalURL != ""
          @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantApprovalURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout #all mandatory fields + merchantapprovalurl
              end

          if @MerchantUnApprovalURL != ""
          @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantUnApprovalURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout #all mandatory fields + merchantunapprovalurl
              end

          if @MerchantCallBackURL != ""
          @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantCallBackURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout #all mandatory fields + merchantcallbackurl
              end    
             
                @Hashvalue = Digest::SHA256.hexdigest @Concat 

          puts "payment request hash value is : "+@Hashvalue
end
refund_request() click to toggle source
# File lib/eghl.rb, line 65
def self.refund_request

        @Random = rand(1000..9999999)

        @Password = "abc123"
        @ServiceID = "S22"
        @PaymentID = "RoR" + "SIT" + "-" + (@Random).to_s
    @Amount = "1.00"
        @CurrencyCode = "MYR"

    @Concat = @Password+@ServiceID+@PaymentID+@Amount+@CurrencyCode
      
        @Hashvalue = Digest::SHA256.hexdigest @Concat

    puts "refund request hash value is : "+@Hashvalue
end