Module: OffsitePayments::Integrations::Pay2go
- Defined in:
- lib/offsite_payments/integrations/pay2go.rb
Defined Under Namespace
Classes: Helper, Notification
Class Method Summary
collapse
Class Method Details
.fetch_url_encode_data(fields) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/offsite_payments/integrations/pay2go.rb', line 34
def self.fetch_url_encode_data(fields)
check_fields = [:"Amt", :"MerchantID", :"MerchantOrderNo", :"TimeStamp", :"Version"]
raw_data = fields.sort.map{|field, value|
"#{field}=#{value}" if check_fields.include?(field.to_sym)
}.compact.join('&')
hash_raw_data = "HashKey=#{OffsitePayments::Integrations::Pay2go.hash_key}&#{raw_data}&HashIV=#{OffsitePayments::Integrations::Pay2go.hash_iv}"
sha256 = Digest::SHA256.new
sha256.update hash_raw_data.force_encoding("utf-8")
sha256.hexdigest.upcase
end
|
.notification(post) ⇒ Object
26
27
28
|
# File 'lib/offsite_payments/integrations/pay2go.rb', line 26
def self.notification(post)
Notification.new(post)
end
|
.service_url ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/offsite_payments/integrations/pay2go.rb', line 12
def self.service_url
mode = OffsitePayments.mode
case mode
when :production
'https://core.spgateway.com/MPG/mpg_gateway'
when :development
'https://ccore.spgateway.com/MPG/mpg_gateway'
when :test
'https://ccore.spgateway.com/MPG/mpg_gateway'
else
raise StandardError, "Integration mode set to an invalid value: #{mode}"
end
end
|
.setup {|_self| ... } ⇒ Object
30
31
32
|
# File 'lib/offsite_payments/integrations/pay2go.rb', line 30
def self.setup
yield(self)
end
|