jamm 1.2.2 → 1.4.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/customer_api.rb +82 -52
- data/lib/jamm/api/api/healthcheck_api.rb +18 -15
- data/lib/jamm/api/api/payment_api.rb +113 -62
- data/lib/jamm/api/api/webhook_service_api.rb +91 -19
- data/lib/jamm/api/api_client.rb +74 -66
- data/lib/jamm/api/api_error.rb +16 -16
- data/lib/jamm/api/configuration.rb +42 -34
- data/lib/jamm/api/models/apiv1_error.rb +238 -0
- data/lib/jamm/api/models/apiv1_status.rb +57 -47
- data/lib/jamm/api/models/customer_service_update_customer_body.rb +107 -69
- data/lib/jamm/api/models/googlerpc_status.rb +61 -45
- data/lib/jamm/api/models/protobuf_any.rb +42 -35
- data/lib/jamm/api/models/v1_add_charge_request.rb +59 -44
- data/lib/jamm/api/models/v1_add_charge_response.rb +59 -44
- data/lib/jamm/api/models/v1_bank.rb +350 -0
- data/lib/jamm/api/models/v1_bank_assets.rb +244 -0
- data/lib/jamm/api/models/v1_bank_branch.rb +259 -0
- data/lib/jamm/api/models/v1_bank_information.rb +71 -51
- data/lib/jamm/api/models/v1_bank_quota.rb +278 -0
- data/lib/jamm/api/models/v1_bank_scheduled_maintenance_period.rb +250 -0
- data/lib/jamm/api/models/v1_buyer.rb +104 -76
- data/lib/jamm/api/models/v1_charge.rb +67 -52
- data/lib/jamm/api/models/v1_charge_message.rb +151 -93
- data/lib/jamm/api/models/v1_charge_message_status.rb +17 -18
- data/lib/jamm/api/models/v1_charge_result.rb +152 -93
- data/lib/jamm/api/models/v1_contract.rb +64 -52
- data/lib/jamm/api/models/v1_contract_message.rb +67 -48
- data/lib/jamm/api/models/v1_contract_status.rb +20 -21
- data/lib/jamm/api/models/v1_create_contract_with_charge_request.rb +59 -44
- data/lib/jamm/api/models/v1_create_contract_with_charge_response.rb +67 -48
- data/lib/jamm/api/models/v1_create_contract_without_charge_request.rb +51 -40
- data/lib/jamm/api/models/v1_create_contract_without_charge_response.rb +59 -44
- data/lib/jamm/api/models/v1_create_customer_request.rb +42 -35
- data/lib/jamm/api/models/v1_create_customer_response.rb +42 -35
- data/lib/jamm/api/models/v1_customer.rb +91 -60
- data/lib/jamm/api/models/v1_delete_customer_response.rb +42 -35
- data/lib/jamm/api/models/v1_deposit_type.rb +14 -15
- data/lib/jamm/api/models/v1_error_detail.rb +233 -0
- data/lib/jamm/api/models/v1_error_response.rb +238 -0
- data/lib/jamm/api/models/v1_error_type.rb +57 -0
- data/lib/jamm/api/models/v1_event_type.rb +20 -21
- data/lib/jamm/api/models/{v1_error.rb → v1_get_bank_response.rb} +45 -48
- data/lib/jamm/api/models/v1_get_branch_response.rb +214 -0
- data/lib/jamm/api/models/v1_get_branches_response.rb +216 -0
- data/lib/jamm/api/models/v1_get_charge_response.rb +51 -40
- data/lib/jamm/api/models/v1_get_charges_response.rb +60 -45
- data/lib/jamm/api/models/v1_get_contract_response.rb +51 -40
- data/lib/jamm/api/models/v1_get_customer_response.rb +42 -35
- data/lib/jamm/api/models/v1_get_major_banks_response.rb +232 -0
- data/lib/jamm/api/models/v1_initial_charge.rb +61 -48
- data/lib/jamm/api/models/v1_kyc_status.rb +16 -17
- data/lib/jamm/api/models/v1_merchant.rb +51 -40
- data/lib/jamm/api/models/v1_merchant_customer.rb +51 -40
- data/lib/jamm/api/models/v1_merchant_webhook_message.rb +75 -57
- data/lib/jamm/api/models/v1_message_response.rb +67 -48
- data/lib/jamm/api/models/v1_off_session_payment_request.rb +51 -40
- data/lib/jamm/api/models/v1_off_session_payment_response.rb +51 -40
- data/lib/jamm/api/models/v1_on_session_payment_data.rb +67 -48
- data/lib/jamm/api/models/v1_on_session_payment_error.rb +55 -45
- data/lib/jamm/api/models/v1_on_session_payment_error_code.rb +21 -22
- data/lib/jamm/api/models/v1_on_session_payment_request.rb +67 -48
- data/lib/jamm/api/models/v1_on_session_payment_response.rb +59 -44
- data/lib/jamm/api/models/v1_pagination.rb +51 -40
- data/lib/jamm/api/models/v1_payment_authorization_status.rb +14 -15
- data/lib/jamm/api/models/v1_payment_link.rb +57 -44
- data/lib/jamm/api/models/v1_ping_response.rb +42 -35
- data/lib/jamm/api/models/v1_search_banks_response.rb +216 -0
- data/lib/jamm/api/models/v1_search_branches_response.rb +216 -0
- data/lib/jamm/api/models/v1_update_customer_response.rb +42 -35
- data/lib/jamm/api/models/v1_url.rb +48 -39
- data/lib/jamm/api/models/v1_user_account_message.rb +67 -48
- data/lib/jamm/api/models/v1_withdraw_request.rb +51 -40
- data/lib/jamm/api/models/v1_withdraw_response.rb +51 -40
- data/lib/jamm/api/version.rb +11 -11
- data/lib/jamm/api.rb +25 -11
- data/lib/jamm/charge.rb +12 -0
- data/lib/jamm/deprecation.rb +13 -0
- data/lib/jamm/errors.rb +27 -1
- data/lib/jamm/payment.rb +61 -0
- data/lib/jamm/version.rb +1 -1
- data/lib/jamm.rb +2 -0
- metadata +19 -3
@@ -1,14 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
=begin
|
2
|
+
#Jamm API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
14
|
require 'time'
|
@@ -16,13 +16,15 @@ require 'time'
|
|
16
16
|
module Api
|
17
17
|
# This message represents the response after processing a WithdrawRequest. It contains information about the customer and the charge.
|
18
18
|
class WithdrawResponse
|
19
|
-
attr_accessor :customer
|
19
|
+
attr_accessor :customer
|
20
|
+
|
21
|
+
attr_accessor :charge
|
20
22
|
|
21
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
24
|
def self.attribute_map
|
23
25
|
{
|
24
|
-
:customer => :customer,
|
25
|
-
:charge => :charge
|
26
|
+
:'customer' => :'customer',
|
27
|
+
:'charge' => :'charge'
|
26
28
|
}
|
27
29
|
end
|
28
30
|
|
@@ -34,40 +36,47 @@ module Api
|
|
34
36
|
# Attribute type mapping.
|
35
37
|
def self.openapi_types
|
36
38
|
{
|
37
|
-
:customer => :Customer,
|
38
|
-
:charge => :ChargeResult
|
39
|
+
:'customer' => :'Customer',
|
40
|
+
:'charge' => :'ChargeResult'
|
39
41
|
}
|
40
42
|
end
|
41
43
|
|
42
44
|
# List of attributes with nullable: true
|
43
45
|
def self.openapi_nullable
|
44
|
-
Set.new([
|
46
|
+
Set.new([
|
47
|
+
])
|
45
48
|
end
|
46
49
|
|
47
50
|
# Initializes the object
|
48
51
|
# @param [Hash] attributes Model attributes in the form of hash
|
49
52
|
def initialize(attributes = {})
|
50
|
-
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Api::WithdrawResponse` initialize method"
|
55
|
+
end
|
51
56
|
|
52
57
|
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
-
attributes = attributes.each_with_object({})
|
54
|
-
|
55
|
-
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Api::WithdrawResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
56
62
|
h[k.to_sym] = v
|
57
|
-
|
58
|
-
|
59
|
-
self.customer = attributes[:customer] if attributes.key?(:customer)
|
63
|
+
}
|
60
64
|
|
61
|
-
|
65
|
+
if attributes.key?(:'customer')
|
66
|
+
self.customer = attributes[:'customer']
|
67
|
+
end
|
62
68
|
|
63
|
-
|
69
|
+
if attributes.key?(:'charge')
|
70
|
+
self.charge = attributes[:'charge']
|
71
|
+
end
|
64
72
|
end
|
65
73
|
|
66
74
|
# Show invalid properties with the reasons. Usually used together with valid?
|
67
75
|
# @return Array for valid properties with the reasons
|
68
76
|
def list_invalid_properties
|
69
77
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
70
|
-
|
78
|
+
invalid_properties = Array.new
|
79
|
+
invalid_properties
|
71
80
|
end
|
72
81
|
|
73
82
|
# Check to see if the all the properties in the model are valid
|
@@ -79,18 +88,17 @@ module Api
|
|
79
88
|
|
80
89
|
# Checks equality by comparing each attribute.
|
81
90
|
# @param [Object] Object to be compared
|
82
|
-
def ==(
|
83
|
-
return true if equal?(
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
charge == other.charge
|
91
|
+
def ==(o)
|
92
|
+
return true if self.equal?(o)
|
93
|
+
self.class == o.class &&
|
94
|
+
customer == o.customer &&
|
95
|
+
charge == o.charge
|
88
96
|
end
|
89
97
|
|
90
98
|
# @see the `==` method
|
91
99
|
# @param [Object] Object to be compared
|
92
|
-
def eql?(
|
93
|
-
self ==
|
100
|
+
def eql?(o)
|
101
|
+
self == o
|
94
102
|
end
|
95
103
|
|
96
104
|
# Calculates hash code according to all attributes.
|
@@ -104,18 +112,19 @@ module Api
|
|
104
112
|
# @return [Object] Returns the model itself
|
105
113
|
def self.build_from_hash(attributes)
|
106
114
|
return nil unless attributes.is_a?(Hash)
|
107
|
-
|
108
115
|
attributes = attributes.transform_keys(&:to_sym)
|
109
116
|
transformed_hash = {}
|
110
117
|
openapi_types.each_pair do |key, type|
|
111
118
|
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
112
|
-
transformed_hash[key
|
119
|
+
transformed_hash["#{key}"] = nil
|
113
120
|
elsif type =~ /\AArray<(.*)>/i
|
114
121
|
# check to ensure the input is an array given that the attribute
|
115
122
|
# is documented as an array but the input is not
|
116
|
-
|
123
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
124
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
125
|
+
end
|
117
126
|
elsif !attributes[attribute_map[key]].nil?
|
118
|
-
transformed_hash[key
|
127
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
119
128
|
end
|
120
129
|
end
|
121
130
|
new(transformed_hash)
|
@@ -181,7 +190,7 @@ module Api
|
|
181
190
|
def to_hash
|
182
191
|
hash = {}
|
183
192
|
self.class.attribute_map.each_pair do |attr, param|
|
184
|
-
value = send(attr)
|
193
|
+
value = self.send(attr)
|
185
194
|
if value.nil?
|
186
195
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
187
196
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
@@ -209,5 +218,7 @@ module Api
|
|
209
218
|
value
|
210
219
|
end
|
211
220
|
end
|
221
|
+
|
212
222
|
end
|
223
|
+
|
213
224
|
end
|
data/lib/jamm/api/version.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
=begin
|
2
|
+
#Jamm API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
12
|
|
13
13
|
module Api
|
14
14
|
VERSION = '1.0.0'
|
data/lib/jamm/api.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
|
1
|
+
=begin
|
2
|
+
#Jamm API
|
2
3
|
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
#
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
12
|
|
13
13
|
# Common files
|
14
14
|
require 'jamm/api/api_client'
|
@@ -17,13 +17,19 @@ require 'jamm/api/version'
|
|
17
17
|
require 'jamm/api/configuration'
|
18
18
|
|
19
19
|
# Models
|
20
|
+
require 'jamm/api/models/apiv1_error'
|
20
21
|
require 'jamm/api/models/apiv1_status'
|
21
22
|
require 'jamm/api/models/customer_service_update_customer_body'
|
22
23
|
require 'jamm/api/models/googlerpc_status'
|
23
24
|
require 'jamm/api/models/protobuf_any'
|
24
25
|
require 'jamm/api/models/v1_add_charge_request'
|
25
26
|
require 'jamm/api/models/v1_add_charge_response'
|
27
|
+
require 'jamm/api/models/v1_bank'
|
28
|
+
require 'jamm/api/models/v1_bank_assets'
|
29
|
+
require 'jamm/api/models/v1_bank_branch'
|
26
30
|
require 'jamm/api/models/v1_bank_information'
|
31
|
+
require 'jamm/api/models/v1_bank_quota'
|
32
|
+
require 'jamm/api/models/v1_bank_scheduled_maintenance_period'
|
27
33
|
require 'jamm/api/models/v1_buyer'
|
28
34
|
require 'jamm/api/models/v1_charge'
|
29
35
|
require 'jamm/api/models/v1_charge_message'
|
@@ -41,12 +47,18 @@ require 'jamm/api/models/v1_create_customer_response'
|
|
41
47
|
require 'jamm/api/models/v1_customer'
|
42
48
|
require 'jamm/api/models/v1_delete_customer_response'
|
43
49
|
require 'jamm/api/models/v1_deposit_type'
|
44
|
-
require 'jamm/api/models/
|
50
|
+
require 'jamm/api/models/v1_error_detail'
|
51
|
+
require 'jamm/api/models/v1_error_response'
|
52
|
+
require 'jamm/api/models/v1_error_type'
|
45
53
|
require 'jamm/api/models/v1_event_type'
|
54
|
+
require 'jamm/api/models/v1_get_bank_response'
|
55
|
+
require 'jamm/api/models/v1_get_branch_response'
|
56
|
+
require 'jamm/api/models/v1_get_branches_response'
|
46
57
|
require 'jamm/api/models/v1_get_charge_response'
|
47
58
|
require 'jamm/api/models/v1_get_charges_response'
|
48
59
|
require 'jamm/api/models/v1_get_contract_response'
|
49
60
|
require 'jamm/api/models/v1_get_customer_response'
|
61
|
+
require 'jamm/api/models/v1_get_major_banks_response'
|
50
62
|
require 'jamm/api/models/v1_initial_charge'
|
51
63
|
require 'jamm/api/models/v1_kyc_status'
|
52
64
|
require 'jamm/api/models/v1_merchant'
|
@@ -64,6 +76,8 @@ require 'jamm/api/models/v1_pagination'
|
|
64
76
|
require 'jamm/api/models/v1_payment_authorization_status'
|
65
77
|
require 'jamm/api/models/v1_payment_link'
|
66
78
|
require 'jamm/api/models/v1_ping_response'
|
79
|
+
require 'jamm/api/models/v1_search_banks_response'
|
80
|
+
require 'jamm/api/models/v1_search_branches_response'
|
67
81
|
require 'jamm/api/models/v1_url'
|
68
82
|
require 'jamm/api/models/v1_update_customer_response'
|
69
83
|
require 'jamm/api/models/v1_user_account_message'
|
data/lib/jamm/charge.rb
CHANGED
@@ -7,7 +7,10 @@ require 'jamm/errors'
|
|
7
7
|
|
8
8
|
module Jamm
|
9
9
|
module Charge
|
10
|
+
# DEPRECATED, use Jamm::Payment.on_session
|
10
11
|
def self.create_with_redirect(customer:, charge:, redirect:)
|
12
|
+
Jamm::Deprecation.warn('Jamm::Charge.create_with_redirect')
|
13
|
+
|
11
14
|
request = Jamm::OpenAPI::AddChargeRequest.new(
|
12
15
|
customer: customer,
|
13
16
|
charge: charge,
|
@@ -19,7 +22,10 @@ module Jamm
|
|
19
22
|
raise Jamm::ApiError.from_error(e)
|
20
23
|
end
|
21
24
|
|
25
|
+
# DEPRECATED, use Jamm::Payment.off_session
|
22
26
|
def self.create_without_redirect(customer:, charge:)
|
27
|
+
Jamm::Deprecation.warn('Jamm::Charge.create_without_redirect')
|
28
|
+
|
23
29
|
request = Jamm::OpenAPI::WithdrawRequest.new(
|
24
30
|
customer: customer,
|
25
31
|
charge: charge
|
@@ -30,7 +36,10 @@ module Jamm
|
|
30
36
|
raise Jamm::ApiError.from_error(e)
|
31
37
|
end
|
32
38
|
|
39
|
+
# DEPRECATED, use Jamm::Payment.get
|
33
40
|
def self.get(charge_id)
|
41
|
+
Jamm::Deprecation.warn('Jamm::Charge.get')
|
42
|
+
|
34
43
|
Jamm::OpenAPI::PaymentApi.new(Jamm::Client.handler).get_charge(charge_id)
|
35
44
|
rescue Jamm::OpenAPI::ApiError => e
|
36
45
|
return nil if e.code == 404
|
@@ -38,7 +47,10 @@ module Jamm
|
|
38
47
|
raise Jamm::ApiError.from_error(e)
|
39
48
|
end
|
40
49
|
|
50
|
+
# DEPRECATED, use Jamm::Payment.list
|
41
51
|
def self.list(customer:, pagination: nil)
|
52
|
+
Jamm::Deprecation.warn('Jamm::Charge.list')
|
53
|
+
|
42
54
|
Jamm::OpenAPI::PaymentApi.new(Jamm::Client.handler).get_charges(customer, pagination.nil? ? {} : pagination)
|
43
55
|
rescue Jamm::OpenAPI::ApiError => e
|
44
56
|
if [404].include?(e.code)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jamm
|
4
|
+
module Deprecation
|
5
|
+
def self.warn(method)
|
6
|
+
puts [
|
7
|
+
'DEPRECATION WARNING:',
|
8
|
+
"#{method} is going to deprecate.",
|
9
|
+
'Please check our migration guide https://github.com/jamm-pay/ruby-sdk/wiki'
|
10
|
+
].join(' ')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
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/payment.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'json'
|
5
|
+
require 'base64'
|
6
|
+
require 'jamm/errors'
|
7
|
+
|
8
|
+
module Jamm
|
9
|
+
module Payment
|
10
|
+
def self.on_session(charge:, redirect:, customer: nil, buyer: nil)
|
11
|
+
request = if customer.nil?
|
12
|
+
Jamm::OpenAPI::OnSessionPaymentRequest.new(
|
13
|
+
buyer: buyer,
|
14
|
+
charge: charge,
|
15
|
+
redirect: redirect
|
16
|
+
)
|
17
|
+
else
|
18
|
+
Jamm::OpenAPI::OnSessionPaymentRequest.new(
|
19
|
+
customer: customer,
|
20
|
+
charge: charge,
|
21
|
+
redirect: redirect
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
Jamm::OpenAPI::PaymentApi.new(Jamm::Client.handler).on_session_payment(request)
|
26
|
+
rescue Jamm::OpenAPI::ApiError => e
|
27
|
+
raise Jamm::ApiError.from_error(e)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.off_session(customer:, charge:)
|
31
|
+
request = Jamm::OpenAPI::OffSessionPaymentRequest.new(
|
32
|
+
customer: customer,
|
33
|
+
charge: charge
|
34
|
+
)
|
35
|
+
|
36
|
+
Jamm::OpenAPI::PaymentApi.new(Jamm::Client.handler).off_session_payment(request)
|
37
|
+
rescue Jamm::OpenAPI::ApiError => e
|
38
|
+
raise Jamm::ApiError.from_error(e)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.get(charge_id)
|
42
|
+
Jamm::OpenAPI::PaymentApi.new(Jamm::Client.handler).get_charge(charge_id)
|
43
|
+
rescue Jamm::OpenAPI::ApiError => e
|
44
|
+
return nil if e.code == 404
|
45
|
+
|
46
|
+
raise Jamm::ApiError.from_error(e)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.list(customer:, pagination: nil)
|
50
|
+
Jamm::OpenAPI::PaymentApi.new(Jamm::Client.handler).get_charges(customer, pagination.nil? ? {} : pagination)
|
51
|
+
rescue Jamm::OpenAPI::ApiError => e
|
52
|
+
if [404].include?(e.code)
|
53
|
+
nil
|
54
|
+
else
|
55
|
+
{
|
56
|
+
charges: []
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/jamm/version.rb
CHANGED
data/lib/jamm.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.4.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-08-22 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
|
@@ -125,10 +139,12 @@ files:
|
|
125
139
|
- lib/jamm/client.rb
|
126
140
|
- lib/jamm/contract.rb
|
127
141
|
- lib/jamm/customer.rb
|
142
|
+
- lib/jamm/deprecation.rb
|
128
143
|
- lib/jamm/errors.rb
|
129
144
|
- lib/jamm/healthcheck.rb
|
130
145
|
- lib/jamm/oauth.rb
|
131
146
|
- lib/jamm/openapi.rb
|
147
|
+
- lib/jamm/payment.rb
|
132
148
|
- lib/jamm/version.rb
|
133
149
|
- lib/jamm/webhook.rb
|
134
150
|
homepage: https://jamm-pay.jp
|