jamm 1.7.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 571cd55d4f48ad397f8b1b4a3f442bba54e87be8a021c60dc866eaf8893d2f91
4
- data.tar.gz: 915b6f10dd15012ba4a7fa05f68c36d653c0cb74b7ae058afa357e4511d4ecdb
3
+ metadata.gz: e3e4e58bcc8b6bba8c4f54b6102212fc8e8f220b7bf311ad6df4d3455636bdbe
4
+ data.tar.gz: e3b4f96bcc5fa1b8b58e941884e300980e2b34074ce91733d31476c94a89253f
5
5
  SHA512:
6
- metadata.gz: d578007b52e84b6a725fe9935d7948dd5415ae1fbbc1b98ecab895c293efa4f513ff74b5b9a49f004ba171c2b46ac34635f0c1b99b51dbe028468713766f3103
7
- data.tar.gz: 5be46a218ea9a5d3cd4fde2cbc7821eb017ca77131a24a58bafcffd02e359db87b627c1ea5714c7ae679a9dd12dd62d6ba8da6254d2af8ec4d58dc19ca2ccbbe
6
+ metadata.gz: 6a1ffa31922c27280624f72f00005f508f967b0efc8e1c3f1b369c77a4ab36cb40fd78ba23eed62c805b1722560c5e80a5a41e73675e021b9579e024368975ad
7
+ data.tar.gz: 90a9a314ced4d6c3179f2369b9c601f58a824e9dc106fb0a42ff272fe1c3d1bd7d67b858a7bbf1847a4909dd22891ace8829211f2d7b2e0b855d063cb647ea74
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jamm (1.7.0)
4
+ jamm (2.0.0)
5
5
  rest-client (~> 2.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -559,6 +559,74 @@ module Api
559
559
  return data, status_code, headers
560
560
  end
561
561
 
562
+ # Initiate async off-session payment
563
+ # Starts asynchronous off-session payment processing and returns request tracking information.
564
+ # @param body [OffSessionPaymentAsyncRequest] This message represents a request to process an off-session payment asynchronously. It contains the customer ID and the amount to charge.
565
+ # @param [Hash] opts the optional parameters
566
+ # @return [OffSessionPaymentAsyncResponse]
567
+ def off_session_payment_async(body, opts = {})
568
+ data, _status_code, _headers = off_session_payment_async_with_http_info(body, opts)
569
+ data
570
+ end
571
+
572
+ # Initiate async off-session payment
573
+ # Starts asynchronous off-session payment processing and returns request tracking information.
574
+ # @param body [OffSessionPaymentAsyncRequest] This message represents a request to process an off-session payment asynchronously. It contains the customer ID and the amount to charge.
575
+ # @param [Hash] opts the optional parameters
576
+ # @return [Array<(OffSessionPaymentAsyncResponse, Integer, Hash)>] OffSessionPaymentAsyncResponse data, response status code and response headers
577
+ def off_session_payment_async_with_http_info(body, opts = {})
578
+ if @api_client.config.debugging
579
+ @api_client.config.logger.debug 'Calling API: PaymentApi.off_session_payment_async ...'
580
+ end
581
+ # verify the required parameter 'body' is set
582
+ if @api_client.config.client_side_validation && body.nil?
583
+ fail ArgumentError, "Missing the required parameter 'body' when calling PaymentApi.off_session_payment_async"
584
+ end
585
+ # resource path
586
+ local_var_path = '/v1/payments/off-session/async'
587
+
588
+ # query parameters
589
+ query_params = opts[:query_params] || {}
590
+
591
+ # header parameters
592
+ header_params = opts[:header_params] || {}
593
+ # HTTP header 'Accept' (if needed)
594
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
595
+ # HTTP header 'Content-Type'
596
+ content_type = @api_client.select_header_content_type(['application/json'])
597
+ if !content_type.nil?
598
+ header_params['Content-Type'] = content_type
599
+ end
600
+
601
+ # form parameters
602
+ form_params = opts[:form_params] || {}
603
+
604
+ # http body (model)
605
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
606
+
607
+ # return_type
608
+ return_type = opts[:debug_return_type] || 'OffSessionPaymentAsyncResponse'
609
+
610
+ # auth_names
611
+ auth_names = opts[:debug_auth_names] || []
612
+
613
+ new_options = opts.merge(
614
+ :operation => :"PaymentApi.off_session_payment_async",
615
+ :header_params => header_params,
616
+ :query_params => query_params,
617
+ :form_params => form_params,
618
+ :body => post_body,
619
+ :auth_names => auth_names,
620
+ :return_type => return_type
621
+ )
622
+
623
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
624
+ if @api_client.config.debugging
625
+ @api_client.config.logger.debug "API called: PaymentApi#off_session_payment_async\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
626
+ end
627
+ return data, status_code, headers
628
+ end
629
+
562
630
  # Process payment with optional redirect
563
631
  # Unified interface for creating payments - supports existing customers, new customers with charges, and contract-only creation.
564
632
  # @param body [OnSessionPaymentRequest] Request message for the unified payment interface. The system intelligently routes the request to the appropriate payment method based on the provided parameters.
@@ -627,6 +695,74 @@ module Api
627
695
  return data, status_code, headers
628
696
  end
629
697
 
698
+ # Refund a charge
699
+ # Refunds a charge. If the same-day cancellation window has not passed, cancels the charge directly. Otherwise, creates a bank transfer refund request.
700
+ # @param body [RefundRequest] Request message for refunding a charge. The refund is always processed asynchronously. The final result is delivered via webhook (&#x60;charge_refund&#x60;).
701
+ # @param [Hash] opts the optional parameters
702
+ # @return [RefundResponse]
703
+ def refund(body, opts = {})
704
+ data, _status_code, _headers = refund_with_http_info(body, opts)
705
+ data
706
+ end
707
+
708
+ # Refund a charge
709
+ # Refunds a charge. If the same-day cancellation window has not passed, cancels the charge directly. Otherwise, creates a bank transfer refund request.
710
+ # @param body [RefundRequest] Request message for refunding a charge. The refund is always processed asynchronously. The final result is delivered via webhook (&#x60;charge_refund&#x60;).
711
+ # @param [Hash] opts the optional parameters
712
+ # @return [Array<(RefundResponse, Integer, Hash)>] RefundResponse data, response status code and response headers
713
+ def refund_with_http_info(body, opts = {})
714
+ if @api_client.config.debugging
715
+ @api_client.config.logger.debug 'Calling API: PaymentApi.refund ...'
716
+ end
717
+ # verify the required parameter 'body' is set
718
+ if @api_client.config.client_side_validation && body.nil?
719
+ fail ArgumentError, "Missing the required parameter 'body' when calling PaymentApi.refund"
720
+ end
721
+ # resource path
722
+ local_var_path = '/v1/refund'
723
+
724
+ # query parameters
725
+ query_params = opts[:query_params] || {}
726
+
727
+ # header parameters
728
+ header_params = opts[:header_params] || {}
729
+ # HTTP header 'Accept' (if needed)
730
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
731
+ # HTTP header 'Content-Type'
732
+ content_type = @api_client.select_header_content_type(['application/json'])
733
+ if !content_type.nil?
734
+ header_params['Content-Type'] = content_type
735
+ end
736
+
737
+ # form parameters
738
+ form_params = opts[:form_params] || {}
739
+
740
+ # http body (model)
741
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
742
+
743
+ # return_type
744
+ return_type = opts[:debug_return_type] || 'RefundResponse'
745
+
746
+ # auth_names
747
+ auth_names = opts[:debug_auth_names] || []
748
+
749
+ new_options = opts.merge(
750
+ :operation => :"PaymentApi.refund",
751
+ :header_params => header_params,
752
+ :query_params => query_params,
753
+ :form_params => form_params,
754
+ :body => post_body,
755
+ :auth_names => auth_names,
756
+ :return_type => return_type
757
+ )
758
+
759
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
760
+ if @api_client.config.debugging
761
+ @api_client.config.logger.debug "API called: PaymentApi#refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
762
+ end
763
+ return data, status_code, headers
764
+ end
765
+
630
766
  # Withdraw money from customer immediately, without redirect
631
767
  # This call is synchronous. The money will be withdrawn immediately.
632
768
  # @param body [WithdrawRequest] This message represents a request to withdraw money from a customer. It contains the customer ID and the amount to withdraw.
@@ -48,6 +48,30 @@ module Api
48
48
 
49
49
  attr_accessor :processed_at
50
50
 
51
+ attr_accessor :charge_status
52
+
53
+ class EnumAttributeValidator
54
+ attr_reader :datatype
55
+ attr_reader :allowable_values
56
+
57
+ def initialize(datatype, allowable_values)
58
+ @allowable_values = allowable_values.map do |value|
59
+ case datatype.to_s
60
+ when /Integer/i
61
+ value.to_i
62
+ when /Float/i
63
+ value.to_f
64
+ else
65
+ value
66
+ end
67
+ end
68
+ end
69
+
70
+ def valid?(value)
71
+ !value || allowable_values.include?(value)
72
+ end
73
+ end
74
+
51
75
  # Attribute mapping from ruby-style variable name to JSON key.
52
76
  def self.attribute_map
53
77
  {
@@ -65,7 +89,8 @@ module Api
65
89
  :'metadata' => :'metadata',
66
90
  :'created_at' => :'createdAt',
67
91
  :'updated_at' => :'updatedAt',
68
- :'processed_at' => :'processedAt'
92
+ :'processed_at' => :'processedAt',
93
+ :'charge_status' => :'chargeStatus'
69
94
  }
70
95
  end
71
96
 
@@ -91,7 +116,8 @@ module Api
91
116
  :'metadata' => :'Hash<String, String>',
92
117
  :'created_at' => :'Time',
93
118
  :'updated_at' => :'Time',
94
- :'processed_at' => :'Time'
119
+ :'processed_at' => :'Time',
120
+ :'charge_status' => :'ChargeStatus'
95
121
  }
96
122
  end
97
123
 
@@ -177,6 +203,12 @@ module Api
177
203
  if attributes.key?(:'processed_at')
178
204
  self.processed_at = attributes[:'processed_at']
179
205
  end
206
+
207
+ if attributes.key?(:'charge_status')
208
+ self.charge_status = attributes[:'charge_status']
209
+ else
210
+ self.charge_status = 'CHARGE_STATUS_UNSPECIFIED'
211
+ end
180
212
  end
181
213
 
182
214
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -213,7 +245,8 @@ module Api
213
245
  metadata == o.metadata &&
214
246
  created_at == o.created_at &&
215
247
  updated_at == o.updated_at &&
216
- processed_at == o.processed_at
248
+ processed_at == o.processed_at &&
249
+ charge_status == o.charge_status
217
250
  end
218
251
 
219
252
  # @see the `==` method
@@ -225,7 +258,7 @@ module Api
225
258
  # Calculates hash code according to all attributes.
226
259
  # @return [Integer] Hash code
227
260
  def hash
228
- [charge_id, paid, reason, description, merchant_name, initial_amount, discount, final_amount, amount_refunded, currency, token_id, metadata, created_at, updated_at, processed_at].hash
261
+ [charge_id, paid, reason, description, merchant_name, initial_amount, discount, final_amount, amount_refunded, currency, token_id, metadata, created_at, updated_at, processed_at, charge_status].hash
229
262
  end
230
263
 
231
264
  # Builds the object from hash
@@ -0,0 +1,46 @@
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
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Api
17
+ class ChargeStatus
18
+ UNSPECIFIED = "CHARGE_STATUS_UNSPECIFIED".freeze
19
+ SUCCESS = "CHARGE_STATUS_SUCCESS".freeze
20
+ FAILURE = "CHARGE_STATUS_FAILURE".freeze
21
+ WAITING_EKYC = "CHARGE_STATUS_WAITING_EKYC".freeze
22
+ BLOCKING = "CHARGE_STATUS_BLOCKING".freeze
23
+ CANCELLED = "CHARGE_STATUS_CANCELLED".freeze
24
+ REFUNDED = "CHARGE_STATUS_REFUNDED".freeze
25
+ PENDING = "CHARGE_STATUS_PENDING".freeze
26
+
27
+ def self.all_vars
28
+ @all_vars ||= [UNSPECIFIED, SUCCESS, FAILURE, WAITING_EKYC, BLOCKING, CANCELLED, REFUNDED, PENDING].freeze
29
+ end
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def self.build_from_hash(value)
35
+ new.build_from_hash(value)
36
+ end
37
+
38
+ # Builds the enum from string
39
+ # @param [String] The enum value in the form of the string
40
+ # @return [String] The enum value
41
+ def build_from_hash(value)
42
+ return value if ChargeStatus.all_vars.include?(value)
43
+ raise "Invalid ENUM value #{value} for class #ChargeStatus"
44
+ end
45
+ end
46
+ end
@@ -20,13 +20,13 @@ module Api
20
20
  CHARGE_UPDATED = "EVENT_TYPE_CHARGE_UPDATED".freeze
21
21
  CHARGE_SUCCESS = "EVENT_TYPE_CHARGE_SUCCESS".freeze
22
22
  CHARGE_FAIL = "EVENT_TYPE_CHARGE_FAIL".freeze
23
- CHARGE_CANCEL = "EVENT_TYPE_CHARGE_CANCEL".freeze
23
+ CHARGE_REFUND = "EVENT_TYPE_CHARGE_REFUND".freeze
24
24
  CONTRACT_ACTIVATED = "EVENT_TYPE_CONTRACT_ACTIVATED".freeze
25
25
  USER_ACCOUNT_DELETED = "EVENT_TYPE_USER_ACCOUNT_DELETED".freeze
26
26
  TESTING = "EVENT_TYPE_TESTING".freeze
27
27
 
28
28
  def self.all_vars
29
- @all_vars ||= [UNSPECIFIED, CHARGE_CREATED, CHARGE_UPDATED, CHARGE_SUCCESS, CHARGE_FAIL, CHARGE_CANCEL, CONTRACT_ACTIVATED, USER_ACCOUNT_DELETED, TESTING].freeze
29
+ @all_vars ||= [UNSPECIFIED, CHARGE_CREATED, CHARGE_UPDATED, CHARGE_SUCCESS, CHARGE_FAIL, CHARGE_REFUND, CONTRACT_ACTIVATED, USER_ACCOUNT_DELETED, TESTING].freeze
30
30
  end
31
31
 
32
32
  # Builds the enum from string
@@ -0,0 +1,224 @@
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
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Api
17
+ # This message represents a request to process an off-session payment asynchronously. It contains the customer ID and the amount to charge.
18
+ class OffSessionPaymentAsyncRequest
19
+ attr_accessor :customer
20
+
21
+ attr_accessor :charge
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'customer' => :'customer',
27
+ :'charge' => :'charge'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'customer' => :'String',
40
+ :'charge' => :'InitialCharge'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Api::OffSessionPaymentAsyncRequest` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
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::OffSessionPaymentAsyncRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'customer')
66
+ self.customer = attributes[:'customer']
67
+ end
68
+
69
+ if attributes.key?(:'charge')
70
+ self.charge = attributes[:'charge']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ warn '[DEPRECATED] the `valid?` method is obsolete'
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ customer == o.customer &&
95
+ charge == o.charge
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Integer] Hash code
106
+ def hash
107
+ [customer, charge].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def self.build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ attributes = attributes.transform_keys(&:to_sym)
116
+ transformed_hash = {}
117
+ openapi_types.each_pair do |key, type|
118
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
119
+ transformed_hash["#{key}"] = nil
120
+ elsif type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[attribute_map[key]].is_a?(Array)
124
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
125
+ end
126
+ elsif !attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
128
+ end
129
+ end
130
+ new(transformed_hash)
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def self._deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ # models (e.g. Pet) or oneOf
171
+ klass = Api.const_get(type)
172
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end