Class: Bancard::SingleBuyInitResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/bancard/single_buy_init_response.rb

Constant Summary collapse

REDIRECT_PATH =
'/payment/single_buy'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ SingleBuyInitResponse

Returns a new instance of SingleBuyInitResponse.



9
10
11
12
# File 'lib/bancard/single_buy_init_response.rb', line 9

def initialize(response)
  @original_response = response
  @body              = JSON.parse(response.body)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/bancard/single_buy_init_response.rb', line 6

def body
  @body
end

Instance Method Details

#messageObject



30
31
# File 'lib/bancard/single_buy_init_response.rb', line 30

def message
end

#paramsObject



18
19
20
# File 'lib/bancard/single_buy_init_response.rb', line 18

def params
  body.merge 'payment_url' => payment_url
end

#payment_urlObject



22
23
24
# File 'lib/bancard/single_buy_init_response.rb', line 22

def payment_url
  Bancard.vpos_url(REDIRECT_PATH) + "?process_id=#{process_id}"
end

#process_idObject



26
27
28
# File 'lib/bancard/single_buy_init_response.rb', line 26

def process_id
  body['process_id']
end

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/bancard/single_buy_init_response.rb', line 14

def success?
  body['status'] == 'success'
end