transbank-sdk 4.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,41 +0,0 @@
1
- module Transbank
2
- module Patpass
3
- module PatpassByWebpay
4
- class Transaction < ::Transbank::Common::BaseTransaction
5
- DEFAULT_ENVIRONMENT = :integration
6
- RESOURCES_URL = ::Transbank::Common::ApiConstants::WEBPAY_ENDPOINT
7
- CREATE_ENDPOINT = (RESOURCES_URL + '/transactions/').freeze
8
- COMMIT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
9
- STATUS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
10
-
11
- def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::PATPASS_BY_WEBPAY, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
12
- super
13
- end
14
-
15
- def create(buy_order, session_id, amount, return_url, details)
16
- request_service = ::Transbank::Shared::RequestService.new(
17
- @environment, CREATE_ENDPOINT, @commerce_code, @api_key
18
- )
19
- request_service.post({
20
- buy_order: buy_order, session_id: session_id, amount: amount, return_url: return_url, wpm_detail: details
21
- })
22
- end
23
-
24
- def commit(token)
25
- request_service = ::Transbank::Shared::RequestService.new(
26
- @environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key
27
- )
28
- request_service.put({})
29
- end
30
-
31
- def status(token)
32
- request_service = ::Transbank::Shared::RequestService.new(
33
- @environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key
34
- )
35
- request_service.get
36
- end
37
-
38
- end
39
- end
40
- end
41
- end
@@ -1,62 +0,0 @@
1
- module Transbank
2
- module Webpay
3
- module WebpayPlusModal
4
- class Transaction < ::Transbank::Common::BaseTransaction
5
- DEFAULT_ENVIRONMENT = :integration
6
- RESOURCES_URL = ::Transbank::Common::ApiConstants::WEBPAY_ENDPOINT
7
- CREATE_ENDPOINT = (RESOURCES_URL + '/transactions/').freeze
8
- COMMIT_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
9
- STATUS_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}').freeze
10
- REFUND_ENDPOINT = (RESOURCES_URL + '/transactions/%{token}/refunds').freeze
11
-
12
- def initialize(commerce_code = ::Transbank::Common::IntegrationCommerceCodes::WEBPAY_PLUS_MODAL, api_key = ::Transbank::Common::IntegrationApiKeys::WEBPAY, environment = DEFAULT_ENVIRONMENT)
13
- super(commerce_code, api_key, environment)
14
- end
15
-
16
- def create(buy_order, session_id, amount)
17
-
18
- Transbank::Common::Validation.has_text_with_max_length(buy_order, Transbank::Common::ApiConstants::BUY_ORDER_LENGTH, "buy_order")
19
- Transbank::Common::Validation.has_text_with_max_length(session_id, Transbank::Common::ApiConstants::SESSION_ID_LENGTH, "session_id")
20
-
21
- request_service = ::Transbank::Shared::RequestService.new(
22
- @environment, CREATE_ENDPOINT, @commerce_code, @api_key
23
- )
24
- request_service.post({
25
- buy_order: buy_order, session_id: session_id, amount: amount
26
- })
27
- end
28
-
29
- def commit(token)
30
-
31
- Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
32
-
33
- request_service = ::Transbank::Shared::RequestService.new(
34
- @environment, format(COMMIT_ENDPOINT, token: token), @commerce_code, @api_key
35
- )
36
- request_service.put({})
37
- end
38
-
39
- def status(token)
40
-
41
- Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
42
-
43
- request_service = ::Transbank::Shared::RequestService.new(
44
- @environment, format(STATUS_ENDPOINT, token: token), @commerce_code, @api_key
45
- )
46
- request_service.get
47
- end
48
-
49
- def refund(token, amount)
50
-
51
- Transbank::Common::Validation.has_text_with_max_length(token, Transbank::Common::ApiConstants::TOKEN_LENGTH, "token")
52
-
53
- request_service = ::Transbank::Shared::RequestService.new(
54
- @environment, format(REFUND_ENDPOINT, token: token), @commerce_code, @api_key
55
- )
56
- request_service.post(amount: amount)
57
- end
58
-
59
- end
60
- end
61
- end
62
- end