Class: Gestpay::Gateway
- Inherits:
-
Object
- Object
- Gestpay::Gateway
- Defined in:
- lib/gestpay/gateway.rb
Constant Summary collapse
- URL =
{ :test => 'https://testecomm.sella.it/gestpay/gestpayws/WSs2s.asmx?WSDL', :production => 'https://ecomms2s.sella.it/gestpay/gestpayws/WSs2s.asmx?WSDL' }
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize ⇒ Gateway
constructor
A new instance of Gateway.
- #payment(data) ⇒ Object
- #request_token(data, verify = true) ⇒ Object
- #soap_options(data) ⇒ Object
Constructor Details
#initialize ⇒ Gateway
Returns a new instance of Gateway.
14 15 16 17 18 |
# File 'lib/gestpay/gateway.rb', line 14 def initialize # SOAP Client operations: # => [:call_refund_s2_s, :call_read_trx_s2_s, :call_pagam_s2_s, :call_delete_s2_s, :call_settle_s2_s, :call_verifycard_s2_s, :call_check_carta_s2_s, :call_renounce, :call_request_token_s2_s, :call_delete_token_s2_s] @client = Savon.client(:wsdl => URL[Gestpay.config.environment]) end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
13 14 15 |
# File 'lib/gestpay/gateway.rb', line 13 def client @client end |
Instance Method Details
#payment(data) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/gestpay/gateway.rb', line 30 def payment(data) # Custom info must be enabled on Gestpay backoffice interface, by adding new parameters data[:custom_info] = data[:custom_info].to_query.gsub('&', '*P1*') if data[:custom_info] response = @client.call(:call_pagam_s2_s, (data)) response_content = response.body[:call_pagam_s2_s_response][:call_pagam_s2_s_result][:gest_pay_s2_s] Result::Payment.new(response_content) end |
#request_token(data, verify = true) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/gestpay/gateway.rb', line 38 def request_token(data, verify=true) opts = { :request_token => 'MASKEDPAN', :with_auth => verify ? 'Y' : 'N' } response = @client.call(:call_request_token_s2_s, (data.merge(opts))) response_content = response.body[:call_request_token_s2_s_response][:call_request_token_s2_s_result][:gest_pay_s2_s] Result::TokenRequest.new(response_content) end |
#soap_options(data) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/gestpay/gateway.rb', line 20 def (data) { :message => { :shop_login => config.account, :uic_code => config.currency_code, :language_id => config.language_code }.merge(data) } end |