class Gestpay::Digest
Constants
- URL
Attributes
client[RW]
Public Class Methods
new()
click to toggle source
# File lib/gestpay/digest.rb, line 16 def initialize # SOAP Client operations: # => [:encrypt, :decrypt] savon_options = {:wsdl => URL[Gestpay.config.environment]} if Gestpay.config.proxy savon_options.merge!({ :proxy=> URI.parse(Gestpay.config.proxy)}) end @client = Savon.client(savon_options) end
Public Instance Methods
config()
click to toggle source
# File lib/gestpay/digest.rb, line 11 def config Gestpay.config end
decrypt(string)
click to toggle source
# File lib/gestpay/digest.rb, line 42 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)
click to toggle source
# File lib/gestpay/digest.rb, line 34 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)
click to toggle source
# File lib/gestpay/digest.rb, line 26 def soap_options(data) { :message => { :shop_login => config.account }.merge(data) } end