Class: Payzilla::Gateways::Rapida
- Includes:
- Transports::HTTP
- Defined in:
- lib/payzilla/gateways/rapida.rb
Instance Attribute Summary
Attributes inherited from Gateway
#config, #logger, #revision_page_size
Instance Method Summary collapse
Methods included from Transports::HTTP
Methods inherited from Gateway
available_attachments, available_settings, available_switches, can_list_providers, #can_list_providers?, can_list_providers?, #initialize, register_attachments, register_settings, register_switches, require_payment_fields, required_payment_fields, requires_revision, requires_revision?, #requires_revision?, #revise
Constructor Details
This class inherits a constructor from Payzilla::Gateways::Gateway
Instance Method Details
#check(payment) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/payzilla/gateways/rapida.rb', line 31 def check(payment) return retval(-1001) if settings_miss? begin result = request "check", terminal(payment).merge( :PaymExtId => payment.id, :PaymSubjTp => payment.gateway_provider_id, :Amount => 100, :Params => fields(payment), :FeeSum => 10 ) if result['Response']['Result'] == 'OK' result['Response']['ErrCode'] = 0 else result['Response']['ErrCode'] = -1002 if result['Response']['ErrCode'].blank? end return retval(result['Response']['ErrCode']) rescue Errno::ECONNRESET return retval(-1000) rescue Exception => e logger.fatal e.to_s unless logger.blank? return retval(-1002) end end |
#pay(payment) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/payzilla/gateways/rapida.rb', line 58 def pay(payment) return retval(-1001) if settings_miss? begin result = request "payment", terminal(payment).merge( :PaymExtId => payment.id, :PaymSubjTp => payment.gateway_provider_id, :Amount => payment.enrolled_amount, :Params => fields(payment), :FeeSum => payment.commission_amount ) if result['Response']['Result'] == 'OK' result['Response']['ErrCode'] = 0 else result['Response']['ErrCode'] = -1002 if result['Response']['ErrCode'].blank? end return retval(result['Response']['ErrCode']) rescue Errno::ECONNRESET return retval(-1000) rescue Exception => e logger.fatal e.to_s unless logger.blank? return retval(-1002) end end |
#providers ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/payzilla/gateways/rapida.rb', line 14 def providers return retval(-1001) if settings_miss? begin providers = request("getfee") providers = providers['rapida'] result = providers return retval("0", result) rescue Errno::ECONNRESET return retval(-1000) rescue Exception => e logger.fatal e.to_s unless logger.blank? return retval(-1002) end end |