transbank-sdk 3.0.2 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +46 -26
- data/lib/transbank/sdk/common/api_constants.rb +2 -2
- data/lib/transbank/sdk/shared/request_service.rb +1 -1
- data/lib/transbank/sdk/version.rb +1 -1
- data/lib/transbank/sdk/webpay/oneclick/mall_transaction.rb +0 -52
- data/lib/transbank/sdk/webpay/transaccion_completa/mall_transaction.rb +0 -55
- data/lib/transbank/sdk/webpay/transaccion_completa/transaction.rb +0 -50
- data/lib/transbank/sdk/webpay/webpay_plus/mall_transaction.rb +0 -55
- data/lib/transbank/sdk/webpay/webpay_plus/transaction.rb +0 -51
- metadata +2 -6
- data/Dockerfile +0 -5
- data/Makefile +0 -24
- data/docker-compose.yml +0 -20
- data/sdk_test.sh +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9df240bb39ebfec8fe1d6df24389ae30918d52fc
|
4
|
+
data.tar.gz: c49264215b6e818cc94a2c2e596a86f069c9e4e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 883ad418e9f1f421bd3b097591ab5e955a5bfda92683d9a7893f08c4be041c6cdfe68efef25d2c4f6d277b745d32b8b0a35f3bbed60a127bec4a1dff1c8099a7
|
7
|
+
data.tar.gz: 7be5c486595297097e33da126a7a64ae9d83337786e4e50100150bf1a31a5f85706b3352dd339181b084711ca0eba1a1d612e266727c42432973dfc75d43ec8a
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,16 @@ 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
|
+
## [4.0.0] - 2024-03-20
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Downgrade del API de la versión 1.3 a la versión 1.2
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
|
16
|
+
- Corregido un error en RequestService que causaba problemas debido a la dependencia de `.blank?`, que no es parte de la biblioteca estándar de Ruby
|
17
|
+
|
8
18
|
## [3.0.2] - 2023-03-7
|
9
19
|
|
10
20
|
### Fixed
|
data/README.md
CHANGED
@@ -9,23 +9,26 @@ SDK Oficial de Transbank
|
|
9
9
|
# Instalación
|
10
10
|
|
11
11
|
Puedes instalar el SDK directamente
|
12
|
+
|
12
13
|
```bash
|
13
14
|
gem install transbank-sdk
|
14
15
|
```
|
15
16
|
|
16
17
|
o añadirlo a tu `Gemfile`
|
18
|
+
|
17
19
|
```ruby
|
18
20
|
gem 'transbank-sdk'
|
19
21
|
```
|
22
|
+
|
20
23
|
y luego ejecutar
|
24
|
+
|
21
25
|
```bash
|
22
26
|
bundle install
|
23
27
|
```
|
24
|
-
## Documentación
|
25
28
|
|
26
|
-
|
29
|
+
## Documentación
|
27
30
|
|
28
|
-
|
31
|
+
Puedes encontrar toda la documentación de cómo usar este SDK en el sitio https://www.transbankdevelopers.cl.
|
29
32
|
|
30
33
|
La documentación relevante para usar este SDK es:
|
31
34
|
|
@@ -34,45 +37,62 @@ La documentación relevante para usar este SDK es:
|
|
34
37
|
|
35
38
|
## Información para contribuir y desarrollar este SDK
|
36
39
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
#### Short lead tokens
|
41
|
+
|
42
|
+
`WIP` = En progreso.
|
43
|
+
|
44
|
+
`feat` = Nuevos features.
|
45
|
+
|
46
|
+
`fix` = Corrección de un bug.
|
47
|
+
|
48
|
+
`docs` = Cambios solo de documentación.
|
49
|
+
|
50
|
+
`style` = Cambios que no afectan el significado del código. (espaciado, formateo de código, comillas faltantes, etc)
|
51
|
+
|
52
|
+
`refactor` = Un cambio en el código que no arregla un bug ni agrega una funcionalidad.
|
53
|
+
|
54
|
+
`perf` = Cambio que mejora el rendimiento.
|
55
|
+
|
56
|
+
`test` = Agregar test faltantes o los corrige.
|
57
|
+
|
58
|
+
`chore` = Cambios en el build o herramientas auxiliares y librerías.
|
59
|
+
|
60
|
+
`revert` = Revierte un commit.
|
61
|
+
|
62
|
+
`release` = Para liberar una nueva versión.
|
41
63
|
|
42
64
|
### Standares
|
43
65
|
|
44
66
|
- Para los commits respetamos las siguientes normas: https://chris.beams.io/posts/git-commit/
|
45
67
|
- Usamos ingles, para los mensajes de commit.
|
46
68
|
- Se pueden usar tokens como WIP, en el subject de un commit, separando el token con `:`, por ejemplo:
|
47
|
-
`WIP: This is a useful commit message`
|
69
|
+
`WIP: This is a useful commit message`
|
48
70
|
- Para los nombres de ramas también usamos ingles.
|
49
71
|
- Se asume, que una rama de feature no mezclada, es un feature no terminado.
|
50
72
|
- El nombre de las ramas va en minúsculas.
|
51
73
|
- Las palabras se separan con `-`.
|
52
74
|
- Las ramas comienzan con alguno de los short lead tokens definidos, por ejemplo: `feat/tokens-configuration`
|
53
75
|
|
54
|
-
|
55
|
-
##### Commits
|
56
|
-
- WIP = Trabajo en progreso.
|
57
|
-
##### Ramas
|
58
|
-
- feat = Nuevos features
|
59
|
-
- chore = Tareas, que no son visibles al usuario.
|
60
|
-
- bug = Resolución de bugs.
|
76
|
+
### **Reglas** 📖
|
61
77
|
|
62
|
-
|
78
|
+
1. Todo PR debe incluir test o evidencia de que funcione correctamente(gif, foto).
|
79
|
+
2. El PR debe tener 2 o más aprobaciones para poder mezclarse.
|
80
|
+
3. Si un commit revierte un commit anterior deberá comenzar con "revert:" seguido del mensaje del commit anterior.
|
63
81
|
|
64
|
-
###
|
65
|
-
Primero y solamente una vez para instalar gemas debes usar el siguiente comando en una terminal.
|
66
|
-
```bash
|
67
|
-
make build
|
68
|
-
```
|
82
|
+
### **Pull Request**
|
69
83
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
84
|
+
- Usar un lenguaje imperativo y en tiempo presente: "change" no "changed" ni "changes".
|
85
|
+
- El título del los PR y mensajes de commit no pueden comenzar con una letra mayúscula.
|
86
|
+
- No se debe usar punto final en los títulos o descripción de los commits.
|
87
|
+
- El título del PR debe comenzar con el short lead token definido para la rama, seguido de : y una breve descripción del cambio.
|
88
|
+
- La descripción del PR debe detallar los cambios.
|
89
|
+
- La descripción del PR debe incluir evidencias de que los test se ejecutan de forma correcta.
|
90
|
+
- Se pueden usar gif o videos para complementar la descripción o evidenciar el funcionamiento del PR.
|
91
|
+
|
92
|
+
### Todas las mezclas a master se hacen mediante Pull Request.
|
74
93
|
|
75
94
|
### Deploy de una nueva versión.
|
95
|
+
|
76
96
|
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).
|
77
97
|
|
78
98
|
En ese PR deben incluirse los siguientes cambios:
|
@@ -82,4 +102,4 @@ En ese PR deben incluirse los siguientes cambios:
|
|
82
102
|
|
83
103
|
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.
|
84
104
|
|
85
|
-
Con eso Github Actions generará automáticamente una nueva versión de la librería y la publicará en RubyGems.
|
105
|
+
Con eso Github Actions generará automáticamente una nueva versión de la librería y la publicará en RubyGems.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Transbank
|
2
2
|
module Common
|
3
3
|
module ApiConstants
|
4
|
-
WEBPAY_ENDPOINT = 'rswebpaytransaction/api/webpay/v1.
|
5
|
-
ONECLICK_ENDPOINT = 'rswebpaytransaction/api/oneclick/v1.
|
4
|
+
WEBPAY_ENDPOINT = 'rswebpaytransaction/api/webpay/v1.2'.freeze
|
5
|
+
ONECLICK_ENDPOINT = 'rswebpaytransaction/api/oneclick/v1.2'.freeze
|
6
6
|
PATPASS_ENDPOINT = 'restpatpass/v1/services'.freeze
|
7
7
|
|
8
8
|
BUY_ORDER_LENGTH = 26;
|
@@ -52,7 +52,7 @@ module Transbank
|
|
52
52
|
return JSON.parse(response.body)
|
53
53
|
end
|
54
54
|
|
55
|
-
if !response.body.
|
55
|
+
if !response.body.to_s.empty?
|
56
56
|
body = JSON.parse(response.body)
|
57
57
|
if body.key?("description")
|
58
58
|
raise TransbankError, "Transbank Error: #{body['code']} - #{body['description']}"
|
@@ -8,10 +8,6 @@ module Transbank
|
|
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
|
-
INCREASE_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/amount').freeze
|
12
|
-
INCREASE_AUTHORIZATION_DATE_ENDPOINT = (RESOURCES_URL + '/transactions/authorization_date').freeze
|
13
|
-
REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/reverse/amount').freeze
|
14
|
-
DEFERRED_CAPTURE_HISTORY_ENDPOINT = (RESOURCES_URL + '/transactions/details').freeze
|
15
11
|
|
16
12
|
def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::ONECLICK_MALL, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
|
17
13
|
super(commerce_code, api_key, environment)
|
@@ -64,54 +60,6 @@ module Transbank
|
|
64
60
|
)
|
65
61
|
request_service.post(detail_buy_order: child_buy_order, commerce_code: child_commerce_code, amount: amount)
|
66
62
|
end
|
67
|
-
|
68
|
-
def increase_amount(child_commerce_code, child_buy_order, authorization_code, amount)
|
69
|
-
|
70
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
71
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
72
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
73
|
-
|
74
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
75
|
-
@environment, INCREASE_AMOUNT_ENDPOINT, @commerce_code, @api_key
|
76
|
-
)
|
77
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code, amount: amount)
|
78
|
-
end
|
79
|
-
|
80
|
-
def increase_authorization_date(child_commerce_code, child_buy_order, authorization_code)
|
81
|
-
|
82
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
83
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
84
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
85
|
-
|
86
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
87
|
-
@environment, INCREASE_AUTHORIZATION_DATE_ENDPOINT, @commerce_code, @api_key
|
88
|
-
)
|
89
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code)
|
90
|
-
end
|
91
|
-
|
92
|
-
def reverse_pre_authorized_amount(child_commerce_code, child_buy_order, authorization_code, amount)
|
93
|
-
|
94
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
95
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
96
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
97
|
-
|
98
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
99
|
-
@environment, REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT, @commerce_code, @api_key
|
100
|
-
)
|
101
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code, amount: amount)
|
102
|
-
end
|
103
|
-
|
104
|
-
def deferred_capture_history(child_commerce_code, child_buy_order, authorization_code)
|
105
|
-
|
106
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
107
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
108
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
109
|
-
|
110
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
111
|
-
@environment, DEFERRED_CAPTURE_HISTORY_ENDPOINT, @commerce_code, @api_key
|
112
|
-
)
|
113
|
-
request_service.post(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code)
|
114
|
-
end
|
115
63
|
end
|
116
64
|
end
|
117
65
|
end
|
@@ -10,10 +10,6 @@ module Transbank
|
|
10
10
|
STATUS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
11
11
|
REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
|
12
12
|
CAPTURE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/capture').freeze
|
13
|
-
INCREASE_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/amount').freeze
|
14
|
-
INCREASE_AUTHORIZATION_DATE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/authorization_date').freeze
|
15
|
-
REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/reverse/amount').freeze
|
16
|
-
DEFERRED_CAPTURE_HISTORY_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/details').freeze
|
17
13
|
|
18
14
|
def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::TRANSACCION_COMPLETA_MALL, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
|
19
15
|
super(commerce_code, api_key, environment)
|
@@ -65,57 +61,6 @@ module Transbank
|
|
65
61
|
)
|
66
62
|
request_service.put(buy_order: buy_order, commerce_code: commerce_code, authorization_code: authorization_code, capture_amount: amount)
|
67
63
|
end
|
68
|
-
|
69
|
-
def increase_amount(token, child_commerce_code, child_buy_order, authorization_code, amount)
|
70
|
-
|
71
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
72
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
73
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
74
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
75
|
-
|
76
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
77
|
-
@environment, format(INCREASE_AMOUNT_ENDPOINT, token: token), @commerce_code, @api_key
|
78
|
-
)
|
79
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code, amount: amount)
|
80
|
-
end
|
81
|
-
|
82
|
-
def increase_authorization_date(token, child_commerce_code, child_buy_order, authorization_code)
|
83
|
-
|
84
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
85
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
86
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
87
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
88
|
-
|
89
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
90
|
-
@environment, format(INCREASE_AUTHORIZATION_DATE_ENDPOINT, token: token), @commerce_code, @api_key
|
91
|
-
)
|
92
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code)
|
93
|
-
end
|
94
|
-
|
95
|
-
def reverse_pre_authorized_amount(token, child_commerce_code, child_buy_order, authorization_code, amount)
|
96
|
-
|
97
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
98
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
99
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
100
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
101
|
-
|
102
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
103
|
-
@environment, format(REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT, token: token), @commerce_code, @api_key
|
104
|
-
)
|
105
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code, amount: amount)
|
106
|
-
end
|
107
|
-
|
108
|
-
def deferred_capture_history(token, child_commerce_code, child_buy_order)
|
109
|
-
|
110
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
111
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
112
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
113
|
-
|
114
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
115
|
-
@environment, format(DEFERRED_CAPTURE_HISTORY_ENDPOINT, token: token), @commerce_code, @api_key
|
116
|
-
)
|
117
|
-
request_service.post(commerce_code: child_commerce_code, buy_order: child_buy_order)
|
118
|
-
end
|
119
64
|
end
|
120
65
|
end
|
121
66
|
end
|
@@ -10,10 +10,6 @@ module Transbank
|
|
10
10
|
STATUS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
|
11
11
|
REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
|
12
12
|
CAPTURE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/capture').freeze
|
13
|
-
INCREASE_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/amount').freeze
|
14
|
-
INCREASE_AUTHORIZATION_DATE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/authorization_date').freeze
|
15
|
-
REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/reverse/amount').freeze
|
16
|
-
DEFERRED_CAPTURE_HISTORY_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/details').freeze
|
17
13
|
|
18
14
|
def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::TRANSACCION_COMPLETA, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
|
19
15
|
super
|
@@ -67,52 +63,6 @@ module Transbank
|
|
67
63
|
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key
|
68
64
|
)
|
69
65
|
request_service.put(buy_order: buy_order, authorization_code: authorization_code, capture_amount: amount)
|
70
|
-
end
|
71
|
-
|
72
|
-
def increase_amount(token, buy_order, authorization_code, amount)
|
73
|
-
|
74
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
75
|
-
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
76
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
77
|
-
|
78
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
79
|
-
@environment, format(INCREASE_AMOUNT_ENDPOINT, token: token), @commerce_code, @api_key
|
80
|
-
)
|
81
|
-
request_service.put(commerce_code: @commerce_code, buy_order: buy_order, authorization_code: authorization_code, amount: amount)
|
82
|
-
end
|
83
|
-
|
84
|
-
def increase_authorization_date(token, buy_order, authorization_code)
|
85
|
-
|
86
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
87
|
-
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
88
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
89
|
-
|
90
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
91
|
-
@environment, format(INCREASE_AUTHORIZATION_DATE_ENDPOINT, token: token), @commerce_code, @api_key
|
92
|
-
)
|
93
|
-
request_service.put(commerce_code: @commerce_code, buy_order: buy_order, authorization_code: authorization_code)
|
94
|
-
end
|
95
|
-
|
96
|
-
def reverse_pre_authorized_amount(token, buy_order, authorization_code, amount)
|
97
|
-
|
98
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
99
|
-
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
100
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
101
|
-
|
102
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
103
|
-
@environment, format(REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT, token: token), @commerce_code, @api_key
|
104
|
-
)
|
105
|
-
request_service.put(commerce_code: @commerce_code, buy_order: buy_order, authorization_code: authorization_code, amount: amount)
|
106
|
-
end
|
107
|
-
|
108
|
-
def deferred_capture_history(token)
|
109
|
-
|
110
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
111
|
-
|
112
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
113
|
-
@environment, format(DEFERRED_CAPTURE_HISTORY_ENDPOINT, token: token), @commerce_code, @api_key
|
114
|
-
)
|
115
|
-
request_service.get
|
116
66
|
end
|
117
67
|
end
|
118
68
|
end
|
@@ -9,10 +9,6 @@ module Transbank
|
|
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
|
-
INCREASE_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/amount').freeze
|
13
|
-
INCREASE_AUTHORIZATION_DATE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/authorization_date').freeze
|
14
|
-
REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/reverse/amount').freeze
|
15
|
-
DEFERRED_CAPTURE_HISTORY_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/details').freeze
|
16
12
|
|
17
13
|
def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::WEBPAY_PLUS_MALL, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
|
18
14
|
super
|
@@ -77,57 +73,6 @@ module Transbank
|
|
77
73
|
)
|
78
74
|
request_service.put(commerce_code: child_commerce_code, buy_order: buy_order, authorization_code: authorization_code, capture_amount: capture_amount)
|
79
75
|
end
|
80
|
-
|
81
|
-
def increase_amount(token, child_commerce_code, child_buy_order, authorization_code, amount)
|
82
|
-
|
83
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
84
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
85
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
86
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
87
|
-
|
88
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
89
|
-
@environment, format(INCREASE_AMOUNT_ENDPOINT, token: token), @commerce_code, @api_key
|
90
|
-
)
|
91
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code, amount: amount)
|
92
|
-
end
|
93
|
-
|
94
|
-
def increase_authorization_date(token, child_commerce_code, child_buy_order, authorization_code)
|
95
|
-
|
96
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
97
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
98
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
99
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
100
|
-
|
101
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
102
|
-
@environment, format(INCREASE_AUTHORIZATION_DATE_ENDPOINT, token: token), @commerce_code, @api_key
|
103
|
-
)
|
104
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code)
|
105
|
-
end
|
106
|
-
|
107
|
-
def reverse_pre_authorized_amount(token, child_commerce_code, child_buy_order, authorization_code, amount)
|
108
|
-
|
109
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
110
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
111
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
112
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
113
|
-
|
114
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
115
|
-
@environment, format(REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT, token: token), @commerce_code, @api_key
|
116
|
-
)
|
117
|
-
request_service.put(commerce_code: child_commerce_code, buy_order: child_buy_order, authorization_code: authorization_code, amount: amount)
|
118
|
-
end
|
119
|
-
|
120
|
-
def deferred_capture_history(token, child_commerce_code, child_buy_order)
|
121
|
-
|
122
|
-
Transbank::Common::Validation.has_text_with_max_length(child_commerce_code, Transbank::Common::ApiConstants::COMMERCE_CODE_LENGTH, "child_commerce_code")
|
123
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
124
|
-
Transbank::Common::Validation.has_text_with_max_length(child_buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "child_buy_order")
|
125
|
-
|
126
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
127
|
-
@environment, format(DEFERRED_CAPTURE_HISTORY_ENDPOINT, token: token), @commerce_code, @api_key
|
128
|
-
)
|
129
|
-
request_service.post(commerce_code: child_commerce_code, buy_order: child_buy_order)
|
130
|
-
end
|
131
76
|
end
|
132
77
|
end
|
133
78
|
end
|
@@ -9,10 +9,6 @@ module Transbank
|
|
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
|
-
INCREASE_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/amount').freeze
|
13
|
-
INCREASE_AUTHORIZATION_DATE_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/authorization_date').freeze
|
14
|
-
REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/reverse/amount').freeze
|
15
|
-
DEFERRED_CAPTURE_HISTORY_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/details').freeze
|
16
12
|
|
17
13
|
|
18
14
|
def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::WEBPAY_PLUS, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
|
@@ -73,54 +69,7 @@ module Transbank
|
|
73
69
|
@environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key
|
74
70
|
)
|
75
71
|
request_service.put(buy_order: buy_order, authorization_code: authorization_code, capture_amount: amount)
|
76
|
-
end
|
77
|
-
|
78
|
-
def increase_amount(token, buy_order, authorization_code, amount)
|
79
|
-
|
80
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
81
|
-
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
82
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
83
|
-
|
84
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
85
|
-
@environment, format(INCREASE_AMOUNT_ENDPOINT, token: token), @commerce_code, @api_key
|
86
|
-
)
|
87
|
-
request_service.put(commerce_code: @commerce_code, buy_order: buy_order, authorization_code: authorization_code, amount: amount)
|
88
|
-
end
|
89
|
-
|
90
|
-
def increase_authorization_date(token, buy_order, authorization_code)
|
91
|
-
|
92
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
93
|
-
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
94
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
95
|
-
|
96
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
97
|
-
@environment, format(INCREASE_AUTHORIZATION_DATE_ENDPOINT, token: token), @commerce_code, @api_key
|
98
|
-
)
|
99
|
-
request_service.put(commerce_code: @commerce_code, buy_order: buy_order, authorization_code: authorization_code)
|
100
72
|
end
|
101
|
-
|
102
|
-
def reverse_pre_authorized_amount(token, buy_order, authorization_code, amount)
|
103
|
-
|
104
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
105
|
-
Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
|
106
|
-
Transbank::Common::Validation.has_text_with_max_length(authorization_code, Transbank::Common::ApiConstants::AUTHORIZATION_CODE_LENGTH, "authorization_code")
|
107
|
-
|
108
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
109
|
-
@environment, format(REVERSE_PRE_AUTHORIZED_AMOUNT_ENDPOINT, token: token), @commerce_code, @api_key
|
110
|
-
)
|
111
|
-
request_service.put(commerce_code: @commerce_code, buy_order: buy_order, authorization_code: authorization_code, amount: amount)
|
112
|
-
end
|
113
|
-
|
114
|
-
def deferred_capture_history(token)
|
115
|
-
|
116
|
-
Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
|
117
|
-
|
118
|
-
request_service = ::Transbank::Shared::RequestService.new(
|
119
|
-
@environment, format(DEFERRED_CAPTURE_HISTORY_ENDPOINT, token: token), @commerce_code, @api_key
|
120
|
-
)
|
121
|
-
request_service.get
|
122
|
-
end
|
123
|
-
|
124
73
|
end
|
125
74
|
end
|
126
75
|
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: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Transbank Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -164,15 +164,12 @@ files:
|
|
164
164
|
- ".gitignore"
|
165
165
|
- ".rakeTasks"
|
166
166
|
- CHANGELOG.md
|
167
|
-
- Dockerfile
|
168
167
|
- Gemfile
|
169
168
|
- LICENSE.md
|
170
|
-
- Makefile
|
171
169
|
- README.md
|
172
170
|
- Rakefile
|
173
171
|
- bin/console
|
174
172
|
- bin/setup
|
175
|
-
- docker-compose.yml
|
176
173
|
- lib/transbank/sdk.rb
|
177
174
|
- lib/transbank/sdk/common/api_constants.rb
|
178
175
|
- lib/transbank/sdk/common/base_transaction.rb
|
@@ -191,7 +188,6 @@ files:
|
|
191
188
|
- lib/transbank/sdk/webpay/webpay_plus/mall_transaction.rb
|
192
189
|
- lib/transbank/sdk/webpay/webpay_plus/transaction.rb
|
193
190
|
- lib/transbank/sdk/webpay/webpay_plus_modal/transaction.rb
|
194
|
-
- sdk_test.sh
|
195
191
|
- transbank-sdk.gemspec
|
196
192
|
homepage: https://www.transbankdevelopers.cl/
|
197
193
|
licenses:
|
data/Dockerfile
DELETED
data/Makefile
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
SHELL := /bin/bash
|
2
|
-
|
3
|
-
all: build run
|
4
|
-
|
5
|
-
run: build
|
6
|
-
docker-compose run --rm web
|
7
|
-
|
8
|
-
build: .built .bundled
|
9
|
-
|
10
|
-
.built: Dockerfile
|
11
|
-
docker-compose build
|
12
|
-
touch .built
|
13
|
-
|
14
|
-
.bundled: Gemfile
|
15
|
-
docker-compose run web bundle install
|
16
|
-
touch .bundled
|
17
|
-
|
18
|
-
logs:
|
19
|
-
docker-compose logs
|
20
|
-
|
21
|
-
clean:
|
22
|
-
docker-compose rm
|
23
|
-
rm .built
|
24
|
-
rm .bundled
|
data/docker-compose.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
version: '2'
|
2
|
-
services:
|
3
|
-
web: &web
|
4
|
-
tty: true
|
5
|
-
stdin_open: true
|
6
|
-
build:
|
7
|
-
context: .
|
8
|
-
dockerfile: Dockerfile
|
9
|
-
command: rake test
|
10
|
-
volumes:
|
11
|
-
- .:/sdk
|
12
|
-
volumes_from:
|
13
|
-
- bundle_cache
|
14
|
-
ports:
|
15
|
-
- "8000:8000"
|
16
|
-
|
17
|
-
bundle_cache:
|
18
|
-
image: ruby:2.4-jessie # Should be the same as the app Dockerfile.dev base image
|
19
|
-
volumes:
|
20
|
-
- /usr/local/bundle
|
data/sdk_test.sh
DELETED