jamm 1.2.2 → 1.3.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/jamm/api/api/webhook_service_api.rb +59 -0
- data/lib/jamm/api/models/{v1_error.rb → apiv1_error.rb} +18 -9
- data/lib/jamm/api/models/v1_bank.rb +295 -0
- data/lib/jamm/api/models/v1_bank_assets.rb +231 -0
- data/lib/jamm/api/models/v1_bank_branch.rb +232 -0
- data/lib/jamm/api/models/v1_bank_quota.rb +243 -0
- data/lib/jamm/api/models/v1_bank_scheduled_maintenance_period.rb +227 -0
- data/lib/jamm/api/models/v1_charge_message.rb +1 -1
- data/lib/jamm/api/models/v1_error_detail.rb +220 -0
- data/lib/jamm/api/models/v1_error_response.rb +230 -0
- data/lib/jamm/api/models/v1_error_type.rb +58 -0
- data/lib/jamm/api/models/v1_get_bank_response.rb +207 -0
- data/lib/jamm/api/models/v1_get_branch_response.rb +207 -0
- data/lib/jamm/api/models/v1_get_branches_response.rb +208 -0
- data/lib/jamm/api/models/v1_get_major_banks_response.rb +217 -0
- data/lib/jamm/api/models/v1_search_banks_response.rb +208 -0
- data/lib/jamm/api/models/v1_search_branches_response.rb +208 -0
- data/lib/jamm/api.rb +15 -1
- data/lib/jamm/errors.rb +27 -1
- data/lib/jamm/version.rb +1 -1
- metadata +17 -3
data/lib/jamm/errors.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'jamm/api/models/v1_error_type'
|
4
|
+
|
3
5
|
module Jamm
|
4
6
|
class JammError < StandardError
|
5
7
|
attr_reader :message, :http_body, :http_headers, :http_status, :json_body
|
@@ -33,13 +35,28 @@ module Jamm
|
|
33
35
|
# - Jamm: code is string, message is string originating from Jamm's protobuf definition.
|
34
36
|
# - OpenAPI: code is integer, message is string originating from ConnectRPC error format.
|
35
37
|
class ApiError < StandardError
|
36
|
-
attr_reader :code, :error_code, :message, :headers, :body
|
38
|
+
attr_reader :code, :error_code, :error_type, :message, :headers, :body
|
37
39
|
|
38
40
|
# Add this class method to convert StandardError to ApiError
|
39
41
|
def self.from_error(e)
|
42
|
+
error_type = Api::ErrorType::UNSPECIFIED
|
43
|
+
|
44
|
+
# Convert Protobuf oriented error to error type.
|
45
|
+
details = JSON.parse(e.response_body)['details']
|
46
|
+
|
47
|
+
if details.is_a?(Array) && details.any?
|
48
|
+
details.each do |d|
|
49
|
+
# Loop through all error types to find a match
|
50
|
+
Api::ErrorType.all_vars.each do |type|
|
51
|
+
error_type = type.to_s if d['debug'] == type.to_s
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
40
56
|
new(
|
41
57
|
code: e.code,
|
42
58
|
message: e.message,
|
59
|
+
error_type: error_type,
|
43
60
|
response_headers: e.response_headers,
|
44
61
|
response_body: e.response_body
|
45
62
|
)
|
@@ -49,6 +66,7 @@ module Jamm
|
|
49
66
|
# Check code existence and convert to string if it's integer
|
50
67
|
@code = args[:code]
|
51
68
|
@message = args[:message]
|
69
|
+
@error_type = args[:error_type]
|
52
70
|
@headers = args[:response_headers]
|
53
71
|
|
54
72
|
raw_body = if args[:response_body].nil?
|
@@ -117,4 +135,12 @@ module Jamm
|
|
117
135
|
"#{status_string}#{@message}"
|
118
136
|
end
|
119
137
|
end
|
138
|
+
|
139
|
+
# ErrorType is a wrapper around Api::ErrorType to encapsulate OpenAPI related constants.
|
140
|
+
class ErrorType
|
141
|
+
# Dynamically copy constants from Api::ErrorType
|
142
|
+
Api::ErrorType.constants(false).each do |const_name|
|
143
|
+
const_set(const_name, Api::ErrorType.const_get(const_name))
|
144
|
+
end
|
145
|
+
end
|
120
146
|
end
|
data/lib/jamm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jamm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -67,13 +67,19 @@ files:
|
|
67
67
|
- lib/jamm/api/api_client.rb
|
68
68
|
- lib/jamm/api/api_error.rb
|
69
69
|
- lib/jamm/api/configuration.rb
|
70
|
+
- lib/jamm/api/models/apiv1_error.rb
|
70
71
|
- lib/jamm/api/models/apiv1_status.rb
|
71
72
|
- lib/jamm/api/models/customer_service_update_customer_body.rb
|
72
73
|
- lib/jamm/api/models/googlerpc_status.rb
|
73
74
|
- lib/jamm/api/models/protobuf_any.rb
|
74
75
|
- lib/jamm/api/models/v1_add_charge_request.rb
|
75
76
|
- lib/jamm/api/models/v1_add_charge_response.rb
|
77
|
+
- lib/jamm/api/models/v1_bank.rb
|
78
|
+
- lib/jamm/api/models/v1_bank_assets.rb
|
79
|
+
- lib/jamm/api/models/v1_bank_branch.rb
|
76
80
|
- lib/jamm/api/models/v1_bank_information.rb
|
81
|
+
- lib/jamm/api/models/v1_bank_quota.rb
|
82
|
+
- lib/jamm/api/models/v1_bank_scheduled_maintenance_period.rb
|
77
83
|
- lib/jamm/api/models/v1_buyer.rb
|
78
84
|
- lib/jamm/api/models/v1_charge.rb
|
79
85
|
- lib/jamm/api/models/v1_charge_message.rb
|
@@ -91,12 +97,18 @@ files:
|
|
91
97
|
- lib/jamm/api/models/v1_customer.rb
|
92
98
|
- lib/jamm/api/models/v1_delete_customer_response.rb
|
93
99
|
- lib/jamm/api/models/v1_deposit_type.rb
|
94
|
-
- lib/jamm/api/models/
|
100
|
+
- lib/jamm/api/models/v1_error_detail.rb
|
101
|
+
- lib/jamm/api/models/v1_error_response.rb
|
102
|
+
- lib/jamm/api/models/v1_error_type.rb
|
95
103
|
- lib/jamm/api/models/v1_event_type.rb
|
104
|
+
- lib/jamm/api/models/v1_get_bank_response.rb
|
105
|
+
- lib/jamm/api/models/v1_get_branch_response.rb
|
106
|
+
- lib/jamm/api/models/v1_get_branches_response.rb
|
96
107
|
- lib/jamm/api/models/v1_get_charge_response.rb
|
97
108
|
- lib/jamm/api/models/v1_get_charges_response.rb
|
98
109
|
- lib/jamm/api/models/v1_get_contract_response.rb
|
99
110
|
- lib/jamm/api/models/v1_get_customer_response.rb
|
111
|
+
- lib/jamm/api/models/v1_get_major_banks_response.rb
|
100
112
|
- lib/jamm/api/models/v1_initial_charge.rb
|
101
113
|
- lib/jamm/api/models/v1_kyc_status.rb
|
102
114
|
- lib/jamm/api/models/v1_merchant.rb
|
@@ -114,6 +126,8 @@ files:
|
|
114
126
|
- lib/jamm/api/models/v1_payment_authorization_status.rb
|
115
127
|
- lib/jamm/api/models/v1_payment_link.rb
|
116
128
|
- lib/jamm/api/models/v1_ping_response.rb
|
129
|
+
- lib/jamm/api/models/v1_search_banks_response.rb
|
130
|
+
- lib/jamm/api/models/v1_search_branches_response.rb
|
117
131
|
- lib/jamm/api/models/v1_update_customer_response.rb
|
118
132
|
- lib/jamm/api/models/v1_url.rb
|
119
133
|
- lib/jamm/api/models/v1_user_account_message.rb
|