nequi 0.2.5 → 0.2.6
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 +4 -4
- data/lib/nequi.rb +1 -1
- data/lib/nequi_status_check_job.rb +16 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91bc719ff78273f0ebcd98941b1dc4d70c068bb6f1474b6ea628739c05e848c0
|
4
|
+
data.tar.gz: 7838f1e6c3b1843a680ab92743ad056d084695ff22a4c53033190a385c6226c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c7c34585ef89632d8ad499675ad24aeb0c1149c7abfca9048e0e23c43b4a6e4cdeafbe79916bf569d3c47f1883347ae226c3f96c69be9258dd62225d31c0ae3
|
7
|
+
data.tar.gz: e50824fcc51c1618e269f5b455758d909c5f019518b9dbc5e89c987b2a61398ee878f10bfc6d1ebf1a3857135a73d04daa1a33d570f5daffd54b3433e02ca851
|
data/lib/nequi.rb
CHANGED
@@ -102,7 +102,7 @@ module Nequi
|
|
102
102
|
|
103
103
|
response_any = response["ResponseMessage"]["ResponseBody"]["any"]
|
104
104
|
success_id = response_any["unregisteredPaymentRS"]["transactionId"]
|
105
|
-
|
105
|
+
Nequi::StatusCheckJob.set(wait: 2.minutes).perform_later(product_id, configuration, access_token, success_id)
|
106
106
|
{ type: 'success', status: response.code, api_status: status_code, message: 'Payment request send success fully'}
|
107
107
|
end
|
108
108
|
end
|
@@ -8,8 +8,19 @@ module Nequi
|
|
8
8
|
require 'time'
|
9
9
|
require 'active_support/core_ext/integer/time'
|
10
10
|
|
11
|
+
MAX_RETRIES = 4
|
11
12
|
|
12
13
|
def perform
|
14
|
+
|
15
|
+
@attempts ||= 0
|
16
|
+
|
17
|
+
if @attempts >= MAX_RETRIES
|
18
|
+
logs = { type: 'error', message: 'Job stopped due to maximum retries exceeded.' }
|
19
|
+
Rails.logger.error(logs)
|
20
|
+
return
|
21
|
+
end
|
22
|
+
|
23
|
+
@attempts += 1
|
13
24
|
|
14
25
|
current_time = Time.now
|
15
26
|
utc_time = current_time.utc
|
@@ -55,13 +66,13 @@ module Nequi
|
|
55
66
|
status_code = response_status["StatusCode"]
|
56
67
|
status_description = response_status["StatusDesc"]
|
57
68
|
|
58
|
-
|
59
|
-
|
60
|
-
logs = { type: 'success', status: response.code, api_status: status_code, message: 'Payment request send success fully'}
|
61
|
-
|
69
|
+
if status_description == 'SUCCESS'
|
70
|
+
logs = { type: 'success', status: response.code, api_status: status_code, message: 'Payment request sent successfully' }
|
62
71
|
Rails.logger.info(logs)
|
63
72
|
else
|
64
|
-
|
73
|
+
StatusCheckJob.set(wait: 2.minutes).perform_later(product_id, configuration, token, success_id)
|
74
|
+
logs = { type: 'info', message: 'Retrying the job in 2 minutes...' }
|
75
|
+
Rails.logger.info(logs)
|
65
76
|
end
|
66
77
|
end
|
67
78
|
end
|