nequi 0.2.5 → 0.2.7
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 +10 -6
- metadata +2 -23
- data/lib/nequi_status_check_job.rb +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f30a9b6d8ab5828e13366b702e83530b20a68b0a9c40d3b8ed6a7e75ee9c042
|
4
|
+
data.tar.gz: 0ca6e203683b1cdd68c9cdd6b59c31e223c5ac57151a077c155f1fb05f2e8b34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a053e6817c8cd60b67fe3920d96d801e6330a543e126b5fe3badd76299d6daa52aa0613b476d0d1d59beeef64e158f1987a65754e3818cf09db7841bdb878b2
|
7
|
+
data.tar.gz: 42492b86efbdfcc54e98479d54442d8015474c949ab850e0dae8067071608914c628c7059696fd8e061e49341ebcaafe8fe79f1cd425e247dd2ef4a8dc8a949a
|
data/lib/nequi.rb
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
require_relative "nequi/version"
|
4
4
|
|
5
5
|
module Nequi
|
6
|
+
ERRORS_MESSAGES = {
|
7
|
+
"20-07A": "Nequi resive the payload but got an error from them."
|
8
|
+
}
|
9
|
+
|
6
10
|
class Error < StandardError; end
|
7
11
|
require 'httparty'
|
8
12
|
require 'base64'
|
@@ -91,18 +95,18 @@ module Nequi
|
|
91
95
|
|
92
96
|
response_status = response["ResponseMessage"]["ResponseHeader"]["Status"]
|
93
97
|
status_code = response_status["StatusCode"]
|
94
|
-
status_description =
|
98
|
+
status_description = response_status["StatusDesc"]
|
99
|
+
|
95
100
|
|
96
101
|
return {
|
97
102
|
type: 'Error',
|
98
103
|
status: status_code,
|
99
|
-
|
100
|
-
|
101
|
-
} unless response_status.include?({ "StatusCode"=>"0", "StatusDesc"=>"SUCCESS" })
|
104
|
+
message: ERRORS_MESSAGES[:"#{status_code}"] || "#{status_code} #{status_description}",
|
105
|
+
} unless response_status == { "StatusCode" => "0", "StatusDesc" => "SUCCESS" }
|
102
106
|
|
103
107
|
response_any = response["ResponseMessage"]["ResponseBody"]["any"]
|
104
108
|
success_id = response_any["unregisteredPaymentRS"]["transactionId"]
|
105
|
-
|
106
|
-
{ type: 'success', status: response.code, api_status: status_code, message: 'Payment request send success fully'}
|
109
|
+
|
110
|
+
{token: access_token, success_id: success_id, type: 'success', status: response.code, api_status: status_code, message: 'Payment request send success fully'}
|
107
111
|
end
|
108
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nequi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- geocodinglife
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -78,26 +78,6 @@ dependencies:
|
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: 3.18.1
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: sidekiq
|
83
|
-
requirement: !ruby/object:Gem::Requirement
|
84
|
-
requirements:
|
85
|
-
- - "~>"
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '7.1'
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 7.1.2
|
91
|
-
type: :runtime
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - "~>"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '7.1'
|
98
|
-
- - ">="
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: 7.1.2
|
101
81
|
description: Nequi gem provides a convenient way to integrate with Nequi payments
|
102
82
|
systems for processing payments and other related operations.
|
103
83
|
email:
|
@@ -108,7 +88,6 @@ extra_rdoc_files: []
|
|
108
88
|
files:
|
109
89
|
- lib/nequi.rb
|
110
90
|
- lib/nequi/version.rb
|
111
|
-
- lib/nequi_status_check_job.rb
|
112
91
|
homepage: https://github.com/geocodinglife/nequi
|
113
92
|
licenses:
|
114
93
|
- MIT
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# lib/nequi_status_check_job.rb
|
2
|
-
|
3
|
-
module Nequi
|
4
|
-
class StatusCheckJob < Struct.new(:product_id, :configuration, :token, :success_id)
|
5
|
-
require 'httparty'
|
6
|
-
require 'base64'
|
7
|
-
require 'json'
|
8
|
-
require 'time'
|
9
|
-
require 'active_support/core_ext/integer/time'
|
10
|
-
|
11
|
-
|
12
|
-
def perform
|
13
|
-
|
14
|
-
current_time = Time.now
|
15
|
-
utc_time = current_time.utc
|
16
|
-
formatted_timestamp = utc_time.strftime('%Y-%m-%dT%H:%M:%S.%LZ')
|
17
|
-
|
18
|
-
headers = {
|
19
|
-
'Content-Type' => 'application/json',
|
20
|
-
'Accept' => 'application/json',
|
21
|
-
'Authorization' => "Bearer #{token}",
|
22
|
-
'x-api-key' => configuration.api_key
|
23
|
-
}
|
24
|
-
|
25
|
-
body = {
|
26
|
-
"RequestMessage" => {
|
27
|
-
"RequestHeader" => {
|
28
|
-
"Channel" => "PNP04-C001",
|
29
|
-
"RequestDate" => formatted_timestamp,
|
30
|
-
"MessageID" => product_id,
|
31
|
-
"ClientID" => configuration.client_id,
|
32
|
-
"Destination" => {
|
33
|
-
"ServiceName" => "PaymentsService",
|
34
|
-
"ServiceOperation" => "getStatusPayment",
|
35
|
-
"ServiceRegion" => "C001",
|
36
|
-
"ServiceVersion" => "1.0.0"
|
37
|
-
}
|
38
|
-
},
|
39
|
-
"RequestBody" => {
|
40
|
-
"any" => {
|
41
|
-
"getStatusPaymentRQ" => {
|
42
|
-
"codeQR": success_id
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}.to_json
|
48
|
-
|
49
|
-
nequi_status_payment_url = configuration.api_base_path + configuration.nequi_status_payment
|
50
|
-
|
51
|
-
response = HTTParty.post(nequi_status_payment_url, body: body, headers: headers)
|
52
|
-
|
53
|
-
|
54
|
-
response_status = response["ResponseMessage"]["ResponseHeader"]["Status"]
|
55
|
-
status_code = response_status["StatusCode"]
|
56
|
-
status_description = response_status["StatusDesc"]
|
57
|
-
|
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
|
-
|
62
|
-
Rails.logger.info(logs)
|
63
|
-
else
|
64
|
-
{ type: 'success', status: response.code, api_status: status_code, message: ":wClient don't accept charge"}
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|