class OffsitePayments::Integrations::Pay2go::Notification

Attributes

_params[RW]

Public Instance Methods

acknowledge() click to toggle source

TODO 使用查詢功能實作 acknowledge 而以 checksum_ok? 代替

# File lib/offsite_payments/integrations/pay2go.rb, line 141
def acknowledge
  checksum_ok?
end
amt() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 179
def amt
  _params['Amt'].to_s
end
auth() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 230
def auth
  _params['Auth']
end
barcode_1() click to toggle source

barcode

# File lib/offsite_payments/integrations/pay2go.rb, line 277
def barcode_1
  _params['Barcode_1']
end
barcode_2() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 281
def barcode_2
  _params['Barcode_2']
end
barcode_3() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 285
def barcode_3
  _params['Barcode_3']
end
card_4no() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 238
def card_4no
  _params['Card4No']
end
card_6no() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 234
def card_6no
  _params['Card6No']
end
check_code() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 209
def check_code
  _params['CheckCode']
end
checksum_ok?() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 152
def checksum_ok?
  params_copy = _params.clone

  check_fields = [:"Amt", :"MerchantID", :"MerchantOrderNo", :"TradeNo"]
  raw_data = params_copy.sort.map{|field, value|
    "#{field}=#{value}" if check_fields.include?(field.to_sym)
  }.compact.join('&')

  hash_raw_data = "HashIV=#{OffsitePayments::Integrations::Pay2go.hash_iv}&#{raw_data}&HashKey=#{OffsitePayments::Integrations::Pay2go.hash_key}"

  sha256 = Digest::SHA256.new
  sha256.update hash_raw_data.force_encoding("utf-8")
  (sha256.hexdigest.upcase == check_code.to_s)
end
code_no() click to toggle source

cvs

# File lib/offsite_payments/integrations/pay2go.rb, line 272
def code_no
  _params['CodeNo']
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 145
def complete?
  case status
  when 'SUCCESS' # 付款/取號成功
    true
  end
end
eci() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 254
def eci
  _params['ECI']
end
escrow_bank() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 221
def escrow_bank
  _params['EscrowBank']
end
expire_date() click to toggle source

other about serials

# File lib/offsite_payments/integrations/pay2go.rb, line 290
def expire_date
  _params['ExpireDate']
end
inst() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 242
def inst
  _params['Inst']
end
inst_each() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 250
def inst_each
  _params['InstEach']
end
inst_first() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 246
def inst_first
  _params['InstFirst']
end
ip() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 217
def ip
  _params['IP']
end
item_id() click to toggle source

訂單號碼

# File lib/offsite_payments/integrations/pay2go.rb, line 184
def item_id
  merchant_order_no
end
merchant_id() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 175
def merchant_id
  _params['MerchantID']
end
merchant_order_no() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 197
def merchant_order_no
  _params['MerchantOrderNo']
end
message() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 171
def message
  URI.decode(_params['Message'])
end
pay_bank_code() click to toggle source

web atm, atm

# File lib/offsite_payments/integrations/pay2go.rb, line 263
def pay_bank_code
  _params['PayBankCode']
end
pay_time() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 213
def pay_time
  URI.decode(_params['PayTime']).gsub("+", " ")
end
payer_account_5code() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 267
def payer_account_5code
  _params['PayerAccount5Code']
end
payment_type() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 201
def payment_type
  _params['PaymentType']
end
respond_code() click to toggle source

credit card

# File lib/offsite_payments/integrations/pay2go.rb, line 226
def respond_code
  _params['RespondCode']
end
respond_type() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 205
def respond_type
  _params['RespondType']
end
status() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 167
def status
  _params['Status']
end
token_use_status() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 258
def token_use_status
  _params['TokenUseStatus']
end
trade_no() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 193
def trade_no
  _params['TradeNo']
end
transaction_id() click to toggle source

Pay2go 端訂單號碼

# File lib/offsite_payments/integrations/pay2go.rb, line 189
def transaction_id
  trade_no
end