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 end
if @Token != ""
@Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout+@Token end
if @MerchantApprovalURL != ""
@Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantApprovalURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout end
if @MerchantUnApprovalURL != ""
@Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantUnApprovalURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout end
if @MerchantCallBackURL != ""
@Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantCallBackURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout end
@Hashvalue = Digest::SHA256.hexdigest @Concat
puts "payment request hash value is : "+@Hashvalue
end
|