transbank-sdk 4.0.0 → 5.0.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 +5 -5
- data/.github/workflows/publish-lib.yml +2 -2
- data/CHANGELOG.md +26 -0
- data/lib/transbank/sdk/common/api_constants.rb +1 -0
- data/lib/transbank/sdk/common/base_transaction.rb +13 -5
- data/lib/transbank/sdk/patpass/options.rb +14 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/inscription.rb +29 -6
- data/lib/transbank/sdk/shared/request_service.rb +7 -4
- data/lib/transbank/sdk/version.rb +1 -1
- data/lib/transbank/sdk/webpay/oneclick/mall_inscription.rb +28 -6
- data/lib/transbank/sdk/webpay/oneclick/mall_transaction.rb +30 -7
- data/lib/transbank/sdk/webpay/options.rb +14 -0
- data/lib/transbank/sdk/webpay/transaccion_completa/mall_transaction.rb +32 -9
- data/lib/transbank/sdk/webpay/transaccion_completa/transaction.rb +31 -8
- data/lib/transbank/sdk/webpay/webpay_plus/mall_transaction.rb +30 -7
- data/lib/transbank/sdk/webpay/webpay_plus/transaction.rb +32 -9
- data/lib/transbank/sdk.rb +3 -2
- data/transbank-sdk.gemspec +10 -8
- metadata +27 -28
- data/lib/transbank/sdk/patpass/patpass_by_webpay/transaction.rb +0 -41
- data/lib/transbank/sdk/webpay/webpay_plus_modal/transaction.rb +0 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5869521de720f438d8d86cf0865ea02d79ce5972c80ebebe9e62e93932b81015
|
4
|
+
data.tar.gz: 580054a4099e31676413cf05138f67cefbc6113d75e7d139af2fe485b674891c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d09cb3642c8b2d37bced404a7940c5d6fb8e63e347e57239ed54d5d9ae33f35c97e42da9ac1ed15dc40ccb3101b9959b0edf4f81c4be5da05d2230557297f85
|
7
|
+
data.tar.gz: f6fe4d977746b50baf17ea3181d59ceec260734e3b2529b041e9d699223859fb55e4aa91f6f363b2f7818807f303f47d0f65ff363efe7b3eb587f824f72f4223
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,32 @@ Todos los cambios notables a este proyecto serán documentados en este archivo.
|
|
5
5
|
El formato está basado en [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
6
|
y este proyecto adhiere a [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [5.0.0] - 2025-05-05
|
9
|
+
|
10
|
+
Esta versión no tiene cambios en el comportamiento de las funcionalidades de la API.
|
11
|
+
|
12
|
+
¡Importante!
|
13
|
+
|
14
|
+
El SDK ya no apunta por defecto al ambiente de integración. Ahora es necesario configurar de forma explícita las credenciales. Para esto se debe inicializar explícitamente los objetos de los distintos productos, ya sea utilizando la clase Options o a través de los nuevos métodos build_for_integration y build_for_production. Además, notar que ahora la versión mínima de Ruby a la 2.7.
|
15
|
+
|
16
|
+
### Agrega
|
17
|
+
- Se agrega el parámetro timeout para que pueda modificarse en todos los productos.
|
18
|
+
- Se agregan los métodos build_for_integration y build_for_production a todos los productos
|
19
|
+
|
20
|
+
### Actualiza
|
21
|
+
- Se actualiza la versión mínima soportada de Ruby a la 2.7
|
22
|
+
- Se configura por defecto el timeout a 600 segundos para todas las peticiones.
|
23
|
+
- Se actualizan las versiones de las dependencias.
|
24
|
+
- Se actualizan los test.
|
25
|
+
|
26
|
+
### Borra
|
27
|
+
- Se elimina el constructor por defecto en Webpayplus
|
28
|
+
- Se elimina el constructor por defecto en Oneclick
|
29
|
+
- Se elimina el constructor por defecto en Patpass Comercio
|
30
|
+
- Se elimina el constructor por defecto en Full Transaction y Mall Full Transaction
|
31
|
+
- Se elimina el código que hace referencia al producto ‘Webpay Modal’
|
32
|
+
- Se elimina el código que hace referencia al producto ‘Patpass by webpay’
|
33
|
+
|
8
34
|
## [4.0.0] - 2024-03-20
|
9
35
|
|
10
36
|
### Changed
|
@@ -2,14 +2,22 @@ module Transbank
|
|
2
2
|
module Common
|
3
3
|
class BaseTransaction
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
def initialize(options)
|
6
|
+
required_methods = [:commerce_code, :api_key, :environment, :timeout]
|
7
|
+
missing_methods = required_methods.reject { |method| options.respond_to?(method) }
|
8
|
+
|
9
|
+
unless missing_methods.empty?
|
10
|
+
raise ArgumentError, "Options object must respond to: #{missing_methods.join(', ')}"
|
11
|
+
end
|
12
|
+
unless %i[production integration].include?(options.environment)
|
9
13
|
raise ArgumentError, "Environment must be either 'integration' or 'production'"
|
10
14
|
end
|
15
|
+
|
16
|
+
@commerce_code = options.commerce_code
|
17
|
+
@api_key = options.api_key
|
11
18
|
|
12
|
-
@environment = environment
|
19
|
+
@environment = options.environment
|
20
|
+
@timeout = options.timeout
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Transbank
|
2
|
+
module Patpass
|
3
|
+
class Options
|
4
|
+
attr_accessor :commerce_code, :api_key, :environment, :timeout
|
5
|
+
|
6
|
+
def initialize(commerce_code, api_key, environment, timeout = ::Transbank::Common::ApiConstants::REQUEST_TIMEOUT)
|
7
|
+
@commerce_code = commerce_code
|
8
|
+
@api_key = api_key
|
9
|
+
@environment = environment
|
10
|
+
@timeout = timeout
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -2,23 +2,46 @@ module Transbank
|
|
2
2
|
module Patpass
|
3
3
|
module PatpassComercio
|
4
4
|
class Inscription < ::Transbank::Common::BaseTransaction
|
5
|
-
|
5
|
+
private_class_method :new
|
6
6
|
RESOURCES_URL = ::Transbank::Common::ApiConstants::PATPASS_ENDPOINT
|
7
7
|
START_ENDPOINT = (RESOURCES_URL + '/patInscription').freeze
|
8
8
|
STATUS_ENDPOINT = (RESOURCES_URL + '/status').freeze
|
9
9
|
|
10
10
|
ENVIRONMENTS = {
|
11
|
-
production: 'https://www.pagoautomaticocontarjetas.cl',
|
11
|
+
production: 'https://www.pagoautomaticocontarjetas.cl/',
|
12
12
|
integration: 'https://pagoautomaticocontarjetasint.transbank.cl/'
|
13
13
|
}
|
14
14
|
|
15
|
-
def initialize(
|
16
|
-
super
|
15
|
+
def initialize(options)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.new(options)
|
20
|
+
super(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.build_for_integration(commerce_code, api_key)
|
24
|
+
options = Options.new(
|
25
|
+
commerce_code,
|
26
|
+
api_key,
|
27
|
+
:integration
|
28
|
+
)
|
29
|
+
|
30
|
+
new(options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.build_for_production(commerce_code, api_key)
|
34
|
+
options = Options.new(
|
35
|
+
commerce_code,
|
36
|
+
api_key,
|
37
|
+
:production
|
38
|
+
)
|
39
|
+
new(options)
|
17
40
|
end
|
18
41
|
|
19
42
|
def start(url, name, last_name, second_last_name, rut, service_id, final_url, max_amount, phone, cell_phone, patpass_name, person_email, commerce_email, address, city)
|
20
43
|
request_service = ::Transbank::Shared::RequestService.new(
|
21
|
-
ENVIRONMENTS[@environment] + START_ENDPOINT, @commerce_code, @api_key
|
44
|
+
@environment, ENVIRONMENTS[@environment] + START_ENDPOINT, @commerce_code, @api_key, @timeout, true
|
22
45
|
)
|
23
46
|
request_service.set_patpass();
|
24
47
|
request_service.post({
|
@@ -44,7 +67,7 @@ module Transbank
|
|
44
67
|
|
45
68
|
def status(token)
|
46
69
|
request_service = ::Transbank::Shared::RequestService.new(
|
47
|
-
|
70
|
+
@environment, ENVIRONMENTS[@environment] + format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key, @timeout, true
|
48
71
|
)
|
49
72
|
request_service.set_patpass();
|
50
73
|
request_service.post({token: token})
|
@@ -6,13 +6,14 @@ module Transbank
|
|
6
6
|
integration: 'https://webpay3gint.transbank.cl/'
|
7
7
|
}
|
8
8
|
|
9
|
-
def initialize(environment
|
9
|
+
def initialize(environment, endpoint, commerce_code, api_key, timeout, is_patpass= false)
|
10
|
+
@timeout = timeout
|
10
11
|
@commerce_code = commerce_code
|
11
12
|
@api_key = api_key
|
12
|
-
if
|
13
|
-
|
13
|
+
if is_patpass
|
14
|
+
@url = endpoint
|
14
15
|
else
|
15
|
-
|
16
|
+
@url = ENVIRONMENTS[environment] + endpoint
|
16
17
|
end
|
17
18
|
@headers = headers(@commerce_code, @api_key)
|
18
19
|
end
|
@@ -68,6 +69,8 @@ module Transbank
|
|
68
69
|
uri = URI.parse(@url)
|
69
70
|
http = Net::HTTP.new(uri.host, uri.port)
|
70
71
|
http.use_ssl = uri.scheme == 'https'
|
72
|
+
http.open_timeout = @timeout
|
73
|
+
http.read_timeout = @timeout
|
71
74
|
[uri, http]
|
72
75
|
end
|
73
76
|
|
@@ -2,24 +2,46 @@ module Transbank
|
|
2
2
|
module Webpay
|
3
3
|
module Oneclick
|
4
4
|
class MallInscription < ::Transbank::Common::BaseTransaction
|
5
|
-
|
5
|
+
private_class_method :new
|
6
6
|
RESOURCES_URL = ::Transbank::Common::ApiConstants::ONECLICK_ENDPOINT
|
7
7
|
START_ENDPOINT = (RESOURCES_URL + '/inscriptions').freeze
|
8
8
|
FINISH_ENDPOINT = (RESOURCES_URL + '/inscriptions/%{token}').freeze
|
9
9
|
DELETE_ENDPOINT = (RESOURCES_URL + '/inscriptions').freeze
|
10
10
|
|
11
|
-
def initialize(
|
11
|
+
def initialize(options)
|
12
12
|
super
|
13
13
|
end
|
14
|
+
|
15
|
+
def self.new(options)
|
16
|
+
super(options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.build_for_integration(commerce_code, api_key)
|
20
|
+
options = Options.new(
|
21
|
+
commerce_code,
|
22
|
+
api_key,
|
23
|
+
:integration
|
24
|
+
)
|
25
|
+
|
26
|
+
new(options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.build_for_production(commerce_code, api_key)
|
30
|
+
options = Options.new(
|
31
|
+
commerce_code,
|
32
|
+
api_key,
|
33
|
+
:production
|
34
|
+
)
|
35
|
+
new(options)
|
36
|
+
end
|
14
37
|
|
15
38
|
def start(username, email, response_url)
|
16
|
-
|
17
39
|
Transbank::Common::Validation.has_text_with_max_length(username, Transbank::Common::ApiConstants::USER_NAME_LENGTH, "username")
|
18
40
|
Transbank::Common::Validation.has_text_with_max_length(email, Transbank::Common::ApiConstants::EMAIL_LENGTH, "email")
|
19
41
|
Transbank::Common::Validation.has_text_with_max_length(response_url, Transbank::Common::ApiConstants::RETURN_URL_LENGTH, "response_url")
|
20
42
|
|
21
43
|
request_service = ::Transbank::Shared::RequestService.new(
|
22
|
-
@environment, START_ENDPOINT, @commerce_code, @api_key
|
44
|
+
@environment, START_ENDPOINT, @commerce_code, @api_key, @timeout
|
23
45
|
)
|
24
46
|
request_service.post({
|
25
47
|
username: username, email: email, response_url: response_url
|
@@ -31,7 +53,7 @@ module Transbank
|
|
31
53
|
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
32
54
|
|
33
55
|
request_service = ::Transbank::Shared::RequestService.new(
|
34
|
-
@environment, format(FINISH_ENDPOINT, token: token), @commerce_code, @api_key
|
56
|
+
@environment, format(FINISH_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
35
57
|
)
|
36
58
|
request_service.put({})
|
37
59
|
end
|
@@ -42,7 +64,7 @@ module Transbank
|
|
42
64
|
Transbank::Common::Validation.has_text_with_max_length(username, Transbank::Common::ApiConstants::USER_NAME_LENGTH, "username")
|
43
65
|
|
44
66
|
request_service = ::Transbank::Shared::RequestService.new(
|
45
|
-
@environment, DELETE_ENDPOINT, @commerce_code, @api_key
|
67
|
+
@environment, DELETE_ENDPOINT, @commerce_code, @api_key, @timeout
|
46
68
|
)
|
47
69
|
request_service.delete({tbk_user: tbk_user, username: username})
|
48
70
|
end
|
@@ -2,15 +2,38 @@ module Transbank
|
|
2
2
|
module Webpay
|
3
3
|
module Oneclick
|
4
4
|
class MallTransaction < ::Transbank::Common::BaseTransaction
|
5
|
-
|
5
|
+
private_class_method :new
|
6
6
|
RESOURCES_URL = ::Transbank::Common::ApiConstants::ONECLICK_ENDPOINT
|
7
7
|
AUTHORIZE_ENDPOINT = (RESOURCES_URL + '/transactions').freeze
|
8
8
|
STATUS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
9
9
|
REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
|
10
10
|
CAPTURE_ENDPOINT = (RESOURCES_URL + '/transactions/capture').freeze
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
super
|
12
|
+
def initialize(options)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.new(options)
|
17
|
+
super(options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.build_for_integration(commerce_code, api_key)
|
21
|
+
options = Options.new(
|
22
|
+
commerce_code,
|
23
|
+
api_key,
|
24
|
+
:integration
|
25
|
+
)
|
26
|
+
|
27
|
+
new(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.build_for_production(commerce_code, api_key)
|
31
|
+
options = Options.new(
|
32
|
+
commerce_code,
|
33
|
+
api_key,
|
34
|
+
:production
|
35
|
+
)
|
36
|
+
new(options)
|
14
37
|
end
|
15
38
|
|
16
39
|
def authorize(username, tbk_user, parent_buy_order, details)
|
@@ -20,7 +43,7 @@ module Transbank
|
|
20
43
|
Transbank::Common::Validation.has_text_with_max_length(parent_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "parent_buy_order")
|
21
44
|
|
22
45
|
request_service = ::Transbank::Shared::RequestService.new(
|
23
|
-
@environment, AUTHORIZE_ENDPOINT, @commerce_code, @api_key
|
46
|
+
@environment, AUTHORIZE_ENDPOINT, @commerce_code, @api_key, @timeout
|
24
47
|
)
|
25
48
|
request_service.post({
|
26
49
|
username: username, tbk_user: tbk_user, buy_order: parent_buy_order, details: details
|
@@ -34,7 +57,7 @@ module Transbank
|
|
34
57
|
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
35
58
|
|
36
59
|
request_service = ::Transbank::Shared::RequestService.new(
|
37
|
-
@environment, CAPTURE_ENDPOINT, @commerce_code, @api_key
|
60
|
+
@environment, CAPTURE_ENDPOINT, @commerce_code, @api_key, @timeout
|
38
61
|
)
|
39
62
|
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code, capture_amount: amount)
|
40
63
|
end
|
@@ -44,7 +67,7 @@ module Transbank
|
|
44
67
|
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
45
68
|
|
46
69
|
request_service = ::Transbank::Shared::RequestService.new(
|
47
|
-
@environment, format(STATUS_ENDPOINT, token: buy_order), @commerce_code, @api_key
|
70
|
+
@environment, format(STATUS_ENDPOINT, token: buy_order), @commerce_code, @api_key, @timeout
|
48
71
|
)
|
49
72
|
request_service.get
|
50
73
|
end
|
@@ -56,7 +79,7 @@ module Transbank
|
|
56
79
|
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
57
80
|
|
58
81
|
request_service = ::Transbank::Shared::RequestService.new(
|
59
|
-
@environment, format(REFUND_ENDPOINT, token: buy_order), @commerce_code, @api_key
|
82
|
+
@environment, format(REFUND_ENDPOINT, token: buy_order), @commerce_code, @api_key, @timeout
|
60
83
|
)
|
61
84
|
request_service.post(detail_buy_order: child_buy_order, commerce_code: child_commerce_code, amount: amount)
|
62
85
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Transbank
|
2
|
+
module Webpay
|
3
|
+
class Options
|
4
|
+
attr_accessor :commerce_code, :api_key, :environment, :timeout
|
5
|
+
|
6
|
+
def initialize(commerce_code, api_key, environment, timeout = ::Transbank::Common::ApiConstants::REQUEST_TIMEOUT)
|
7
|
+
@commerce_code = commerce_code
|
8
|
+
@api_key = api_key
|
9
|
+
@environment = environment
|
10
|
+
@timeout = timeout
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -2,7 +2,7 @@ module Transbank
|
|
2
2
|
module Webpay
|
3
3
|
module TransaccionCompleta
|
4
4
|
class MallTransaction < ::Transbank::Common::BaseTransaction
|
5
|
-
|
5
|
+
private_class_method :new
|
6
6
|
RESOURCES_URL = ::Transbank::Common::ApiConstants::WEBPAY_ENDPOINT
|
7
7
|
CREATE_ENDPOINT = (RESOURCES_URL + '/transactions/').freeze
|
8
8
|
INSTALLMENTS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/installments').freeze
|
@@ -11,13 +11,36 @@ module Transbank
|
|
11
11
|
REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
|
12
12
|
CAPTURE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/capture').freeze
|
13
13
|
|
14
|
-
def initialize(
|
15
|
-
super
|
14
|
+
def initialize(options)
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.new(options)
|
19
|
+
super(options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.build_for_integration(commerce_code, api_key)
|
23
|
+
options = Options.new(
|
24
|
+
commerce_code,
|
25
|
+
api_key,
|
26
|
+
:integration
|
27
|
+
)
|
28
|
+
|
29
|
+
new(options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.build_for_production(commerce_code, api_key)
|
33
|
+
options = Options.new(
|
34
|
+
commerce_code,
|
35
|
+
api_key,
|
36
|
+
:production
|
37
|
+
)
|
38
|
+
new(options)
|
16
39
|
end
|
17
40
|
|
18
41
|
def create(buy_order, session_id, card_number, card_expiration_date, details, cvv = nil)
|
19
42
|
request_service = ::Transbank::Shared::RequestService.new(
|
20
|
-
@environment, CREATE_ENDPOINT, @commerce_code, @api_key
|
43
|
+
@environment, CREATE_ENDPOINT, @commerce_code, @api_key, @timeout
|
21
44
|
)
|
22
45
|
request_service.post({
|
23
46
|
buy_order: buy_order, session_id: session_id, card_number: card_number, card_expiration_date: card_expiration_date, details: details, cvv: cvv
|
@@ -26,7 +49,7 @@ module Transbank
|
|
26
49
|
|
27
50
|
def installments(token, details)
|
28
51
|
request_service = ::Transbank::Shared::RequestService.new(
|
29
|
-
@environment, format(INSTALLMENTS_ENDPOINT, token: token), @commerce_code, @api_key
|
52
|
+
@environment, format(INSTALLMENTS_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
30
53
|
)
|
31
54
|
details.map {
|
32
55
|
|detail|
|
@@ -36,28 +59,28 @@ module Transbank
|
|
36
59
|
|
37
60
|
def commit(token, details)
|
38
61
|
request_service = ::Transbank::Shared::RequestService.new(
|
39
|
-
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key
|
62
|
+
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
40
63
|
)
|
41
64
|
request_service.put({details: details})
|
42
65
|
end
|
43
66
|
|
44
67
|
def status(token)
|
45
68
|
request_service = ::Transbank::Shared::RequestService.new(
|
46
|
-
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key
|
69
|
+
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
47
70
|
)
|
48
71
|
request_service.get
|
49
72
|
end
|
50
73
|
|
51
74
|
def refund(token, buy_order, commerce_code_child, amount)
|
52
75
|
request_service = ::Transbank::Shared::RequestService.new(
|
53
|
-
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key
|
76
|
+
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
54
77
|
)
|
55
78
|
request_service.post(buy_order: buy_order, commerce_code: commerce_code_child, amount: amount)
|
56
79
|
end
|
57
80
|
|
58
81
|
def capture(token, commerce_code, buy_order, authorization_code, amount)
|
59
82
|
request_service = ::Transbank::Shared::RequestService.new(
|
60
|
-
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key
|
83
|
+
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
61
84
|
)
|
62
85
|
request_service.put(buy_order: buy_order, commerce_code: commerce_code, authorization_code: authorization_code, capture_amount: amount)
|
63
86
|
end
|
@@ -2,7 +2,7 @@ module Transbank
|
|
2
2
|
module Webpay
|
3
3
|
module TransaccionCompleta
|
4
4
|
class Transaction < ::Transbank::Common::BaseTransaction
|
5
|
-
|
5
|
+
private_class_method :new
|
6
6
|
RESOURCES_URL = ::Transbank::Common::ApiConstants::WEBPAY_ENDPOINT
|
7
7
|
CREATE_ENDPOINT = (RESOURCES_URL + '/transactions/').freeze
|
8
8
|
INSTALLMENTS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/installments').freeze
|
@@ -11,9 +11,32 @@ module Transbank
|
|
11
11
|
REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
|
12
12
|
CAPTURE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/capture').freeze
|
13
13
|
|
14
|
-
def initialize(
|
14
|
+
def initialize(options)
|
15
15
|
super
|
16
16
|
end
|
17
|
+
|
18
|
+
def self.new(options)
|
19
|
+
super(options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.build_for_integration(commerce_code, api_key)
|
23
|
+
options = Options.new(
|
24
|
+
commerce_code,
|
25
|
+
api_key,
|
26
|
+
:integration
|
27
|
+
)
|
28
|
+
|
29
|
+
new(options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.build_for_production(commerce_code, api_key)
|
33
|
+
options = Options.new(
|
34
|
+
commerce_code,
|
35
|
+
api_key,
|
36
|
+
:production
|
37
|
+
)
|
38
|
+
new(options)
|
39
|
+
end
|
17
40
|
|
18
41
|
def create(buy_order, session_id, amount, cvv, card_number, card_expiration_date)
|
19
42
|
|
@@ -23,7 +46,7 @@ module Transbank
|
|
23
46
|
Transbank::Common::Validation.has_text_with_max_length(card_expiration_date, Transbank::Common::ApiConstants::CARD_EXPIRATION_DATE_LENGTH, "card_expiration_date")
|
24
47
|
|
25
48
|
request_service = ::Transbank::Shared::RequestService.new(
|
26
|
-
@environment, CREATE_ENDPOINT, @commerce_code, @api_key
|
49
|
+
@environment, CREATE_ENDPOINT, @commerce_code, @api_key, @timeout
|
27
50
|
)
|
28
51
|
request_service.post({
|
29
52
|
buy_order: buy_order, session_id: session_id, amount: amount, cvv: cvv, card_number: card_number, card_expiration_date: card_expiration_date
|
@@ -32,35 +55,35 @@ module Transbank
|
|
32
55
|
|
33
56
|
def installments(token, installments_number)
|
34
57
|
request_service = ::Transbank::Shared::RequestService.new(
|
35
|
-
@environment, format(INSTALLMENTS_ENDPOINT, token: token), @commerce_code, @api_key
|
58
|
+
@environment, format(INSTALLMENTS_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
36
59
|
)
|
37
60
|
request_service.post({installments_number: installments_number})
|
38
61
|
end
|
39
62
|
|
40
63
|
def commit(token, id_query_installments, deferred_period_index, grace_period)
|
41
64
|
request_service = ::Transbank::Shared::RequestService.new(
|
42
|
-
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key
|
65
|
+
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
43
66
|
)
|
44
67
|
request_service.put({id_query_installments: id_query_installments, deferred_period_index: deferred_period_index, grace_period: grace_period})
|
45
68
|
end
|
46
69
|
|
47
70
|
def status(token)
|
48
71
|
request_service = ::Transbank::Shared::RequestService.new(
|
49
|
-
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key
|
72
|
+
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
50
73
|
)
|
51
74
|
request_service.get
|
52
75
|
end
|
53
76
|
|
54
77
|
def refund(token, amount)
|
55
78
|
request_service = ::Transbank::Shared::RequestService.new(
|
56
|
-
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key
|
79
|
+
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
57
80
|
)
|
58
81
|
request_service.post(amount: amount)
|
59
82
|
end
|
60
83
|
|
61
84
|
def capture(token, buy_order, authorization_code, amount)
|
62
85
|
request_service = ::Transbank::Shared::RequestService.new(
|
63
|
-
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key
|
86
|
+
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
64
87
|
)
|
65
88
|
request_service.put(buy_order: buy_order, authorization_code: authorization_code, capture_amount: amount)
|
66
89
|
end
|
@@ -2,7 +2,7 @@ module Transbank
|
|
2
2
|
module Webpay
|
3
3
|
module WebpayPlus
|
4
4
|
class MallTransaction < ::Transbank::Common::BaseTransaction
|
5
|
-
|
5
|
+
private_class_method :new
|
6
6
|
RESOURCES_URL = ::Transbank::Common::ApiConstants::WEBPAY_ENDPOINT
|
7
7
|
CREATE_ENDPOINT = (RESOURCES_URL + '/transactions/').freeze
|
8
8
|
COMMIT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
@@ -10,10 +10,33 @@ module Transbank
|
|
10
10
|
REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
|
11
11
|
CAPTURE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/capture').freeze
|
12
12
|
|
13
|
-
def initialize(
|
13
|
+
def initialize(options)
|
14
14
|
super
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.new(options)
|
18
|
+
super(options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.build_for_integration(commerce_code, api_key)
|
22
|
+
options = Options.new(
|
23
|
+
commerce_code,
|
24
|
+
api_key,
|
25
|
+
:integration
|
26
|
+
)
|
27
|
+
|
28
|
+
new(options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.build_for_production(commerce_code, api_key)
|
32
|
+
options = Options.new(
|
33
|
+
commerce_code,
|
34
|
+
api_key,
|
35
|
+
:production
|
36
|
+
)
|
37
|
+
new(options)
|
38
|
+
end
|
39
|
+
|
17
40
|
def create(buy_order, session_id, return_url, details)
|
18
41
|
|
19
42
|
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
@@ -21,7 +44,7 @@ module Transbank
|
|
21
44
|
Transbank::Common::Validation.has_text_with_max_length(return_url, Transbank::Common::ApiConstants::RETURN_URL_LENGTH, "return_url")
|
22
45
|
|
23
46
|
request_service = ::Transbank::Shared::RequestService.new(
|
24
|
-
@environment, CREATE_ENDPOINT, @commerce_code, @api_key
|
47
|
+
@environment, CREATE_ENDPOINT, @commerce_code, @api_key, @timeout
|
25
48
|
)
|
26
49
|
request_service.post({
|
27
50
|
buy_order: buy_order, session_id: session_id, return_url: return_url, details: details
|
@@ -33,7 +56,7 @@ module Transbank
|
|
33
56
|
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
34
57
|
|
35
58
|
request_service = ::Transbank::Shared::RequestService.new(
|
36
|
-
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key
|
59
|
+
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
37
60
|
)
|
38
61
|
request_service.put({})
|
39
62
|
end
|
@@ -43,7 +66,7 @@ module Transbank
|
|
43
66
|
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
44
67
|
|
45
68
|
request_service = ::Transbank::Shared::RequestService.new(
|
46
|
-
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key
|
69
|
+
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
47
70
|
)
|
48
71
|
request_service.get
|
49
72
|
end
|
@@ -55,7 +78,7 @@ module Transbank
|
|
55
78
|
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
56
79
|
|
57
80
|
request_service = ::Transbank::Shared::RequestService.new(
|
58
|
-
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key
|
81
|
+
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
59
82
|
)
|
60
83
|
request_service.post(buy_order: buy_order, commerce_code: child_commerce_code, amount: amount)
|
61
84
|
end
|
@@ -69,7 +92,7 @@ module Transbank
|
|
69
92
|
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
70
93
|
|
71
94
|
request_service = ::Transbank::Shared::RequestService.new(
|
72
|
-
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key
|
95
|
+
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
73
96
|
)
|
74
97
|
request_service.put(commerce_code: child_commerce_code, buy_order: buy_order, authorization_code: authorization_code, capture_amount: capture_amount)
|
75
98
|
end
|
@@ -2,17 +2,39 @@ module Transbank
|
|
2
2
|
module Webpay
|
3
3
|
module WebpayPlus
|
4
4
|
class Transaction < ::Transbank::Common::BaseTransaction
|
5
|
-
|
5
|
+
private_class_method :new
|
6
6
|
RESOURCES_URL = ::Transbank::Common::ApiConstants::WEBPAY_ENDPOINT
|
7
7
|
CREATE_ENDPOINT = (RESOURCES_URL + '/transactions/').freeze
|
8
8
|
COMMIT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
9
9
|
STATUS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
10
10
|
REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
|
11
11
|
CAPTURE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/capture').freeze
|
12
|
+
|
13
|
+
def initialize(options)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.new(options)
|
18
|
+
super(options)
|
19
|
+
end
|
12
20
|
|
13
|
-
|
14
|
-
|
15
|
-
|
21
|
+
def self.build_for_integration(commerce_code, api_key)
|
22
|
+
options = Options.new(
|
23
|
+
commerce_code,
|
24
|
+
api_key,
|
25
|
+
:integration
|
26
|
+
)
|
27
|
+
|
28
|
+
new(options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.build_for_production(commerce_code, api_key)
|
32
|
+
options = Options.new(
|
33
|
+
commerce_code,
|
34
|
+
api_key,
|
35
|
+
:production
|
36
|
+
)
|
37
|
+
new(options)
|
16
38
|
end
|
17
39
|
|
18
40
|
def create(buy_order, session_id, amount, return_url)
|
@@ -22,7 +44,7 @@ module Transbank
|
|
22
44
|
Transbank::Common::Validation.has_text_with_max_length(return_url, Transbank::Common::ApiConstants::RETURN_URL_LENGTH, "return_url")
|
23
45
|
|
24
46
|
request_service = ::Transbank::Shared::RequestService.new(
|
25
|
-
@environment, CREATE_ENDPOINT, @commerce_code, @api_key
|
47
|
+
@environment, CREATE_ENDPOINT, @commerce_code, @api_key, @timeout
|
26
48
|
)
|
27
49
|
request_service.post({
|
28
50
|
buy_order: buy_order, session_id: session_id, amount: amount, return_url: return_url
|
@@ -34,7 +56,7 @@ module Transbank
|
|
34
56
|
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
35
57
|
|
36
58
|
request_service = ::Transbank::Shared::RequestService.new(
|
37
|
-
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key
|
59
|
+
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
38
60
|
)
|
39
61
|
request_service.put({})
|
40
62
|
end
|
@@ -44,7 +66,7 @@ module Transbank
|
|
44
66
|
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
45
67
|
|
46
68
|
request_service = ::Transbank::Shared::RequestService.new(
|
47
|
-
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key
|
69
|
+
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
48
70
|
)
|
49
71
|
request_service.get
|
50
72
|
end
|
@@ -54,7 +76,7 @@ module Transbank
|
|
54
76
|
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
55
77
|
|
56
78
|
request_service = ::Transbank::Shared::RequestService.new(
|
57
|
-
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key
|
79
|
+
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
58
80
|
)
|
59
81
|
request_service.post(amount: amount)
|
60
82
|
end
|
@@ -66,10 +88,11 @@ module Transbank
|
|
66
88
|
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
67
89
|
|
68
90
|
request_service = ::Transbank::Shared::RequestService.new(
|
69
|
-
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key
|
91
|
+
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key, @timeout
|
70
92
|
)
|
71
93
|
request_service.put(buy_order: buy_order, authorization_code: authorization_code, capture_amount: amount)
|
72
94
|
end
|
95
|
+
|
73
96
|
end
|
74
97
|
end
|
75
98
|
end
|
data/lib/transbank/sdk.rb
CHANGED
@@ -12,6 +12,9 @@ require 'transbank/sdk/common/validation'
|
|
12
12
|
require 'transbank/sdk/shared/request_service'
|
13
13
|
require 'transbank/sdk/shared/transbank_error'
|
14
14
|
|
15
|
+
require 'transbank/sdk/webpay/options'
|
16
|
+
require 'transbank/sdk/patpass/options'
|
17
|
+
|
15
18
|
require 'transbank/sdk/webpay/webpay_plus/transaction'
|
16
19
|
require 'transbank/sdk/webpay/webpay_plus/mall_transaction'
|
17
20
|
|
@@ -21,7 +24,5 @@ require 'transbank/sdk/webpay/oneclick/mall_inscription'
|
|
21
24
|
require 'transbank/sdk/webpay/transaccion_completa/transaction'
|
22
25
|
require 'transbank/sdk/webpay/transaccion_completa/mall_transaction'
|
23
26
|
|
24
|
-
require 'transbank/sdk/patpass/patpass_by_webpay/transaction'
|
25
27
|
require 'transbank/sdk/patpass/patpass_comercio/inscription'
|
26
28
|
|
27
|
-
require 'transbank/sdk/webpay/webpay_plus_modal/transaction'
|
data/transbank-sdk.gemspec
CHANGED
@@ -12,6 +12,8 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = %q{Transbank SDK for Ruby}
|
13
13
|
spec.homepage = "https://www.transbankdevelopers.cl/"
|
14
14
|
spec.license = "BSD-3-Clause"
|
15
|
+
spec.required_ruby_version = ">= 2.7"
|
16
|
+
spec.required_rubygems_version = ">= 3.0"
|
15
17
|
|
16
18
|
# Specify which files should be added to the gem when it is released.
|
17
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -22,14 +24,14 @@ Gem::Specification.new do |spec|
|
|
22
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
25
|
spec.require_paths = ["lib"]
|
24
26
|
|
25
|
-
spec.add_dependency "json", "~> 2.
|
26
|
-
spec.add_development_dependency "bundler", "~> 2.
|
27
|
-
spec.add_development_dependency "rake", "~>
|
28
|
-
spec.add_development_dependency "minitest", "~> 5.
|
29
|
-
spec.add_development_dependency "rubocop", "~>
|
30
|
-
spec.add_development_dependency "pry", "~> 0.
|
31
|
-
spec.add_development_dependency 'minitest-reporters', '~> 1.
|
27
|
+
spec.add_dependency "json", "~> 2.6"
|
28
|
+
spec.add_development_dependency "bundler", "~> 2.4"
|
29
|
+
spec.add_development_dependency "rake", "~> 13.2"
|
30
|
+
spec.add_development_dependency "minitest", "~> 5.2"
|
31
|
+
spec.add_development_dependency "rubocop", "~> 1.50"
|
32
|
+
spec.add_development_dependency "pry", "~> 0.14"
|
33
|
+
spec.add_development_dependency 'minitest-reporters', '~> 1.6'
|
32
34
|
spec.add_development_dependency 'byebug', "~> 11.1"
|
33
35
|
spec.add_development_dependency 'pry-byebug', "~> 3.9"
|
34
|
-
spec.add_development_dependency 'webmock', "~> 3.
|
36
|
+
spec.add_development_dependency 'webmock', "~> 3.19"
|
35
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transbank-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Transbank Developers
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.4'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '5.
|
61
|
+
version: '5.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '5.
|
68
|
+
version: '5.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.50'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '1.50'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
89
|
+
version: '0.14'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
96
|
+
version: '0.14'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: minitest-reporters
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.6'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
110
|
+
version: '1.6'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: byebug
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,15 +142,15 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '3.
|
145
|
+
version: '3.19'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '3.
|
153
|
-
description:
|
152
|
+
version: '3.19'
|
153
|
+
description:
|
154
154
|
email:
|
155
155
|
- transbankdevelopers@continuum.cl
|
156
156
|
executables: []
|
@@ -176,24 +176,24 @@ files:
|
|
176
176
|
- lib/transbank/sdk/common/integration_api_keys.rb
|
177
177
|
- lib/transbank/sdk/common/integration_commerce_codes.rb
|
178
178
|
- lib/transbank/sdk/common/validation.rb
|
179
|
-
- lib/transbank/sdk/patpass/
|
179
|
+
- lib/transbank/sdk/patpass/options.rb
|
180
180
|
- lib/transbank/sdk/patpass/patpass_comercio/inscription.rb
|
181
181
|
- lib/transbank/sdk/shared/request_service.rb
|
182
182
|
- lib/transbank/sdk/shared/transbank_error.rb
|
183
183
|
- lib/transbank/sdk/version.rb
|
184
184
|
- lib/transbank/sdk/webpay/oneclick/mall_inscription.rb
|
185
185
|
- lib/transbank/sdk/webpay/oneclick/mall_transaction.rb
|
186
|
+
- lib/transbank/sdk/webpay/options.rb
|
186
187
|
- lib/transbank/sdk/webpay/transaccion_completa/mall_transaction.rb
|
187
188
|
- lib/transbank/sdk/webpay/transaccion_completa/transaction.rb
|
188
189
|
- lib/transbank/sdk/webpay/webpay_plus/mall_transaction.rb
|
189
190
|
- lib/transbank/sdk/webpay/webpay_plus/transaction.rb
|
190
|
-
- lib/transbank/sdk/webpay/webpay_plus_modal/transaction.rb
|
191
191
|
- transbank-sdk.gemspec
|
192
192
|
homepage: https://www.transbankdevelopers.cl/
|
193
193
|
licenses:
|
194
194
|
- BSD-3-Clause
|
195
195
|
metadata: {}
|
196
|
-
post_install_message:
|
196
|
+
post_install_message:
|
197
197
|
rdoc_options: []
|
198
198
|
require_paths:
|
199
199
|
- lib
|
@@ -201,16 +201,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
201
|
requirements:
|
202
202
|
- - ">="
|
203
203
|
- !ruby/object:Gem::Version
|
204
|
-
version: '
|
204
|
+
version: '2.7'
|
205
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
207
|
- - ">="
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: '0'
|
209
|
+
version: '3.0'
|
210
210
|
requirements: []
|
211
|
-
|
212
|
-
|
213
|
-
signing_key:
|
211
|
+
rubygems_version: 3.1.6
|
212
|
+
signing_key:
|
214
213
|
specification_version: 4
|
215
214
|
summary: Transbank SDK for Ruby
|
216
215
|
test_files: []
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Transbank
|
2
|
-
module Patpass
|
3
|
-
module PatpassByWebpay
|
4
|
-
class Transaction < ::Transbank::Common::BaseTransaction
|
5
|
-
DEFAULT_ENVIRONMENT = :integration
|
6
|
-
RESOURCES_URL = ::Transbank::Common::ApiConstants::WEBPAY_ENDPOINT
|
7
|
-
CREATE_ENDPOINT = (RESOURCES_URL + '/transactions/').freeze
|
8
|
-
COMMIT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
9
|
-
STATUS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
10
|
-
|
11
|
-
def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::PATPASS_BY_WEBPAY, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
|
12
|
-
super
|
13
|
-
end
|
14
|
-
|
15
|
-
def create(buy_order, session_id, amount, return_url, details)
|
16
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
17
|
-
@environment, CREATE_ENDPOINT, @commerce_code, @api_key
|
18
|
-
)
|
19
|
-
request_service.post({
|
20
|
-
buy_order: buy_order, session_id: session_id, amount: amount, return_url: return_url, wpm_detail: details
|
21
|
-
})
|
22
|
-
end
|
23
|
-
|
24
|
-
def commit(token)
|
25
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
26
|
-
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key
|
27
|
-
)
|
28
|
-
request_service.put({})
|
29
|
-
end
|
30
|
-
|
31
|
-
def status(token)
|
32
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
33
|
-
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key
|
34
|
-
)
|
35
|
-
request_service.get
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module Transbank
|
2
|
-
module Webpay
|
3
|
-
module WebpayPlusModal
|
4
|
-
class Transaction < ::Transbank::Common::BaseTransaction
|
5
|
-
DEFAULT_ENVIRONMENT = :integration
|
6
|
-
RESOURCES_URL = ::Transbank::Common::ApiConstants::WEBPAY_ENDPOINT
|
7
|
-
CREATE_ENDPOINT = (RESOURCES_URL + '/transactions/').freeze
|
8
|
-
COMMIT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
9
|
-
STATUS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
10
|
-
REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
|
11
|
-
|
12
|
-
def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::WEBPAY_PLUS_MODAL, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
|
13
|
-
super(commerce_code, api_key, environment)
|
14
|
-
end
|
15
|
-
|
16
|
-
def create(buy_order, session_id, amount)
|
17
|
-
|
18
|
-
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
19
|
-
Transbank::Common::Validation.has_text_with_max_length(session_id, Transbank::Common::ApiConstants::SESSION_ID_LENGTH, "session_id")
|
20
|
-
|
21
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
22
|
-
@environment, CREATE_ENDPOINT, @commerce_code, @api_key
|
23
|
-
)
|
24
|
-
request_service.post({
|
25
|
-
buy_order: buy_order, session_id: session_id, amount: amount
|
26
|
-
})
|
27
|
-
end
|
28
|
-
|
29
|
-
def commit(token)
|
30
|
-
|
31
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
32
|
-
|
33
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
34
|
-
@environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key
|
35
|
-
)
|
36
|
-
request_service.put({})
|
37
|
-
end
|
38
|
-
|
39
|
-
def status(token)
|
40
|
-
|
41
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
42
|
-
|
43
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
44
|
-
@environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key
|
45
|
-
)
|
46
|
-
request_service.get
|
47
|
-
end
|
48
|
-
|
49
|
-
def refund(token, amount)
|
50
|
-
|
51
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
52
|
-
|
53
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
54
|
-
@environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key
|
55
|
-
)
|
56
|
-
request_service.post(amount: amount)
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|