eghl 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/eghl.rb +90 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c2706d75d34fc82d6523fb83fe884ae0d9f5b65
4
+ data.tar.gz: 551743b1f3d51c5fd7e30750dadbfb2a1869451d
5
+ SHA512:
6
+ metadata.gz: aa3908d5cb974e9893205a6ed772917233216c56746b059649a5011a3fcf46dbdcd7a7ac64b4ab4c729721b1486aeef41a09344ba5d4117ef06d7ca067408cfa
7
+ data.tar.gz: a3386805b45b6b236015ae5c0f2dd74c21f84e979462bfdcc1d121590b3db04e6421f71d1d0a3171c3b1e265f5858b9266989b8dac1b16b2a89f6e116ce2aa98
data/lib/eghl.rb ADDED
@@ -0,0 +1,90 @@
1
+ # module X
2
+ # extend self
3
+
4
+ # def read
5
+ # ...
6
+ # end
7
+ # end
8
+
9
+ # class A
10
+ # include X
11
+ # end
12
+
13
+ # X.read
14
+ # A.new.read
15
+
16
+
17
+ module Eghl
18
+ #extend self
19
+
20
+ require 'digest'
21
+
22
+ def self.payment_request
23
+
24
+ @Random = rand(1000..9999999)
25
+
26
+ @Password = "sit12345"
27
+ @ServiceID = "SIT"
28
+ @PaymentID = "RoR" + "SIT" + "-" + (@Random).to_s
29
+ @MerchantReturnURL = "http://arifall.my/eGHL/success_page.php"
30
+ @MerchantApprovalURL = ""
31
+ @MerchantUnApprovalURL = ""
32
+ @MerchantCallBackURL = "http://arifall.my/eGHL/mp_callback.php"
33
+ @Amount = "1.00"
34
+ @CurrencyCode = "MYR"
35
+ @CustIP = "113.210.6.150"
36
+ @PageTimeout = "900"
37
+ @CardNo = ""
38
+ @Token = ""
39
+
40
+ if @CardNo != ""
41
+ @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout+@CardNo #all mandatory fields + cardno
42
+ end
43
+
44
+ if @Token != ""
45
+ @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout+@Token #all mandatory fields + token
46
+ end
47
+
48
+ if @MerchantApprovalURL != ""
49
+ @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantApprovalURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout #all mandatory fields + merchantapprovalurl
50
+ end
51
+
52
+ if @MerchantUnApprovalURL != ""
53
+ @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantUnApprovalURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout #all mandatory fields + merchantunapprovalurl
54
+ end
55
+
56
+ if @MerchantCallBackURL != ""
57
+ @Concat = @Password+@ServiceID+@PaymentID+@MerchantReturnURL+@MerchantCallBackURL+@Amount+@CurrencyCode+@CustIP+@PageTimeout #all mandatory fields + merchantcallbackurl
58
+ end
59
+
60
+ @Hashvalue = Digest::SHA256.hexdigest @Concat
61
+
62
+ puts "payment request hash value is : "+@Hashvalue
63
+ end
64
+
65
+ def self.refund_request
66
+
67
+ @Random = rand(1000..9999999)
68
+
69
+ @Password = "abc123"
70
+ @ServiceID = "S22"
71
+ @PaymentID = "RoR" + "SIT" + "-" + (@Random).to_s
72
+ @Amount = "1.00"
73
+ @CurrencyCode = "MYR"
74
+
75
+ @Concat = @Password+@ServiceID+@PaymentID+@Amount+@CurrencyCode
76
+
77
+ @Hashvalue = Digest::SHA256.hexdigest @Concat
78
+
79
+ puts "refund request hash value is : "+@Hashvalue
80
+ end
81
+
82
+ end
83
+
84
+ # class A
85
+ # include Testgem_eghl
86
+ # end
87
+
88
+ Testgem_eghl.payment_request
89
+ Testgem_eghl.refund_request
90
+ #A.new.payment_request
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eghl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - LOH JYH YEONG
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-29 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: eghl gem for hashing - beta version
14
+ email: yeong-0809@hotmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/eghl.rb
20
+ homepage: http://rubygems.org/gems/eghl
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.6.14
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: testgem!
44
+ test_files: []