tbk-sdk-ruby 4.0.0.pre.1
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 +7 -0
- data/.github/ISSUE_TEMPLATE/reporte-de-error.md +40 -0
- data/.github/workflows/publish-lib.yml +55 -0
- data/.gitignore +16 -0
- data/CHANGELOG.md +152 -0
- data/Gemfile +6 -0
- data/LICENSE.md +11 -0
- data/README.md +105 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/transbank/sdk/common/api_constants.rb +23 -0
- data/lib/transbank/sdk/common/base_transaction.rb +18 -0
- data/lib/transbank/sdk/common/integration_api_keys.rb +9 -0
- data/lib/transbank/sdk/common/integration_commerce_codes.rb +82 -0
- data/lib/transbank/sdk/common/validation.rb +19 -0
- data/lib/transbank/sdk/patpass/patpass_by_webpay/transaction.rb +41 -0
- data/lib/transbank/sdk/patpass/patpass_comercio/inscription.rb +56 -0
- data/lib/transbank/sdk/shared/request_service.rb +99 -0
- data/lib/transbank/sdk/shared/transbank_error.rb +5 -0
- data/lib/transbank/sdk/version.rb +5 -0
- data/lib/transbank/sdk/webpay/oneclick/mall_inscription.rb +52 -0
- data/lib/transbank/sdk/webpay/oneclick/mall_transaction.rb +66 -0
- data/lib/transbank/sdk/webpay/transaccion_completa/mall_transaction.rb +67 -0
- data/lib/transbank/sdk/webpay/transaccion_completa/transaction.rb +70 -0
- data/lib/transbank/sdk/webpay/webpay_plus/mall_transaction.rb +79 -0
- data/lib/transbank/sdk/webpay/webpay_plus/transaction.rb +76 -0
- data/lib/transbank/sdk/webpay/webpay_plus_modal/transaction.rb +62 -0
- data/lib/transbank/sdk.rb +27 -0
- data/transbank-sdk.gemspec +35 -0
- metadata +212 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4c928bb49ef9921f20875e3ae0926af97ccd1518dc70e739644e1da20ffdd404
|
|
4
|
+
data.tar.gz: 7dcb287cedc3ea72827e5d2a6c855ff1f966193dd8233b4da480e985c39679eb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 500b393b3f46329251ac70d42833d851b39c644997c6fcc7054a0126c1715c4699fae2d8d31837ed073c941ecf254b135f2bafa0a3edef8e5033f38372ba9d1f
|
|
7
|
+
data.tar.gz: 50d5807d91924d2a93b62b6e5bf4aa3037f2464e2ac24bd7ae883c94fc5a2927ea134cbea37a5fe8364612876b80a6b29105478755da8a27f05ea0f14114b0fb
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Reporte de Error
|
|
3
|
+
about: Crea un reporte para ayudarnos a mejorar
|
|
4
|
+
title: ''
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe el bug**
|
|
11
|
+
|
|
12
|
+
Una descripción concisa sobre el bug.
|
|
13
|
+
|
|
14
|
+
**Para reproducir**
|
|
15
|
+
|
|
16
|
+
1. Configura '...'
|
|
17
|
+
2. Crea un objeto '...'
|
|
18
|
+
3. Ejecuta el método '...'
|
|
19
|
+
4. Se ve el error en '...'
|
|
20
|
+
|
|
21
|
+
**Comportamiento observado**
|
|
22
|
+
|
|
23
|
+
Describe de forma concisa lo que observaste siguiendo los pasos para reproducir el error.
|
|
24
|
+
|
|
25
|
+
**Comportamiento esperado**
|
|
26
|
+
|
|
27
|
+
Una explicación concisa y clara de qué es lo que esperas que ocurra.
|
|
28
|
+
|
|
29
|
+
**Capturas de pantalla**
|
|
30
|
+
|
|
31
|
+
Si aplica, agrega aquí capturas de pantalla que ayuden a explicar tu problema.
|
|
32
|
+
|
|
33
|
+
**Versiones (por favor agrega aquí la siguiente información):**
|
|
34
|
+
- SDK: [e.g. 1.1.0]
|
|
35
|
+
- Ruby: [e.g. 2.5.2]
|
|
36
|
+
- Bundler: [e.g. 2.0.1]
|
|
37
|
+
|
|
38
|
+
**Contexto adicional**
|
|
39
|
+
|
|
40
|
+
Agrega cualquier otro información sobre el problema aquí.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
|
|
6
|
+
# GitHub recommends pinning actions to a commit SHA.
|
|
7
|
+
# To get a newer version, you will need to update the SHA.
|
|
8
|
+
# You can also reference a tag or branch, but the action may change without warning.
|
|
9
|
+
|
|
10
|
+
name: Publish Ruby Gem
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
push:
|
|
14
|
+
tags:
|
|
15
|
+
- '*'
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
name: Build + Publish
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
packages: write
|
|
23
|
+
contents: read
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v3
|
|
27
|
+
- name: Set up Ruby 2.4
|
|
28
|
+
uses: ruby/setup-ruby@v1
|
|
29
|
+
with:
|
|
30
|
+
ruby-version: 2.4
|
|
31
|
+
- run: |
|
|
32
|
+
bundle install
|
|
33
|
+
|
|
34
|
+
- name: Publish to GPR
|
|
35
|
+
run: |
|
|
36
|
+
mkdir -p $HOME/.gem
|
|
37
|
+
touch $HOME/.gem/credentials
|
|
38
|
+
chmod 0600 $HOME/.gem/credentials
|
|
39
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
40
|
+
gem build *.gemspec
|
|
41
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
|
42
|
+
env:
|
|
43
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
|
44
|
+
OWNER: ${{ github.repository_owner }}
|
|
45
|
+
|
|
46
|
+
- name: Publish to RubyGems
|
|
47
|
+
run: |
|
|
48
|
+
mkdir -p $HOME/.gem
|
|
49
|
+
touch $HOME/.gem/credentials
|
|
50
|
+
chmod 0600 $HOME/.gem/credentials
|
|
51
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
52
|
+
gem build *.gemspec
|
|
53
|
+
gem push *.gem
|
|
54
|
+
env:
|
|
55
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Todos los cambios notables a este proyecto serán documentados en este archivo.
|
|
4
|
+
|
|
5
|
+
El formato está basado en [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
y este proyecto adhiere a [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [4.0.0-1] - 2026-02-19
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Downgrade json for compatibility with older Rails versions
|
|
13
|
+
|
|
14
|
+
## [4.0.0] - 2024-03-20
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Downgrade del API de la versión 1.3 a la versión 1.2
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- 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
|
|
23
|
+
|
|
24
|
+
## [3.0.2] - 2023-03-7
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Se corrige el manejo de errores del método delete en Oneclick Mall
|
|
29
|
+
|
|
30
|
+
## Added
|
|
31
|
+
|
|
32
|
+
- En caso de error se verifica si el response tiene body y en caso de no tenerlo se retorna el status
|
|
33
|
+
|
|
34
|
+
## [3.0.0] - 2022-09-19
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- Se soluciona el método 'has_text_with_max_length' para que valide los atributos nulos
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Se migra el API desde la versión 1.2 a la versión 1.3
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- Se agrega los métodos 'increaseAmount', 'increaseAuthorizationDate', 'reversePreAuthorizedAmount', 'deferredCaptureHistory' a las versiones diferidas de WebpayPlus, WebpayPlus Mall, Oneclick Mall, Transaccion Completa y Transaccion Completa Mall
|
|
47
|
+
|
|
48
|
+
## [2.0.1] - 2022-06-14
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- Se soluciona error en método refund para transacciones Webpay Plus Mall. Muchas gracias por tu aporte @danirod
|
|
53
|
+
|
|
54
|
+
## [2.0.0] - 2022-01-03
|
|
55
|
+
|
|
56
|
+
### Removed
|
|
57
|
+
|
|
58
|
+
- Se elimina Onepay
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- Se agrega soporte a Webpay Modal
|
|
63
|
+
- Se migra el api desde la versión 1.0 a la versión 1.2
|
|
64
|
+
- Ahora el método de retorno al crear la transacción en WebPayPlus debe tener soporte GET (cuando es exitosa) y POST (cuando se retorna sin concluir el ingreso de la tarjeta)
|
|
65
|
+
- Ahora el método de retorno al inscribirse en Oneclick debe tener soporte GET (cuando es exitosa) y POST (cuando se retorna sin concluir la inscripción)
|
|
66
|
+
- Se refactoriza y migra todos los productos desde clases estáticas a clases instanciables
|
|
67
|
+
- Se unifica 'Transaction' y 'DeferredTransaction' en WebpayPlus
|
|
68
|
+
- Se unifica 'MallTransaction' y 'MallDeferredTransaction' en WebpayPlus y Oneclick
|
|
69
|
+
|
|
70
|
+
### Added
|
|
71
|
+
|
|
72
|
+
- Se agrega soporte a Webpay Modal
|
|
73
|
+
- Se agregan validaciones de obligatoriedad y tamaño de los parámetros a los métodos de WebpayPlus, Oneclick, Webpay Modal, Transacción Completa
|
|
74
|
+
- Se agrega un módulo de constantes con los códigos de comercio de integración: 'IntegrationCommerceCodes'
|
|
75
|
+
- Se agrega un módulo de constantes con las claves de comercio de integración: 'IntegrationApiKeys'
|
|
76
|
+
|
|
77
|
+
## [1.5.1] - 2021-04-12
|
|
78
|
+
|
|
79
|
+
### Added
|
|
80
|
+
|
|
81
|
+
- Se agrega captura diferida en Transacción Completa y Transacción Completa Mall
|
|
82
|
+
|
|
83
|
+
## [1.4.1] - 2021-03-30
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- Se agrega parámetro de estado faltante en respuesta de Commit y Status en Webpay Plus
|
|
88
|
+
- Se agrega dependencia JSON (~> 2.0) para evitar problemas al recibir respuesta de Commit
|
|
89
|
+
- Se arregla endpoint de captura en Webpay Plus
|
|
90
|
+
|
|
91
|
+
## [1.4.0] - 2020-12-03
|
|
92
|
+
|
|
93
|
+
### Added
|
|
94
|
+
|
|
95
|
+
- Se agregan métodos de configuración para integración a Webpay Plus en sus modalidades diferidas y mall diferida.
|
|
96
|
+
- Se agregan métodos de configuración para integración a Webpay Oneclick en su modalidad mall diferida.
|
|
97
|
+
|
|
98
|
+
### Fixed
|
|
99
|
+
|
|
100
|
+
- Se arregla forma en que se lee configuración del SDK, estaba tomando valores de una constante en vez de la variable de clase correspondiente. Este arreglo es para todos los productos con la excepción de Onepay
|
|
101
|
+
|
|
102
|
+
## [1.3.1] - 2020-10-29
|
|
103
|
+
|
|
104
|
+
### Fixed
|
|
105
|
+
|
|
106
|
+
- Se revierte commit que elimina requires necesarios para productos REST
|
|
107
|
+
|
|
108
|
+
## [1.3.0] - 2020-10-26
|
|
109
|
+
|
|
110
|
+
### Added
|
|
111
|
+
|
|
112
|
+
- Se agrega soporte para:
|
|
113
|
+
- Webpay Plus Rest
|
|
114
|
+
- modalidad normal
|
|
115
|
+
- modalidad captura diferida
|
|
116
|
+
- modalidad mall
|
|
117
|
+
- modalidad mall captura diferida
|
|
118
|
+
- Patpass by Webpay Rest
|
|
119
|
+
- Patpass Comercio Rest
|
|
120
|
+
- Transacción completa Rest
|
|
121
|
+
- modalidad mall
|
|
122
|
+
- Oneclick Mall Captura diferida
|
|
123
|
+
|
|
124
|
+
## [1.2.0] - 2019-12-26
|
|
125
|
+
|
|
126
|
+
### Added
|
|
127
|
+
|
|
128
|
+
- Se agrega soporte para Oneclick Mall y Transacción Completa en sus versiones REST.
|
|
129
|
+
|
|
130
|
+
## [1.1.0] - 2018-04-08
|
|
131
|
+
|
|
132
|
+
### Added
|
|
133
|
+
|
|
134
|
+
- Se agregaron los parámetros `qr_width_height` y `commerce_logo_url` a Options, para definir el tamaño del QR generado para la transacción, y especificar la ubicación del logo de comercio para ser mostrado en la aplicación móvil de Onepay. Puedes configurar estos parámetros globalmente o por transacción.
|
|
135
|
+
|
|
136
|
+
## [1.0.2] - 2018-11-29
|
|
137
|
+
|
|
138
|
+
### Fixed
|
|
139
|
+
|
|
140
|
+
- Corrige problema que evitaba poder utilizar un `CHANNEL` distinto a `WEB`
|
|
141
|
+
|
|
142
|
+
## [1.0.1] - 2018-10-24
|
|
143
|
+
|
|
144
|
+
### Fixed
|
|
145
|
+
|
|
146
|
+
- Cambios para subir automáticamente la gema a RubyGems cuando se hace un nuevo release
|
|
147
|
+
|
|
148
|
+
## [1.0.0] - 2018-10-23
|
|
149
|
+
|
|
150
|
+
### Added
|
|
151
|
+
|
|
152
|
+
- Primer lanzamiento del SDK
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2018 Transbank
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Transbank SDK Ruby
|
|
2
|
+
|
|
3
|
+
SDK Oficial de Transbank
|
|
4
|
+
|
|
5
|
+
## Requisitos:
|
|
6
|
+
|
|
7
|
+
- Ruby 2.4+
|
|
8
|
+
|
|
9
|
+
# Instalación
|
|
10
|
+
|
|
11
|
+
Puedes instalar el SDK directamente
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
gem install transbank-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
o añadirlo a tu `Gemfile`
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
gem 'transbank-sdk'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
y luego ejecutar
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bundle install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Documentación
|
|
30
|
+
|
|
31
|
+
Puedes encontrar toda la documentación de cómo usar este SDK en el sitio https://www.transbankdevelopers.cl.
|
|
32
|
+
|
|
33
|
+
La documentación relevante para usar este SDK es:
|
|
34
|
+
|
|
35
|
+
- Documentación sobre [ambientes, deberes del comercio, puesta en producción,
|
|
36
|
+
etc](https://www.transbankdevelopers.cl/documentacion/como_empezar#ambientes).
|
|
37
|
+
|
|
38
|
+
## Información para contribuir y desarrollar este SDK
|
|
39
|
+
|
|
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.
|
|
63
|
+
|
|
64
|
+
### Standares
|
|
65
|
+
|
|
66
|
+
- Para los commits respetamos las siguientes normas: https://chris.beams.io/posts/git-commit/
|
|
67
|
+
- Usamos ingles, para los mensajes de commit.
|
|
68
|
+
- Se pueden usar tokens como WIP, en el subject de un commit, separando el token con `:`, por ejemplo:
|
|
69
|
+
`WIP: This is a useful commit message`
|
|
70
|
+
- Para los nombres de ramas también usamos ingles.
|
|
71
|
+
- Se asume, que una rama de feature no mezclada, es un feature no terminado.
|
|
72
|
+
- El nombre de las ramas va en minúsculas.
|
|
73
|
+
- Las palabras se separan con `-`.
|
|
74
|
+
- Las ramas comienzan con alguno de los short lead tokens definidos, por ejemplo: `feat/tokens-configuration`
|
|
75
|
+
|
|
76
|
+
### **Reglas** 📖
|
|
77
|
+
|
|
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.
|
|
81
|
+
|
|
82
|
+
### **Pull Request**
|
|
83
|
+
|
|
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.
|
|
93
|
+
|
|
94
|
+
### Deploy de una nueva versión.
|
|
95
|
+
|
|
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).
|
|
97
|
+
|
|
98
|
+
En ese PR deben incluirse los siguientes cambios:
|
|
99
|
+
|
|
100
|
+
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**.
|
|
101
|
+
2. Modificar [version.rb](./lib/transbank/sdk/version.rb) para poner la nueva versión que corresponde.
|
|
102
|
+
|
|
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.
|
|
104
|
+
|
|
105
|
+
Con eso Github Actions generará automáticamente una nueva versión de la librería y la publicará en RubyGems.
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "transbank/sdk"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Common
|
|
3
|
+
module ApiConstants
|
|
4
|
+
WEBPAY_ENDPOINT = 'rswebpaytransaction/api/webpay/v1.2'.freeze
|
|
5
|
+
ONECLICK_ENDPOINT = 'rswebpaytransaction/api/oneclick/v1.2'.freeze
|
|
6
|
+
PATPASS_ENDPOINT = 'restpatpass/v1/services'.freeze
|
|
7
|
+
|
|
8
|
+
BUY_ORDER_LENGTH = 26;
|
|
9
|
+
SESSION_ID_LENGTH = 61;
|
|
10
|
+
RETURN_URL_LENGTH = 255;
|
|
11
|
+
AUTHORIZATION_CODE_LENGTH = 6;
|
|
12
|
+
CARD_EXPIRATION_DATE_LENGTH = 5;
|
|
13
|
+
CARD_NUMBER_LENGTH = 19;
|
|
14
|
+
TBK_USER_LENGTH = 40;
|
|
15
|
+
USER_NAME_LENGTH = 40;
|
|
16
|
+
COMMERCE_CODE_LENGTH = 12;
|
|
17
|
+
TOKEN_LENGTH = 64;
|
|
18
|
+
EMAIL_LENGTH = 100;
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Transbank
|
|
2
|
+
module Common
|
|
3
|
+
class BaseTransaction
|
|
4
|
+
|
|
5
|
+
def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::WEBPAY_PLUS, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
|
|
6
|
+
@commerce_code = commerce_code
|
|
7
|
+
@api_key = api_key
|
|
8
|
+
unless %i[production integration].include?(environment)
|
|
9
|
+
raise ArgumentError, "Environment must be either 'integration' or 'production'"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
@environment = environment
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Contains the Webpay, Oneclick and Patpass Comercio constants for testing.
|
|
2
|
+
module Transbank
|
|
3
|
+
module Common
|
|
4
|
+
module IntegrationApiKeys
|
|
5
|
+
WEBPAY = '579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C'.freeze
|
|
6
|
+
PATPASS_COMERCIO = 'cxxXQgGD9vrVe4M41FIt'.freeze
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Contains the Webpay, Oneclick and Patpass Comercio constants for testing.
|
|
2
|
+
module Transbank
|
|
3
|
+
module Common
|
|
4
|
+
module IntegrationCommerceCodes
|
|
5
|
+
WEBPAY_PLUS = '597055555532'.freeze
|
|
6
|
+
WEBPAY_PLUS_MODAL = '597055555584'.freeze
|
|
7
|
+
WEBPAY_PLUS_DEFERRED = '597055555540'.freeze
|
|
8
|
+
|
|
9
|
+
WEBPAY_PLUS_MALL = '597055555535'.freeze
|
|
10
|
+
WEBPAY_PLUS_MALL_CHILD1 = '597055555536'.freeze
|
|
11
|
+
WEBPAY_PLUS_MALL_CHILD2 = '597055555537'.freeze
|
|
12
|
+
WEBPAY_PLUS_MALL_CHILD_COMMERCE_CODES = [
|
|
13
|
+
'597055555536'.freeze,
|
|
14
|
+
'597055555537'.freeze
|
|
15
|
+
].freeze
|
|
16
|
+
|
|
17
|
+
WEBPAY_PLUS_MALL_DEFERRED = '597055555581'.freeze
|
|
18
|
+
WEBPAY_PLUS_MALL_DEFERRED_CHILD1 = '597055555582'.freeze
|
|
19
|
+
WEBPAY_PLUS_MALL_DEFERRED_CHILD2 = '597055555583'.freeze
|
|
20
|
+
WEBPAY_PLUS_MALL_DEFERRED_CHILD_COMMERCE_CODES = [
|
|
21
|
+
'597055555582'.freeze,
|
|
22
|
+
'597055555583'.freeze
|
|
23
|
+
].freeze
|
|
24
|
+
|
|
25
|
+
ONECLICK_MALL = '597055555541'.freeze
|
|
26
|
+
ONECLICK_MALL_CHILD1 = '597055555542'.freeze
|
|
27
|
+
ONECLICK_MALL_CHILD2 = '597055555543'.freeze
|
|
28
|
+
ONECLICK_MALL_CHILD_COMMERCE_CODES = [
|
|
29
|
+
'597055555542'.freeze,
|
|
30
|
+
'597055555543'.freeze
|
|
31
|
+
].freeze
|
|
32
|
+
|
|
33
|
+
ONECLICK_MALL_DEFERRED = '597055555547'.freeze
|
|
34
|
+
ONECLICK_MALL_DEFERRED_CHILD1 = '597055555548'.freeze
|
|
35
|
+
ONECLICK_MALL_DEFERRED_CHILD2 = '597055555549'.freeze
|
|
36
|
+
ONECLICK_MALL_DEFERRED_CHILD_COMMERCE_CODES = [
|
|
37
|
+
'597055555548'.freeze,
|
|
38
|
+
'597055555549'.freeze
|
|
39
|
+
].freeze
|
|
40
|
+
|
|
41
|
+
TRANSACCION_COMPLETA = '597055555530'.freeze
|
|
42
|
+
TRANSACCION_COMPLETA_SIN_CVV = '597055555557'.freeze
|
|
43
|
+
TRANSACCION_COMPLETA_DEFERRED = '597055555531'.freeze
|
|
44
|
+
TRANSACCION_COMPLETA_DEFERRED_SIN_CVV = '597055555556'.freeze
|
|
45
|
+
|
|
46
|
+
TRANSACCION_COMPLETA_MALL = '597055555573'.freeze
|
|
47
|
+
TRANSACCION_COMPLETA_MALL_CHILD1 = '597055555574'.freeze
|
|
48
|
+
TRANSACCION_COMPLETA_MALL_CHILD2 = '597055555575'.freeze
|
|
49
|
+
TRANSACCION_COMPLETA_MALL_CHILD = [
|
|
50
|
+
'597055555574'.freeze,
|
|
51
|
+
'597055555575'.freeze
|
|
52
|
+
].freeze
|
|
53
|
+
|
|
54
|
+
TRANSACCION_COMPLETA_MALL_SIN_CVV = '597055555551'.freeze
|
|
55
|
+
TRANSACCION_COMPLETA_MALL_SIN_CVV_CHILD1 = '597055555552'.freeze
|
|
56
|
+
TRANSACCION_COMPLETA_MALL_SIN_CVV_CHILD2 = '597055555553'.freeze
|
|
57
|
+
TRANSACCION_COMPLETA_MALL_SIN_CVV_CHILD = [
|
|
58
|
+
'597055555552'.freeze,
|
|
59
|
+
'597055555553'.freeze
|
|
60
|
+
].freeze
|
|
61
|
+
|
|
62
|
+
TRANSACCION_COMPLETA_MALL_DEFERRED = '597055555576'.freeze
|
|
63
|
+
TRANSACCION_COMPLETA_MALL_DEFERRED_CHILD1 = '597055555577'.freeze
|
|
64
|
+
TRANSACCION_COMPLETA_MALL_DEFERRED_CHILD2 = '597055555578'.freeze
|
|
65
|
+
TRANSACCION_COMPLETA_MALL_DEFERRED_CHILD = [
|
|
66
|
+
'597055555577'.freeze,
|
|
67
|
+
'597055555578'.freeze
|
|
68
|
+
].freeze
|
|
69
|
+
|
|
70
|
+
TRANSACCION_COMPLETA_MALL_DEFERRED_SIN_CVV = '597055555561'.freeze
|
|
71
|
+
TRANSACCION_COMPLETA_MALL_DEFERRED_SIN_CVV_CHILD1 = '597055555562'.freeze
|
|
72
|
+
TRANSACCION_COMPLETA_MALL_DEFERRED_SIN_CVV_CHILD2 = '597055555563'.freeze
|
|
73
|
+
TRANSACCION_COMPLETA_MALL_DEFERRED_SIN_CVV_CHILD = [
|
|
74
|
+
'597055555562'.freeze,
|
|
75
|
+
'597055555563'.freeze
|
|
76
|
+
].freeze
|
|
77
|
+
|
|
78
|
+
PATPASS_COMERCIO = '28299257'.freeze
|
|
79
|
+
PATPASS_BY_WEBPAY = "597055555550".freeze
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
module Transbank
|
|
3
|
+
module Common
|
|
4
|
+
class Validation
|
|
5
|
+
|
|
6
|
+
def self.has_text_with_max_length(value, value_max_length, value_name)
|
|
7
|
+
if value.nil? || value.empty?
|
|
8
|
+
raise Transbank::Shared::TransbankError, "Transbank Error: %s is empty" % [value_name]
|
|
9
|
+
end
|
|
10
|
+
if value.length() > value_max_length
|
|
11
|
+
raise Transbank::Shared::TransbankError, "%s is too long, the maximum length is %s"% [value_name, value_max_length]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|