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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 838d56c2cdf1b1dd5377e8fb45ef9207c840e5dcb708f904af44588949e9e99a
4
- data.tar.gz: a9e9711b3bc1af4e440a9e2721b7a59b5146dc631fbaa717e551bceb22dded8e
3
+ metadata.gz: 91bc719ff78273f0ebcd98941b1dc4d70c068bb6f1474b6ea628739c05e848c0
4
+ data.tar.gz: 7838f1e6c3b1843a680ab92743ad056d084695ff22a4c53033190a385c6226c3
5
5
  SHA512:
6
- metadata.gz: 7edc6f18b41c4ca258685bd7d9cdda5283b1ba07080ffafdbd4f246dbbddd0cf59faa5df007810b657b957902e22e89d573b85cc5dec166214b6869456d1bc5a
7
- data.tar.gz: a80bf80bc48a63c96e83da9697b243138b632f36630928663df201d2b250d677ea894915a2849aa0cc4695c60aa419ee340d387ec644a989597427888c9ed00f
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
- # Nequi::StatusCheckJob.set(wait: 2.minutes).perform_later(product_id, configuration, access_token, success_id)
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
- if status_description = response_status["StatusDesc"] == "SUCCESS"
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
- { type: 'success', status: response.code, api_status: status_code, message: ":wClient don't accept charge"}
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nequi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - geocodinglife