Class: Selcom::SendMoney

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

Constant Summary collapse

XMLRPC_URI =
"https://paypoint.selcommobile.com/api/selcom.pos.server.php"
XMLRPC_METHOD =
'SELCOM.utilityPayment'
SELCOM_UTILITY_CODES =
{
  :airtel_tz  => 'AMCASHIN',
  :tigo_tz    => 'TPCASHIN',
  :vodacom_tz => 'VMCASHIN',
  :zantel_tz  => 'EZCASHIN'
}
NUMBER_PREFIXES =
{
  '068'       => :airtel_tz,
  '078'       => :airtel_tz,
  '065'       => :tigo_tz,
  '071'       => :tigo_tz,
  '075'       => :vodacom_tz,
  '076'       => :vodacom_tz,
  '077'       => :zantel_tz
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ SendMoney

Returns a new instance of SendMoney.



40
41
42
43
44
# File 'lib/selcom.rb', line 40

def initialize(args)
  self.telco_id       = args[:telco_id]
  self.mobile_number  = args[:mobile_number]
  self.amount         = args[:amount]
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



13
14
15
# File 'lib/selcom.rb', line 13

def amount
  @amount
end

#customer_nameObject

Returns the value of attribute customer_name.



13
14
15
# File 'lib/selcom.rb', line 13

def customer_name
  @customer_name
end

#mobile_numberObject

Returns the value of attribute mobile_number.



13
14
15
# File 'lib/selcom.rb', line 13

def mobile_number
  @mobile_number
end

#referenceObject

Returns the value of attribute reference.



13
14
15
# File 'lib/selcom.rb', line 13

def reference
  @reference
end

#responseObject

Returns the value of attribute response.



13
14
15
# File 'lib/selcom.rb', line 13

def response
  @response
end

#statusObject

Returns the value of attribute status.



13
14
15
# File 'lib/selcom.rb', line 13

def status
  @status
end

#status_codeObject

Returns the value of attribute status_code.



13
14
15
# File 'lib/selcom.rb', line 13

def status_code
  @status_code
end

#status_descriptionObject

Returns the value of attribute status_description.



13
14
15
# File 'lib/selcom.rb', line 13

def status_description
  @status_description
end

#successObject

Returns the value of attribute success.



13
14
15
# File 'lib/selcom.rb', line 13

def success
  @success
end

#telco_idObject

Returns the value of attribute telco_id.



13
14
15
# File 'lib/selcom.rb', line 13

def telco_id
  @telco_id
end

Instance Method Details

#send!Object



46
47
48
49
50
51
# File 'lib/selcom.rb', line 46

def send!
  self.response = make_rpc(self.to_params)
  parse_response(response)

  return self.success
end

#to_paramsObject



53
54
55
56
57
58
59
60
61
# File 'lib/selcom.rb', line 53

def to_params
  return HashWithIndifferentAccess.new(
    :amount         => self.amount,
    :mobile_number  => self.mobile_number,
    :telco_id       => self.telco_id,
    :vendor_id      => Selcom.config.vendor_id,
    :vendor_pin     => Selcom.config.vendor_pin
  )
end