Module: Testgem_eghl

Extended by:
Testgem_eghl
Included in:
Testgem_eghl
Defined in:
lib/testgem_eghl.rb

Instance Method Summary collapse

Instance Method Details

#payment_requestObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/testgem_eghl.rb', line 22

def 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_requestObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/testgem_eghl.rb', line 65

def 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