Class: OffsitePayments::Integrations::Pay2go::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Pay2go::Notification
- Defined in:
- lib/offsite_payments/integrations/pay2go.rb
Constant Summary collapse
- PARAMS_FIELDS =
%w( Status Message MerchantID Amt TradeNo MerchantOrderNo PaymentType RespondType CheckCode PayTime IP EscrowBank TokenUseStatus RespondCode Auth Card6No Card4No Inst InstFirst InstEach ECI PayBankCode PayerAccount5Code CodeNo BankCode Barcode_1 Barcode_2 Barcode_3 ExpireDate 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? 代替
102 103 104 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 102 def acknowledge checksum_ok? end |
#checksum_ok? ⇒ Boolean
110 111 112 113 114 115 116 117 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 110 def checksum_ok? raw_data = URI.encode_www_form OffsitePayments::Integrations::Pay2go::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
106 107 108 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 106 def complete? %w(SUCCESS CUSTOM).include? status end |
#success? ⇒ Boolean
95 96 97 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 95 def success? status == 'SUCCESS' end |