Class: OffsitePayments::Integrations::Pay2goPeriod::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Pay2goPeriod::Notification
- Defined in:
- lib/offsite_payments/integrations/pay2go_period.rb
Constant Summary collapse
- PARAMS_FIELDS =
%w( Status Message MerchantID MerchantOrderNo PeriodType authDate authTime dateArray PeriodTotalAmt PeriodFirstAmt PeriodAmt CheckCode )
Instance Method Summary collapse
-
#acknowledge ⇒ Object
TODO 使用查詢功能實作 acknowledge Pay2go 沒有遠端驗證功能, 而以 checksum_ok? 代替.
- #checksum_ok? ⇒ Boolean
- #complete? ⇒ Boolean
- #success? ⇒ Boolean
Instance Method Details
#acknowledge ⇒ Object
TODO 使用查詢功能實作 acknowledge Pay2go 沒有遠端驗證功能,而以 checksum_ok? 代替
93 94 95 |
# File 'lib/offsite_payments/integrations/pay2go_period.rb', line 93 def acknowledge checksum_ok? end |
#checksum_ok? ⇒ Boolean
101 102 103 104 105 106 107 108 |
# File 'lib/offsite_payments/integrations/pay2go_period.rb', line 101 def checksum_ok? raw_data = URI.encode_www_form OffsitePayments::Integrations::Pay2goPeriod::CHECK_CODE_FIELDS.sort.map { |field| [field, @params[field]] } hash_raw_data = "HashIV=#{OffsitePayments::Integrations::Pay2go.hash_iv}&#{raw_data}&HashKey=#{OffsitePayments::Integrations::Pay2go.hash_key}" Digest::SHA256.hexdigest(hash_raw_data).upcase == check_code end |
#complete? ⇒ Boolean
97 98 99 |
# File 'lib/offsite_payments/integrations/pay2go_period.rb', line 97 def complete? %w(SUCCESS CUSTOM).include? status end |
#success? ⇒ Boolean
86 87 88 |
# File 'lib/offsite_payments/integrations/pay2go_period.rb', line 86 def success? status == 'SUCCESS' end |