Class: Gestpay::Gateway
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
Instance Method Summary
collapse
Methods included from CustomInfo
#gestpay_decode, #gestpay_encode
Constructor Details
Returns a new instance of Gateway.
16
17
18
19
20
|
# File 'lib/gestpay/gateway.rb', line 16
def initialize
@client = Savon.client(:wsdl => URL[Gestpay.config.environment])
end
|
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
15
16
17
|
# File 'lib/gestpay/gateway.rb', line 15
def client
@client
end
|
Instance Method Details
#config ⇒ Object
11
12
13
|
# File 'lib/gestpay/gateway.rb', line 11
def config
Gestpay.config
end
|
#payment(data) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/gestpay/gateway.rb', line 32
def payment(data)
data[:custom_info] = gestpay_encode(data[:custom_info]) if data[:custom_info]
response = @client.call(:call_pagam_s2_s, soap_options(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
40
41
42
43
44
45
46
47
48
|
# File 'lib/gestpay/gateway.rb', line 40
def request_token(data, verify=true)
opts = {
:request_token => 'MASKEDPAN',
:with_auth => verify ? 'Y' : 'N'
}
response = @client.call(:call_request_token_s2_s, soap_options(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
22
23
24
25
26
27
28
29
30
|
# File 'lib/gestpay/gateway.rb', line 22
def soap_options(data)
{
:message => {
:shop_login => config.account,
:uic_code => config.currency_code,
:language_id => config.language_code
}.merge(data)
}
end
|