Class: Epaybg::Recurring::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/epaybg/recurring/payment.rb

Constant Summary collapse

RESPONSE_STATUS_CODES =
{
  ok: '00',
  err: '96',
  duplicate: '94'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) {|_self| ... } ⇒ Payment

Returns a new instance of Payment.

Yields:

  • (_self)

Yield Parameters:



13
14
15
16
17
18
19
# File 'lib/epaybg/recurring/payment.rb', line 13

def initialize(params = {})
  params.each do |k, v|
    instance_variable_set("@#{k}", v)
  end

  yield self if block_given?
end

Instance Attribute Details

#aidObject

Returns the value of attribute aid.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def aid
  @aid
end

#amountObject

Returns the value of attribute amount.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def amount
  @amount
end

#clientidObject

Returns the value of attribute clientid.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def clientid
  @clientid
end

#idnObject

Returns the value of attribute idn.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def idn
  @idn
end

#refObject

Returns the value of attribute ref.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def ref
  @ref
end

#secondidObject

Returns the value of attribute secondid.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def secondid
  @secondid
end

#tdateObject

Returns the value of attribute tdate.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def tdate
  @tdate
end

#tidObject

Returns the value of attribute tid.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def tid
  @tid
end

#xtypeObject

Returns the value of attribute xtype.



11
12
13
# File 'lib/epaybg/recurring/payment.rb', line 11

def xtype
  @xtype
end

Instance Method Details

#respond_with(symbol) ⇒ Object



21
22
23
24
25
26
# File 'lib/epaybg/recurring/payment.rb', line 21

def respond_with(symbol)
  raise 'Invalid symbol' unless RESPONSE_STATUS_CODES.keys.include?(symbol)

  code = RESPONSE_STATUS_CODES[symbol]
  @response = "XTYPE=RBC\nSTATUS=#{code}\n"
end

#response_arrayObject



28
29
30
# File 'lib/epaybg/recurring/payment.rb', line 28

def response_array
  @response.split("\n")
end