Class: Newebpay::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/newebpay/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Response

Returns a new instance of Response.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/newebpay/response.rb', line 13

def initialize(data)
  response = AES::Cryptographic.new(data['TradeInfo']).decrypt

  @status = response['Status']
  @message = response['Message']
  @result = response['Result']
  @order_number = @result['MerchantOrderNo']
  @trade_number = @result['TradeNo']
  @ip = @result['IP']
  @card_number_first_six_code = @result['Card6No']
  @card_number_last_four_code = @result['Card4No']
  @escrow_bank = @result['EscrowBank']
  @auth_bank = @result['AuthBank']
  @pay_way = @result['PaymentType']
  @inst = @result['Inst']
  @inst_first_price = @result['InstFirst']
  @inst_each_price = @result['InstEach']
  @atm_pay_bank_code = @result['PayBankCode']
  @atm_payer_account_last_five_code = @result['PayerAccount5Code']
  @paid_at = @result['PayTime']
end

Instance Attribute Details

#atm_pay_bank_codeObject (readonly)

Returns the value of attribute atm_pay_bank_code.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def atm_pay_bank_code
  @atm_pay_bank_code
end

#atm_payer_account_last_five_codeObject (readonly)

Returns the value of attribute atm_payer_account_last_five_code.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def 
  @atm_payer_account_last_five_code
end

#auth_bankObject (readonly)

Returns the value of attribute auth_bank.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def auth_bank
  @auth_bank
end

#card_number_first_six_codeObject (readonly)

Returns the value of attribute card_number_first_six_code.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def card_number_first_six_code
  @card_number_first_six_code
end

#card_number_last_four_codeObject (readonly)

Returns the value of attribute card_number_last_four_code.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def card_number_last_four_code
  @card_number_last_four_code
end

#escrow_bankObject (readonly)

Returns the value of attribute escrow_bank.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def escrow_bank
  @escrow_bank
end

#instObject (readonly)

Returns the value of attribute inst.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def inst
  @inst
end

#inst_each_priceObject (readonly)

Returns the value of attribute inst_each_price.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def inst_each_price
  @inst_each_price
end

#inst_first_priceObject (readonly)

Returns the value of attribute inst_first_price.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def inst_first_price
  @inst_first_price
end

#ipObject (readonly)

Returns the value of attribute ip.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def ip
  @ip
end

#messageObject (readonly)

Returns the value of attribute message.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def message
  @message
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def order_number
  @order_number
end

Returns the value of attribute paid_at.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def paid_at
  @paid_at
end

#pay_wayObject (readonly)

Returns the value of attribute pay_way.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def pay_way
  @pay_way
end

#resultObject (readonly)

Returns the value of attribute result.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def result
  @result
end

#statusObject (readonly)

Returns the value of attribute status.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def status
  @status
end

#trade_numberObject (readonly)

Returns the value of attribute trade_number.



9
10
11
# File 'lib/newebpay/response.rb', line 9

def trade_number
  @trade_number
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/newebpay/response.rb', line 35

def success?
  status === 'SUCCESS'
end