Method: WebpayComplete#initialize

Defined in:
lib/webpaycomplete.rb

#initialize(configuration) ⇒ WebpayComplete

Returns a new instance of WebpayComplete.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/webpaycomplete.rb', line 9

def initialize(configuration)


  @wsdl_path = ''
  @ambient = configuration.environment

  case @ambient
    when 'INTEGRACION'
      @wsdl_path='https://webpay3gint.transbank.cl/WSWebpayTransaction/cxf/WSCompleteWebpayService?wsdl'
    when 'CERTIFICACION'
      @wsdl_path='https://webpay3gint.transbank.cl/WSWebpayTransaction/cxf/WSCompleteWebpayService?wsdl'
    when 'PRODUCCION'
      @wsdl_path='https://webpay3g.transbank.cl/WSWebpayTransaction/cxf/WSCompleteWebpayService?wsdl'
    else
      #Por defecto esta el ambiente de INTEGRACION

      @wsdl_path='https://webpay3gint.transbank.cl/WSWebpayTransaction/cxf/WSCompleteWebpayService?wsd'
  end

  @commerce_code = configuration.commerce_code
  @private_key = OpenSSL::PKey::RSA.new(configuration.private_key)
  @public_cert = OpenSSL::X509::Certificate.new(configuration.public_cert)
  @webpay_cert = OpenSSL::X509::Certificate.new(configuration.webpay_cert)
  @client = Savon.client(wsdl: @wsdl_path)

end