Class: Selcom::SendMoney
- Inherits:
-
Object
- Object
- Selcom::SendMoney
- 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
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#customer_name ⇒ Object
Returns the value of attribute customer_name.
-
#mobile_number ⇒ Object
Returns the value of attribute mobile_number.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#response ⇒ Object
Returns the value of attribute response.
-
#status ⇒ Object
Returns the value of attribute status.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
-
#status_description ⇒ Object
Returns the value of attribute status_description.
-
#success ⇒ Object
Returns the value of attribute success.
-
#telco_id ⇒ Object
Returns the value of attribute telco_id.
Instance Method Summary collapse
-
#initialize(args) ⇒ SendMoney
constructor
A new instance of SendMoney.
- #send! ⇒ Object
- #to_params ⇒ Object
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
#amount ⇒ Object
Returns the value of attribute amount.
13 14 15 |
# File 'lib/selcom.rb', line 13 def amount @amount end |
#customer_name ⇒ Object
Returns the value of attribute customer_name.
13 14 15 |
# File 'lib/selcom.rb', line 13 def customer_name @customer_name end |
#mobile_number ⇒ Object
Returns the value of attribute mobile_number.
13 14 15 |
# File 'lib/selcom.rb', line 13 def mobile_number @mobile_number end |
#reference ⇒ Object
Returns the value of attribute reference.
13 14 15 |
# File 'lib/selcom.rb', line 13 def reference @reference end |
#response ⇒ Object
Returns the value of attribute response.
13 14 15 |
# File 'lib/selcom.rb', line 13 def response @response end |
#status ⇒ Object
Returns the value of attribute status.
13 14 15 |
# File 'lib/selcom.rb', line 13 def status @status end |
#status_code ⇒ Object
Returns the value of attribute status_code.
13 14 15 |
# File 'lib/selcom.rb', line 13 def status_code @status_code end |
#status_description ⇒ Object
Returns the value of attribute status_description.
13 14 15 |
# File 'lib/selcom.rb', line 13 def status_description @status_description end |
#success ⇒ Object
Returns the value of attribute success.
13 14 15 |
# File 'lib/selcom.rb', line 13 def success @success end |
#telco_id ⇒ Object
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_params ⇒ Object
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 |