class OffsitePayments::Integrations::Pay2goCvs::Notification

Attributes

_params[RW]

Public Instance Methods

acknowledge() click to toggle source

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

# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 113
def acknowledge
  checksum_ok?
end
amt() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 155
def amt
  _params['Amt'].to_s
end
auth() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 206
def auth
  _params['Auth']
end
barcode_1() click to toggle source

barcode

# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 253
def barcode_1
  _params['Barcode_1']
end
barcode_2() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 257
def barcode_2
  _params['Barcode_2']
end
barcode_3() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 261
def barcode_3
  _params['Barcode_3']
end
calculate_checksum() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 124
def calculate_checksum
  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::Pay2goCvs.hash_iv}&#{raw_data}&HashKey=#{OffsitePayments::Integrations::Pay2goCvs.hash_key}"

  sha256 = Digest::SHA256.new
  sha256.update hash_raw_data.force_encoding("utf-8")
  sha256.hexdigest.upcase
end
card_4no() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 214
def card_4no
  _params['Card4No']
end
card_6no() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 210
def card_6no
  _params['Card6No']
end
check_code() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 185
def check_code
  _params['CheckCode']
end
checksum_ok?() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 139
def checksum_ok?
  calculate_checksum == check_code.to_s
end
code_no() click to toggle source

cvs

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

other about serials

# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 266
def expire_date
  _params['ExpireDate']
end
inst() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 218
def inst
  _params['Inst']
end
inst_each() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 226
def inst_each
  _params['InstEach']
end
inst_first() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 222
def inst_first
  _params['InstFirst']
end
ip() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 193
def ip
  _params['IP']
end
item_id() click to toggle source

訂單號碼

# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 160
def item_id
  merchant_order_no
end
merchant_id() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 151
def merchant_id
  _params['MerchantID']
end
merchant_order_no() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 173
def merchant_order_no
  _params['MerchantOrderNo']
end
message() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 147
def message
  URI.decode(_params['Message'])
end
pay_bank_code() click to toggle source

web atm, atm

# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 239
def pay_bank_code
  _params['PayBankCode']
end
pay_time() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 189
def pay_time
  URI.decode(_params['PayTime']).gsub("+", " ")
end
payer_account_5code() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 243
def payer_account_5code
  _params['PayerAccount5Code']
end
payment_type() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 177
def payment_type
  _params['PaymentType']
end
respond_code() click to toggle source

credit card

# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 202
def respond_code
  _params['RespondCode']
end
respond_type() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 181
def respond_type
  _params['RespondType']
end
status() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 143
def status
  _params['Status']
end
token_use_status() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 234
def token_use_status
  _params['TokenUseStatus']
end
trade_no() click to toggle source
# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 169
def trade_no
  _params['TradeNo']
end
transaction_id() click to toggle source

Pay2goCvs 端訂單號碼

# File lib/offsite_payments/integrations/pay2go_cvs.rb, line 165
def transaction_id
  trade_no
end