transbank-sdk 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +16 -0
- data/README.md +4 -7
- data/lib/transbank/sdk/oneclick/mall/base.rb +10 -3
- data/lib/transbank/sdk/oneclick/mall/errors/oneclick_mall_errors.rb +2 -1
- data/lib/transbank/sdk/oneclick/mall/responses/oneclick_mall_responses.rb +1 -0
- data/lib/transbank/sdk/oneclick/mall_deferred/errors/mall_deferred_transaction_capture_error.rb +16 -0
- data/lib/transbank/sdk/oneclick/mall_deferred/mall_deferred_inscription.rb +20 -0
- data/lib/transbank/sdk/oneclick/mall_deferred/mall_deferred_transaction.rb +42 -0
- data/lib/transbank/sdk/oneclick/mall_deferred/responses/mall_deferred_transaction_capture_response.rb +16 -0
- data/lib/transbank/sdk/oneclick/oneclick.rb +3 -1
- data/lib/transbank/sdk/patpass/errors/integration_type_error.rb +8 -0
- data/lib/transbank/sdk/patpass/errors/patpass_error.rb +15 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/base.rb +47 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/errors/patpass_by_webpay_errors.rb +12 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/errors/transaction_commit_error.rb +15 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/errors/transaction_create_error.rb +15 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/errors/transaction_status_error.rb +15 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/options.rb +9 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/patpass_by_webpay.rb +16 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/responses/patpass_by_webpay_responses.rb +3 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/responses/transaction_commit_response.rb +20 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/responses/transaction_create_response.rb +15 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/responses/transaction_status_response.rb +21 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/transaction.rb +93 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/base.rb +47 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/errors/inscription_start_error.rb +15 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/errors/inscription_status_error.rb +15 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/errors/patpass_comercio_errors.rb +2 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/inscription.rb +79 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/options.rb +9 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/patpass_comercio.rb +5 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/responses/inscription_start_response.rb +13 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/responses/inscription_status_response.rb +13 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/responses/patpass_comercio_responses.rb +2 -0
- data/lib/transbank/sdk/transaccion_completa/mall/mall_transaction.rb +164 -0
- data/lib/transbank/sdk/transaccion_completa/mall/responses/mall_transaction_commit_response.rb +14 -0
- data/lib/transbank/sdk/transaccion_completa/mall/responses/mall_transaction_installments_response.rb +11 -0
- data/lib/transbank/sdk/transaccion_completa/mall/responses/mall_transaction_responses.rb +3 -0
- data/lib/transbank/sdk/transaccion_completa/mall/responses/mall_transaction_status_response.rb +14 -0
- data/lib/transbank/sdk/version.rb +1 -1
- data/lib/transbank/sdk/webpay/webpay_plus/base.rb +62 -0
- data/lib/transbank/sdk/webpay/webpay_plus/deferred/deferred_transaction.rb +108 -0
- data/lib/transbank/sdk/webpay/webpay_plus/deferred/errors/transaction_capture_error.rb +16 -0
- data/lib/transbank/sdk/webpay/webpay_plus/deferred/errors/webpay_plus_deferred_errors.rb +1 -0
- data/lib/transbank/sdk/webpay/webpay_plus/deferred/responses/transaction_capture_response.rb +22 -0
- data/lib/transbank/sdk/webpay/webpay_plus/deferred/responses/webpay_plus_deferred_responses.rb +1 -0
- data/lib/transbank/sdk/webpay/webpay_plus/errors/transaction_commit_error.rb +17 -0
- data/lib/transbank/sdk/webpay/webpay_plus/errors/transaction_create_error.rb +16 -0
- data/lib/transbank/sdk/webpay/webpay_plus/errors/transaction_refund_error.rb +16 -0
- data/lib/transbank/sdk/webpay/webpay_plus/errors/transaction_status_error.rb +16 -0
- data/lib/transbank/sdk/webpay/webpay_plus/errors/webpay_plus_errors.rb +13 -0
- data/lib/transbank/sdk/webpay/webpay_plus/mall/mall_transaction.rb +88 -0
- data/lib/transbank/sdk/webpay/webpay_plus/mall/responses/mall_transaction_commit_response.rb +23 -0
- data/lib/transbank/sdk/webpay/webpay_plus/mall/responses/mall_transaction_status_response.rb +21 -0
- data/lib/transbank/sdk/webpay/webpay_plus/mall/responses/webpay_plus_mall_responses.rb +2 -0
- data/lib/transbank/sdk/webpay/webpay_plus/mall_deferred/mall_deferred_transaction.rb +109 -0
- data/lib/transbank/sdk/webpay/webpay_plus/options.rb +9 -0
- data/lib/transbank/sdk/webpay/webpay_plus/responses/transaction_commit_response.rb +20 -0
- data/lib/transbank/sdk/webpay/webpay_plus/responses/transaction_create_response.rb +15 -0
- data/lib/transbank/sdk/webpay/webpay_plus/responses/transaction_refund_response.rb +19 -0
- data/lib/transbank/sdk/webpay/webpay_plus/responses/transaction_status_response.rb +21 -0
- data/lib/transbank/sdk/webpay/webpay_plus/responses/webpay_plus_responses.rb +4 -0
- data/lib/transbank/sdk/webpay/webpay_plus/transaction.rb +89 -0
- data/lib/transbank/sdk/webpay/webpay_plus/webpay_plus.rb +24 -0
- metadata +60 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 817886427b7e35f0b592fe706a68453d891c40b3438083890cc35e7f9db96111
|
|
4
|
+
data.tar.gz: 23cfbcaf423ec7a535fade5d85513514e173b5510f52e2c008d29f78b003b947
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b9e94503ac0028669da09c6ddf8a2c6f006cefb821e8793f6e2db18e0364add41c2509d2adf1a25159cfda4ee56505b5e4317522bef7ebae8d03ec7e3060e54
|
|
7
|
+
data.tar.gz: e60e58802c3248e9c2cefd1143c373170095480773e2ab64f66d08e07740e982d032e802710db34ee8abfda3129fe5ac9c2d3fda54f119bd4b32e33536a4cae9
|
data/.travis.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
deploy:
|
|
2
2
|
provider: rubygems
|
|
3
3
|
api_key:
|
|
4
|
-
secure:
|
|
4
|
+
secure: Y3z7qW8UhuDi0AqMr9T6ti46w3jLuLDRLuHUBTff80lYAZhBwCNj7U9UvlgELTiOC/nLREtboGW5ZUf3XIIiRr2oIqCSSWYVR6OCuPGTHS/hvGBi0T5jEL30/YuIEbIuz3xkXqN15WlOouKVgfPsNcL8mfLZBZMHQ9QwB6P0E2rg2GZj1QVqAUjnn/JGet0d2EJb48YyndN4nGVhaXXUQhcyyy1+XWEkC3nCo6v1dwE5pS8QK4kcRevRvL9G8mebxX74IuIbgW2bXBHPLNUbuUOHuNNUrrNIJDFUf8xXouLDT5QN4CsoldcgSIGuBvcJlmoubQFfju4iuGt/xnL8BtsKDy3iZ+xnIji6h7MGNAOpiZ7e2LavGvO5luYVEpuv2iG9V/FpJY5DJcBZ8779LnA97NAV7bz383tjihCfR9kzUh5rs2To42FV0IQj0btWuGesVmPefWjwV/EzjmbN0+PhNmxDwQAJS49cHycZKTeestaR4MgHigXZ2CGRAJSKYr3Tj7/r8KZW6MGY6KgXiwjpu+d3+UidAwI1viiRrCGuWBALkAAaxGR0H8qamMsJr/DQtjAgXDITRlAScpWzicgvEEHyXTos45EIrsJZV72O/jj8Zvbw83rEMv8It3yCS43deLsyw+5a4i9y9HFKuGQPa8w7yR1xEOnh6G3AiWY=
|
|
5
5
|
gem: transbank-sdk
|
|
6
6
|
on:
|
|
7
7
|
tags: true
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ Todos los cambios notables a este proyecto serán documentados en este archivo.
|
|
|
4
4
|
El formato está basado en [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
y este proyecto adhiere a [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.3.0] - 2020-10-26
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Se agrega soporte para:
|
|
12
|
+
- Webpay Plus Rest
|
|
13
|
+
- modalidad normal
|
|
14
|
+
- modalidad captura diferida
|
|
15
|
+
- modalidad mall
|
|
16
|
+
- modalidad mall captura diferida
|
|
17
|
+
- Patpass by Webpay Rest
|
|
18
|
+
- Patpass Comercio Rest
|
|
19
|
+
- Transacción completa Rest
|
|
20
|
+
- modalidad mall
|
|
21
|
+
- Oneclick Mall Captura diferida
|
|
22
|
+
|
|
7
23
|
## [1.2.0] - 2019-12-26
|
|
8
24
|
### Added
|
|
9
25
|
- Se agrega soporte para Oneclick Mall y Transacción Completa en sus versiones REST.
|
data/README.md
CHANGED
|
@@ -75,16 +75,13 @@ make
|
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### Deploy de una nueva versión.
|
|
78
|
-
Para generar una nueva versión, se debe crear un PR (con un título "Prepare release X.Y.Z" con los valores que correspondan para X
|
|
78
|
+
Para generar una nueva versión, se debe crear un PR (con un título "Prepare release X.Y.Z" con los valores que correspondan para `X`, `Y` y `Z`). Se debe seguir el estándar semver para determinar si se incrementa el valor de `X` (si hay cambios no retrocompatibles), `Y` (para mejoras retrocompatibles) o `Z` (si sólo hubo correcciones a bugs).
|
|
79
79
|
|
|
80
80
|
En ese PR deben incluirse los siguientes cambios:
|
|
81
81
|
|
|
82
|
-
Modificar el archivo CHANGELOG.md para incluir una nueva entrada (al comienzo) para X.Y.Z que explique en español los cambios de cara al usuario del SDK
|
|
82
|
+
1. Modificar el archivo `CHANGELOG.md` para incluir una nueva entrada (al comienzo) para `X.Y.Z` que explique en español los cambios **de cara al usuario del SDK**.
|
|
83
|
+
2. Modificar [version.rb](./lib/transbank/sdk/version.rb) para poner la nueva versión que corresponde.
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Modificar [version.rb](./lib/transbank/sdk/version.rb) para poner la nueva versión que corresponde
|
|
87
|
-
|
|
88
|
-
Luego de obtener aprobación del pull request, debe mezclarse a master e inmediatamente generar un release en GitHub con el tag vX.Y.Z. En la descripción del release debes poner lo mismo que agregaste al changelog.
|
|
85
|
+
Luego de obtener aprobación del pull request, debe mezclarse a master e inmediatamente generar un release en GitHub con el tag `vX.Y.Z`. En la descripción del release debes poner lo mismo que agregaste al changelog.
|
|
89
86
|
|
|
90
87
|
Con eso Travis CI generará automáticamente una nueva versión de la librería y la publicará en RubyGems.
|
|
@@ -5,8 +5,16 @@ module Transbank
|
|
|
5
5
|
DEFAULT_API_KEY = '579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C'.freeze
|
|
6
6
|
|
|
7
7
|
DEFAULT_ONECLICK_MALL_COMMERCE_CODE = '597055555541'.freeze
|
|
8
|
-
DEFAULT_ONECLICK_MALL_CHILD_COMMERCE_CODES = [
|
|
9
|
-
|
|
8
|
+
DEFAULT_ONECLICK_MALL_CHILD_COMMERCE_CODES = [
|
|
9
|
+
'597055555542'.freeze,
|
|
10
|
+
'597055555543'.freeze
|
|
11
|
+
].freeze
|
|
12
|
+
|
|
13
|
+
DEFAULT_ONECLICK_MALL_DEFERRED_COMMERCE_CODE = '597055555547'.freeze
|
|
14
|
+
DEFAULT_ONECLICK_MALL_DEFERRED_CHILD_COMMERCE_CODES = [
|
|
15
|
+
'597055555548'.freeze,
|
|
16
|
+
'597055555549'.freeze
|
|
17
|
+
].freeze
|
|
10
18
|
|
|
11
19
|
@api_key = DEFAULT_API_KEY
|
|
12
20
|
@commerce_code = DEFAULT_ONECLICK_MALL_COMMERCE_CODE
|
|
@@ -48,4 +56,3 @@ module Transbank
|
|
|
48
56
|
end
|
|
49
57
|
end
|
|
50
58
|
end
|
|
51
|
-
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
require 'transbank/sdk/oneclick/mall/errors/mall_transaction_authorize_error'
|
|
2
2
|
require 'transbank/sdk/oneclick/mall/errors/mall_transaction_status_error'
|
|
3
|
-
require 'transbank/sdk/oneclick/mall/errors/mall_transaction_refund_error'
|
|
3
|
+
require 'transbank/sdk/oneclick/mall/errors/mall_transaction_refund_error'
|
|
4
|
+
require 'transbank/sdk/oneclick/mall_deferred/errors/mall_deferred_transaction_capture_error'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
require 'transbank/sdk/oneclick/mall/responses/mall_transaction_authorize_response'
|
|
2
2
|
require 'transbank/sdk/oneclick/mall/responses/mall_transaction_status_response'
|
|
3
3
|
require 'transbank/sdk/oneclick/mall/responses/mall_transaction_refund_response'
|
|
4
|
+
require 'transbank/sdk/oneclick/mall_deferred/responses/mall_deferred_transaction_capture_response'
|
data/lib/transbank/sdk/oneclick/mall_deferred/errors/mall_deferred_transaction_capture_error.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Webpay
|
|
3
|
+
module Oneclick
|
|
4
|
+
module Errors
|
|
5
|
+
class MallDeferredTransactionCaptureError < OneclickError
|
|
6
|
+
attr_accessor :code, :message
|
|
7
|
+
def initialize(message, code)
|
|
8
|
+
@code = code
|
|
9
|
+
@message = message
|
|
10
|
+
super(message, code)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Webpay
|
|
3
|
+
module Oneclick
|
|
4
|
+
class MallDeferredInscription < Transbank::Webpay::Oneclick::MallInscription
|
|
5
|
+
extend Transbank::Utils::NetHelper
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
def default_integration_params
|
|
9
|
+
{
|
|
10
|
+
api_key: Oneclick::Base::DEFAULT_API_KEY,
|
|
11
|
+
commerce_code: Oneclick::Base::DEFAULT_ONECLICK_MALL_DEFERRED_COMMERCE_CODE,
|
|
12
|
+
integration_type: Oneclick::Base::integration_type,
|
|
13
|
+
base_url: Oneclick::Base::current_integration_type_url
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Webpay
|
|
3
|
+
module Oneclick
|
|
4
|
+
class MallDeferredTransaction < Transbank::Webpay::Oneclick::MallTransaction
|
|
5
|
+
extend Transbank::Utils::NetHelper
|
|
6
|
+
TRANSACTION_CAPTURE_ENDPOINT = 'rswebpaytransaction/api/oneclick/v1.0/transactions/capture'.freeze
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
|
|
10
|
+
def capture(child_commerce_code:, child_buy_order:, authorization_code:, amount:, options: nil)
|
|
11
|
+
api_key = options&.api_key || default_integration_params[:api_key]
|
|
12
|
+
commerce_code = options&.commerce_code || default_integration_params[:commerce_code]
|
|
13
|
+
integration_type = options&.integration_type || default_integration_params[:integration_type]
|
|
14
|
+
base_url = integration_type.nil? ? Oneclick::Base::integration_type[:TEST] : Oneclick::Base.integration_type_url(integration_type)
|
|
15
|
+
|
|
16
|
+
url = base_url + TRANSACTION_CAPTURE_ENDPOINT
|
|
17
|
+
headers = webpay_headers(commerce_code: commerce_code, api_key: api_key)
|
|
18
|
+
body = {
|
|
19
|
+
commerce_code: child_commerce_code,
|
|
20
|
+
buy_order: child_buy_order,
|
|
21
|
+
authorization_code: authorization_code,
|
|
22
|
+
capture_amount: amount
|
|
23
|
+
}
|
|
24
|
+
resp = http_put(uri_string: url, headers: headers, body: body)
|
|
25
|
+
body = JSON.parse(resp.body)
|
|
26
|
+
return ::Transbank::Webpay::Oneclick::MallDeferredTransactionCaptureResponse.new(body) if resp.kind_of? Net::HTTPSuccess
|
|
27
|
+
raise Oneclick::Errors::MallDeferredTransactionCaptureError.new(body['error_message'], resp.code)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def default_integration_params
|
|
31
|
+
{
|
|
32
|
+
api_key: Oneclick::Base::DEFAULT_API_KEY,
|
|
33
|
+
commerce_code: Oneclick::Base::DEFAULT_ONECLICK_MALL_DEFERRED_COMMERCE_CODE,
|
|
34
|
+
integration_type: Oneclick::Base::integration_type,
|
|
35
|
+
base_url: Oneclick::Base::current_integration_type_url
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Webpay
|
|
3
|
+
module Oneclick
|
|
4
|
+
class MallDeferredTransactionCaptureResponse
|
|
5
|
+
|
|
6
|
+
FIELDS = %i[authorization_code authorization_date captured_amount response_code]
|
|
7
|
+
attr_accessor *FIELDS
|
|
8
|
+
|
|
9
|
+
def initialize(json)
|
|
10
|
+
FIELDS.each {|field| send("#{field}=", json["#{field}"]) }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
require 'transbank/sdk/oneclick/errors/oneclick_error'
|
|
2
2
|
require 'transbank/sdk/oneclick/inscription/inscription'
|
|
3
|
-
require 'transbank/sdk/oneclick/mall/oneclick_mall'
|
|
3
|
+
require 'transbank/sdk/oneclick/mall/oneclick_mall'
|
|
4
|
+
require 'transbank/sdk/oneclick/mall_deferred/mall_deferred_transaction'
|
|
5
|
+
require 'transbank/sdk/oneclick/mall_deferred/mall_deferred_inscription'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Patpass
|
|
3
|
+
module Errors
|
|
4
|
+
class PatpassError < ::Transbank::Errors::TransbankError
|
|
5
|
+
attr_accessor :message, :code
|
|
6
|
+
def initialize(message, code)
|
|
7
|
+
self.message = message
|
|
8
|
+
self.code = code
|
|
9
|
+
super(message)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Patpass
|
|
3
|
+
module PatpassByWebpay
|
|
4
|
+
class Base
|
|
5
|
+
|
|
6
|
+
DEFAULT_API_KEY = '579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C'.freeze
|
|
7
|
+
DEFAULT_COMMERCE_CODE = '597055555550'.freeze
|
|
8
|
+
|
|
9
|
+
@api_key = DEFAULT_API_KEY
|
|
10
|
+
@commerce_code = DEFAULT_COMMERCE_CODE
|
|
11
|
+
@integration_type = :TEST
|
|
12
|
+
@integration_types = {
|
|
13
|
+
LIVE: "https://webpay3g.transbank.cl/",
|
|
14
|
+
TEST: "https://webpay3gint.transbank.cl/"
|
|
15
|
+
}
|
|
16
|
+
class << self
|
|
17
|
+
attr_reader :integration_types
|
|
18
|
+
attr_accessor :api_key, :integration_type, :commerce_code
|
|
19
|
+
|
|
20
|
+
def integration_type_url(integration_type)
|
|
21
|
+
type = integration_type.upcase.to_sym
|
|
22
|
+
return @integration_types[type] unless @integration_types[type].nil?
|
|
23
|
+
valid_values = @integration_types.keys.join(', ')
|
|
24
|
+
raise Transbank::Patpass::Errors::IntegrationTypeError, "Invalid integration type, valid values are #{valid_values}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def current_integration_type_url
|
|
28
|
+
@integration_types[@integration_type]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def integration_type=(integration_type)
|
|
32
|
+
type = integration_type.upcase.to_sym
|
|
33
|
+
return @integration_type = type unless @integration_types[type].nil?
|
|
34
|
+
valid_values = @integration_types.keys.join(', ')
|
|
35
|
+
raise Transbank::Patpass::Errors::IntegrationTypeError, "Invalid integration type, valid values are #{valid_values}"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def configure_for_testing
|
|
39
|
+
@api_key = DEFAULT_API_KEY
|
|
40
|
+
@commerce_code = DEFAULT_COMMERCE_CODE
|
|
41
|
+
self.integration_type = :TEST
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'transbank/sdk/patpass/patpass_by_webpay/errors/transaction_create_error'
|
|
2
|
+
require 'transbank/sdk/patpass/patpass_by_webpay/errors/transaction_commit_error'
|
|
3
|
+
require 'transbank/sdk/patpass/patpass_by_webpay/errors/transaction_status_error'
|
|
4
|
+
|
|
5
|
+
module Transbank
|
|
6
|
+
module Patpass
|
|
7
|
+
module PatpassByWebpay
|
|
8
|
+
module Errors
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Patpass
|
|
3
|
+
module PatpassByWebpay
|
|
4
|
+
module Errors
|
|
5
|
+
class TransactionCommitError < ::Transbank::Patpass::Errors::PatpassError
|
|
6
|
+
attr_reader :code
|
|
7
|
+
def initialize(message, code)
|
|
8
|
+
@code = code
|
|
9
|
+
super(message, code)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Patpass
|
|
3
|
+
module PatpassByWebpay
|
|
4
|
+
module Errors
|
|
5
|
+
class TransactionCreateError < ::Transbank::Patpass::Errors::PatpassError
|
|
6
|
+
attr_reader :code
|
|
7
|
+
def initialize(message, code)
|
|
8
|
+
@code = code
|
|
9
|
+
super(message, code)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Patpass
|
|
3
|
+
module PatpassByWebpay
|
|
4
|
+
module Errors
|
|
5
|
+
class TransactionStatusError < ::Transbank::Patpass::Errors::PatpassError
|
|
6
|
+
attr_reader :code
|
|
7
|
+
def initialize(message, code)
|
|
8
|
+
@code = code
|
|
9
|
+
super(message, code)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'transbank/sdk/patpass/errors/patpass_error'
|
|
2
|
+
require 'transbank/sdk/patpass/errors/integration_type_error'
|
|
3
|
+
require 'transbank/sdk/patpass/patpass_by_webpay/errors/patpass_by_webpay_errors'
|
|
4
|
+
require 'transbank/sdk/patpass/patpass_by_webpay/responses/patpass_by_webpay_responses'
|
|
5
|
+
|
|
6
|
+
require 'transbank/sdk/patpass/patpass_by_webpay/base'
|
|
7
|
+
require 'transbank/sdk/patpass/patpass_by_webpay/options'
|
|
8
|
+
require 'transbank/sdk/patpass/patpass_by_webpay/transaction'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
module Transbank
|
|
12
|
+
module Patpass
|
|
13
|
+
module PatpassByWebpay
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Patpass
|
|
3
|
+
module PatpassByWebpay
|
|
4
|
+
class TransactionCommitResponse
|
|
5
|
+
|
|
6
|
+
FIELDS =
|
|
7
|
+
[:vci, :amount, :buy_order, :session_id,
|
|
8
|
+
:card_detail, :accounting_date, :transaction_date,
|
|
9
|
+
:authorization_code, :payment_type_code, :response_code,
|
|
10
|
+
:installments_amount, :installments_number, :balance]
|
|
11
|
+
|
|
12
|
+
attr_accessor *FIELDS
|
|
13
|
+
|
|
14
|
+
def initialize(json)
|
|
15
|
+
FIELDS.each {|field| send("#{field}=", json["#{field}"]) }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Patpass
|
|
3
|
+
module PatpassByWebpay
|
|
4
|
+
class TransactionStatusResponse
|
|
5
|
+
|
|
6
|
+
FIELDS =
|
|
7
|
+
[:vci, :amount, :buy_order, :session_id,
|
|
8
|
+
:card_detail, :accounting_date, :transaction_date,
|
|
9
|
+
:authorization_code, :payment_type_code, :response_code,
|
|
10
|
+
:installments_amount, :installments_number, :balance]
|
|
11
|
+
|
|
12
|
+
attr_accessor *FIELDS
|
|
13
|
+
|
|
14
|
+
def initialize(json)
|
|
15
|
+
FIELDS.each {|field| send("#{field}=", json["#{field}"]) }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|