transbank-sdk 2.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 56eac9a908012993db2bccb09cd2cc322a9f84318c313171373b7b046564cadc
4
- data.tar.gz: acbb62c5c87deaa031ab1e017012cff3c50c5dece5e7dac7b050df8f27c0012a
2
+ SHA1:
3
+ metadata.gz: 8a59bcc8731edabd8b65c29379086457abeda4a5
4
+ data.tar.gz: 81f4a5421ea4633ada33442ab969a05db18bd5f8
5
5
  SHA512:
6
- metadata.gz: e489cdfb0eab2986d24b3db1db3e4b2d840315fef696e11ce480ff01a8ff76168cdeb54a73e8a18d97ab4ee451215a04482fd556ae4e0ed81b1a14fda09e464b
7
- data.tar.gz: 9fa48cd5073291902a310b8349393acc3322cb67e10809e9a6e723fa3f4d1a309dfa13da71755a0adc5f351945b734c0afaabb311a5c1186899d2b5258ad3857
6
+ metadata.gz: e1053b5266297a8b7641823aeee4bbac4867e7ffcf0f5ec5bb1471d64c1be343d23492b3a3ed1cefce1fcfcadccbf5920f215e0014c7d5ae5daa617bbba92f33
7
+ data.tar.gz: 846f79b2912f876228f70e3e360603cd31ff040e863b2fcc4b90f5cd6b7dfde9bb7508e88f588001fe134ea2a667a5cd441375616328cae161c3c954bdf20424
@@ -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/CHANGELOG.md CHANGED
@@ -1,11 +1,38 @@
1
1
  # Changelog
2
+
2
3
  Todos los cambios notables a este proyecto serán documentados en este archivo.
3
4
 
4
5
  El formato está basado en [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
6
  y este proyecto adhiere a [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
7
 
8
+ ## [3.0.2] - 2023-03-7
9
+
10
+ ### Fixed
11
+
12
+ - Se corrige el manejo de errores del método delete en Oneclick Mall
13
+
14
+ ## Added
15
+
16
+ - En caso de error se verifica si el response tiene body y en caso de no tenerlo se retorna el status
17
+
18
+ ## [3.0.0] - 2022-09-19
19
+
20
+ ### Fixed
21
+
22
+ - Se soluciona el método 'has_text_with_max_length' para que valide los atributos nulos
23
+
24
+ ### Changed
25
+
26
+ - Se migra el API desde la versión 1.2 a la versión 1.3
27
+
28
+ ### Added
29
+
30
+ - 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
31
+
7
32
  ## [2.0.1] - 2022-06-14
33
+
8
34
  ### Fixed
35
+
9
36
  - Se soluciona error en método refund para transacciones Webpay Plus Mall. Muchas gracias por tu aporte @danirod
10
37
 
11
38
  ## [2.0.0] - 2022-01-03
@@ -32,25 +59,34 @@ y este proyecto adhiere a [Semantic Versioning](http://semver.org/spec/v2.0.0.ht
32
59
  - Se agrega un módulo de constantes con las claves de comercio de integración: 'IntegrationApiKeys'
33
60
 
34
61
  ## [1.5.1] - 2021-04-12
62
+
35
63
  ### Added
64
+
36
65
  - Se agrega captura diferida en Transacción Completa y Transacción Completa Mall
37
66
 
38
67
  ## [1.4.1] - 2021-03-30
68
+
39
69
  ### Fixed
70
+
40
71
  - Se agrega parámetro de estado faltante en respuesta de Commit y Status en Webpay Plus
41
72
  - Se agrega dependencia JSON (~> 2.0) para evitar problemas al recibir respuesta de Commit
42
73
  - Se arregla endpoint de captura en Webpay Plus
43
74
 
44
75
  ## [1.4.0] - 2020-12-03
76
+
45
77
  ### Added
78
+
46
79
  - Se agregan métodos de configuración para integración a Webpay Plus en sus modalidades diferidas y mall diferida.
47
80
  - Se agregan métodos de configuración para integración a Webpay Oneclick en su modalidad mall diferida.
48
81
 
49
82
  ### Fixed
83
+
50
84
  - 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
51
85
 
52
86
  ## [1.3.1] - 2020-10-29
87
+
53
88
  ### Fixed
89
+
54
90
  - Se revierte commit que elimina requires necesarios para productos REST
55
91
 
56
92
  ## [1.3.0] - 2020-10-26
@@ -58,33 +94,43 @@ y este proyecto adhiere a [Semantic Versioning](http://semver.org/spec/v2.0.0.ht
58
94
  ### Added
59
95
 
60
96
  - Se agrega soporte para:
61
- - Webpay Plus Rest
62
- - modalidad normal
63
- - modalidad captura diferida
64
- - modalidad mall
65
- - modalidad mall captura diferida
66
- - Patpass by Webpay Rest
67
- - Patpass Comercio Rest
68
- - Transacción completa Rest
69
- - modalidad mall
70
- - Oneclick Mall Captura diferida
97
+ - Webpay Plus Rest
98
+ - modalidad normal
99
+ - modalidad captura diferida
100
+ - modalidad mall
101
+ - modalidad mall captura diferida
102
+ - Patpass by Webpay Rest
103
+ - Patpass Comercio Rest
104
+ - Transacción completa Rest
105
+ - modalidad mall
106
+ - Oneclick Mall Captura diferida
71
107
 
72
108
  ## [1.2.0] - 2019-12-26
109
+
73
110
  ### Added
111
+
74
112
  - Se agrega soporte para Oneclick Mall y Transacción Completa en sus versiones REST.
75
113
 
76
114
  ## [1.1.0] - 2018-04-08
115
+
77
116
  ### Added
117
+
78
118
  - 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.
79
119
 
80
120
  ## [1.0.2] - 2018-11-29
121
+
81
122
  ### Fixed
123
+
82
124
  - Corrige problema que evitaba poder utilizar un `CHANNEL` distinto a `WEB`
83
125
 
84
126
  ## [1.0.1] - 2018-10-24
127
+
85
128
  ### Fixed
129
+
86
130
  - Cambios para subir automáticamente la gema a RubyGems cuando se hace un nuevo release
87
131
 
88
132
  ## [1.0.0] - 2018-10-23
133
+
89
134
  ### Added
135
+
90
136
  - Primer lanzamiento del SDK
data/README.md CHANGED
@@ -82,4 +82,4 @@ En ese PR deben incluirse los siguientes cambios:
82
82
 
83
83
  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
84
 
85
- Con eso Travis CI generará automáticamente una nueva versión de la librería y la publicará en RubyGems.
85
+ 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.2'.freeze
5
- ONECLICK_ENDPOINT = 'rswebpaytransaction/api/oneclick/v1.2'.freeze
4
+ WEBPAY_ENDPOINT = 'rswebpaytransaction/api/webpay/v1.3'.freeze
5
+ ONECLICK_ENDPOINT = 'rswebpaytransaction/api/oneclick/v1.3'.freeze
6
6
  PATPASS_ENDPOINT = 'restpatpass/v1/services'.freeze
7
7
 
8
8
  BUY_ORDER_LENGTH = 26;
@@ -10,22 +10,29 @@ module Transbank
10
10
  WEBPAY_PLUS_MALL_CHILD1 = '597055555536'.freeze
11
11
  WEBPAY_PLUS_MALL_CHILD2 = '597055555537'.freeze
12
12
  WEBPAY_PLUS_MALL_CHILD_COMMERCE_CODES = [
13
- '597055555582'.freeze,
14
- '597055555583'.freeze
13
+ '597055555536'.freeze,
14
+ '597055555537'.freeze
15
15
  ].freeze
16
16
 
17
17
  WEBPAY_PLUS_MALL_DEFERRED = '597055555581'.freeze
18
18
  WEBPAY_PLUS_MALL_DEFERRED_CHILD1 = '597055555582'.freeze
19
19
  WEBPAY_PLUS_MALL_DEFERRED_CHILD2 = '597055555583'.freeze
20
- ONECLICK_MALL = '597055555541'.freeze
20
+ WEBPAY_PLUS_MALL_DEFERRED_CHILD_COMMERCE_CODES = [
21
+ '597055555582'.freeze,
22
+ '597055555583'.freeze
23
+ ].freeze
21
24
 
25
+ ONECLICK_MALL = '597055555541'.freeze
26
+ ONECLICK_MALL_CHILD1 = '597055555542'.freeze
27
+ ONECLICK_MALL_CHILD2 = '597055555543'.freeze
22
28
  ONECLICK_MALL_CHILD_COMMERCE_CODES = [
23
29
  '597055555542'.freeze,
24
30
  '597055555543'.freeze
25
31
  ].freeze
26
32
 
27
33
  ONECLICK_MALL_DEFERRED = '597055555547'.freeze
28
-
34
+ ONECLICK_MALL_DEFERRED_CHILD1 = '597055555548'.freeze
35
+ ONECLICK_MALL_DEFERRED_CHILD2 = '597055555549'.freeze
29
36
  ONECLICK_MALL_DEFERRED_CHILD_COMMERCE_CODES = [
30
37
  '597055555548'.freeze,
31
38
  '597055555549'.freeze
@@ -45,6 +52,8 @@ module Transbank
45
52
  ].freeze
46
53
 
47
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
48
57
  TRANSACCION_COMPLETA_MALL_SIN_CVV_CHILD = [
49
58
  '597055555552'.freeze,
50
59
  '597055555553'.freeze
@@ -61,6 +70,11 @@ module Transbank
61
70
  TRANSACCION_COMPLETA_MALL_DEFERRED_SIN_CVV = '597055555561'.freeze
62
71
  TRANSACCION_COMPLETA_MALL_DEFERRED_SIN_CVV_CHILD1 = '597055555562'.freeze
63
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
+
64
78
  PATPASS_COMERCIO = '28299257'.freeze
65
79
  PATPASS_BY_WEBPAY = "597055555550".freeze
66
80
  end
@@ -4,7 +4,7 @@ module Transbank
4
4
  class Validation
5
5
 
6
6
  def self.has_text_with_max_length(value, value_max_length, value_name)
7
- if value.empty?
7
+ if value.nil? || value.empty?
8
8
  raise Transbank::Shared::TransbankError, "Transbank Error: %s is empty" % [value_name]
9
9
  end
10
10
  if value.length() > value_max_length
@@ -46,16 +46,22 @@ module Transbank
46
46
  http_method = build_method(method, uri, body)
47
47
 
48
48
  response = http.request(http_method)
49
+
49
50
  if response.is_a? Net::HTTPSuccess
50
- return nil if response.body.empty?
51
+ return nil if response.body.nil? || response.body.empty?
51
52
  return JSON.parse(response.body)
52
53
  end
53
- body = JSON.parse(response.body)
54
- if body.key?("description")
55
- raise TransbankError, "Transbank Error: #{body['code']} - #{body['description']}"
56
- else
57
- raise TransbankError, "Transbank Error: #{body['error_message']}"
54
+
55
+ if !response.body.blank?
56
+ body = JSON.parse(response.body)
57
+ if body.key?("description")
58
+ raise TransbankError, "Transbank Error: #{body['code']} - #{body['description']}"
59
+ else
60
+ raise TransbankError, "Transbank Error: #{body['error_message']}"
61
+ end
58
62
  end
63
+
64
+ raise TransbankError, "Transbank Error: HTTP-STATUS #{response&.code}"
59
65
  end
60
66
 
61
67
  def build_client
@@ -1,5 +1,5 @@
1
1
  module Transbank
2
2
  module Sdk
3
- VERSION = '2.0.1'
3
+ VERSION = '3.0.2'
4
4
  end
5
5
  end
@@ -8,6 +8,10 @@ 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
11
15
 
12
16
  def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::ONECLICK_MALL, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
13
17
  super(commerce_code, api_key, environment)
@@ -59,7 +63,55 @@ module Transbank
59
63
  @environment, format(REFUND_ENDPOINT, token: buy_order), @commerce_code, @api_key
60
64
  )
61
65
  request_service.post(detail_buy_order: child_buy_order, commerce_code: child_commerce_code, amount: amount)
62
- end
66
+ 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
63
115
  end
64
116
  end
65
117
  end
@@ -10,6 +10,10 @@ 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
13
17
 
14
18
  def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::TRANSACCION_COMPLETA_MALL, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
15
19
  super(commerce_code, api_key, environment)
@@ -60,7 +64,58 @@ module Transbank
60
64
  @environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key
61
65
  )
62
66
  request_service.put(buy_order: buy_order, commerce_code: commerce_code, authorization_code: authorization_code, capture_amount: amount)
63
- end
67
+ 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
64
119
  end
65
120
  end
66
121
  end
@@ -10,6 +10,10 @@ 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
13
17
 
14
18
  def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::TRANSACCION_COMPLETA, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
15
19
  super
@@ -64,6 +68,52 @@ module Transbank
64
68
  )
65
69
  request_service.put(buy_order: buy_order, authorization_code: authorization_code, capture_amount: amount)
66
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
+ end
67
117
  end
68
118
  end
69
119
  end
@@ -9,6 +9,10 @@ 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
12
16
 
13
17
  def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::WEBPAY_PLUS_MALL, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
14
18
  super
@@ -72,7 +76,58 @@ module Transbank
72
76
  @environment, format(CAPTURE_ENDPOINT, token: token), @commerce_code, @api_key
73
77
  )
74
78
  request_service.put(commerce_code: child_commerce_code, buy_order: buy_order, authorization_code: authorization_code, capture_amount: capture_amount)
75
- end
79
+ 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
76
131
  end
77
132
  end
78
133
  end
@@ -9,6 +9,11 @@ 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
  def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::WEBPAY_PLUS, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
14
19
  super(commerce_code, api_key, environment)
@@ -69,6 +74,53 @@ module Transbank
69
74
  )
70
75
  request_service.put(buy_order: buy_order, authorization_code: authorization_code, capture_amount: amount)
71
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
+ 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
+
72
124
  end
73
125
  end
74
126
  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: 2.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Transbank Developers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2023-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -160,9 +160,9 @@ files:
160
160
  - ".built"
161
161
  - ".bundled"
162
162
  - ".github/ISSUE_TEMPLATE/reporte-de-error.md"
163
+ - ".github/workflows/publish-lib.yml"
163
164
  - ".gitignore"
164
165
  - ".rakeTasks"
165
- - ".travis.yml"
166
166
  - CHANGELOG.md
167
167
  - Dockerfile
168
168
  - Gemfile
@@ -212,7 +212,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  - !ruby/object:Gem::Version
213
213
  version: '0'
214
214
  requirements: []
215
- rubygems_version: 3.0.8
215
+ rubyforge_project:
216
+ rubygems_version: 2.6.14.4
216
217
  signing_key:
217
218
  specification_version: 4
218
219
  summary: Transbank SDK for Ruby
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- deploy:
2
- provider: rubygems
3
- api_key:
4
- secure: Y3z7qW8UhuDi0AqMr9T6ti46w3jLuLDRLuHUBTff80lYAZhBwCNj7U9UvlgELTiOC/nLREtboGW5ZUf3XIIiRr2oIqCSSWYVR6OCuPGTHS/hvGBi0T5jEL30/YuIEbIuz3xkXqN15WlOouKVgfPsNcL8mfLZBZMHQ9QwB6P0E2rg2GZj1QVqAUjnn/JGet0d2EJb48YyndN4nGVhaXXUQhcyyy1+XWEkC3nCo6v1dwE5pS8QK4kcRevRvL9G8mebxX74IuIbgW2bXBHPLNUbuUOHuNNUrrNIJDFUf8xXouLDT5QN4CsoldcgSIGuBvcJlmoubQFfju4iuGt/xnL8BtsKDy3iZ+xnIji6h7MGNAOpiZ7e2LavGvO5luYVEpuv2iG9V/FpJY5DJcBZ8779LnA97NAV7bz383tjihCfR9kzUh5rs2To42FV0IQj0btWuGesVmPefWjwV/EzjmbN0+PhNmxDwQAJS49cHycZKTeestaR4MgHigXZ2CGRAJSKYr3Tj7/r8KZW6MGY6KgXiwjpu+d3+UidAwI1viiRrCGuWBALkAAaxGR0H8qamMsJr/DQtjAgXDITRlAScpWzicgvEEHyXTos45EIrsJZV72O/jj8Zvbw83rEMv8It3yCS43deLsyw+5a4i9y9HFKuGQPa8w7yR1xEOnh6G3AiWY=
5
- gem: transbank-sdk
6
- on:
7
- tags: true
8
- repo: TransbankDevelopers/transbank-sdk-ruby
9
- rvm:
10
- - 2.4.1