@@ -10,6 +10,10 @@ class MallTransaction < ::Transbank::Common::BaseTransaction
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 @@ def capture(token, commerce_code, buy_order, authorization_code, amount)
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
0 commit comments