Class: Gestpay::Digest
Constant Summary
collapse
- URL =
{
:test => 'https://testecomm.sella.it/gestpay/gestpayws/WSCryptDecrypt.asmx?WSDL',
:production => 'https://ecomms2s.sella.it/gestpay/gestpayws/WSCryptDecrypt.asmx?WSDL'
}
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from CustomInfo
#gestpay_decode, #gestpay_encode
Constructor Details
#initialize ⇒ Digest
Returns a new instance of Digest.
16
17
18
19
20
|
# File 'lib/gestpay/digest.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/digest.rb', line 15
def client
@client
end
|
Instance Method Details
#config ⇒ Object
11
12
13
|
# File 'lib/gestpay/digest.rb', line 11
def config
Gestpay.config
end
|
#decrypt(string) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/gestpay/digest.rb', line 38
def decrypt(string)
response = @client.call(:decrypt, soap_options({'CryptedString' => string}))
response_content = response.body[:decrypt_response][:decrypt_result][:gest_pay_crypt_decrypt]
response_content[:custom_info] = gestpay_decode(response_content[:custom_info]) if response_content[:custom_info]
Result::Decrypt.new(response_content)
end
|
#encrypt(data) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/gestpay/digest.rb', line 30
def encrypt(data)
data[:custom_info] = gestpay_encode(data[:custom_info]) if data[:custom_info]
response = @client.call(:encrypt, soap_options(data))
response_content = response.body[:encrypt_response][:encrypt_result][:gest_pay_crypt_decrypt]
Result::Encrypt.new(response_content)
end
|
#soap_options(data) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/gestpay/digest.rb', line 22
def soap_options(data)
{
:message => {
:shop_login => config.account
}.merge(data)
}
end
|