Class: Komoju::Payment
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Komoju::Payment
- Defined in:
- lib/komoju-sdk/models/payment.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#amount ⇒ Object
The payment amount before tax, greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
-
#amount_refunded ⇒ Object
Amount greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
-
#captured_at ⇒ Object
Timestamp when the payment was captured, or null if not yet captured.
-
#created_at ⇒ Object
Timestamp when the payment was created.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#customer ⇒ Object
Customer UUID if associated with a customer, otherwise null.
-
#customer_family_name ⇒ Object
Customer's family name.
-
#customer_given_name ⇒ Object
Customer's given name.
-
#description ⇒ Object
A description for this payment.
-
#external_order_num ⇒ Object
Merchant-assigned external order number for this payment.
-
#id ⇒ Object
A unique 25-character alphanumeric payment identifier.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#mcc ⇒ Object
Merchant Category Code used for this payment.
-
#metadata ⇒ Object
Arbitrary key-value metadata attached at payment creation time.
-
#payment_deadline ⇒ Object
Deadline by which the payment must be completed, or null.
-
#payment_details ⇒ Object
Returns the value of attribute payment_details.
-
#payment_method_fee ⇒ Object
Amount greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
-
#platform_details ⇒ Object
Returns the value of attribute platform_details.
-
#refund_requests ⇒ Object
An array of refund requests.
-
#refunds ⇒ Object
An array of refunds.
-
#resource ⇒ Object
Resource name.
-
#session ⇒ Object
A unique 25-character alphanumeric resource identifier.
-
#statement_descriptor ⇒ Object
Returns the value of attribute statement_descriptor.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tax ⇒ Object
The tax amount, greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
-
#total ⇒ Object
Amount greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Payment
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Payment
Initializes the object
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/komoju-sdk/models/payment.rb', line 202 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Komoju::Payment` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Komoju::Payment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'resource') self.resource = attributes[:'resource'] else self.resource = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'amount') self.amount = attributes[:'amount'] else self.amount = nil end if attributes.key?(:'tax') self.tax = attributes[:'tax'] else self.tax = nil end if attributes.key?(:'customer') self.customer = attributes[:'customer'] else self.customer = nil end if attributes.key?(:'payment_deadline') self.payment_deadline = attributes[:'payment_deadline'] else self.payment_deadline = nil end if attributes.key?(:'payment_details') self.payment_details = attributes[:'payment_details'] else self.payment_details = nil end if attributes.key?(:'payment_method_fee') self.payment_method_fee = attributes[:'payment_method_fee'] else self.payment_method_fee = nil end if attributes.key?(:'total') self.total = attributes[:'total'] else self.total = nil end if attributes.key?(:'currency') self.currency = attributes[:'currency'] else self.currency = nil end if attributes.key?(:'description') self.description = attributes[:'description'] else self.description = nil end if attributes.key?(:'captured_at') self.captured_at = attributes[:'captured_at'] else self.captured_at = nil end if attributes.key?(:'external_order_num') self.external_order_num = attributes[:'external_order_num'] else self.external_order_num = nil end if attributes.key?(:'metadata') self. = attributes[:'metadata'] else self. = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'amount_refunded') self.amount_refunded = attributes[:'amount_refunded'] else self.amount_refunded = nil end if attributes.key?(:'locale') self.locale = attributes[:'locale'] else self.locale = nil end if attributes.key?(:'session') self.session = attributes[:'session'] else self.session = nil end if attributes.key?(:'customer_family_name') self.customer_family_name = attributes[:'customer_family_name'] else self.customer_family_name = nil end if attributes.key?(:'customer_given_name') self.customer_given_name = attributes[:'customer_given_name'] else self.customer_given_name = nil end if attributes.key?(:'mcc') self.mcc = attributes[:'mcc'] else self.mcc = nil end if attributes.key?(:'statement_descriptor') self.statement_descriptor = attributes[:'statement_descriptor'] else self.statement_descriptor = nil end if attributes.key?(:'platform_details') self.platform_details = attributes[:'platform_details'] end if attributes.key?(:'refunds') if (value = attributes[:'refunds']).is_a?(Array) self.refunds = value end else self.refunds = nil end if attributes.key?(:'refund_requests') if (value = attributes[:'refund_requests']).is_a?(Array) self.refund_requests = value end else self.refund_requests = nil end end |
Instance Attribute Details
#amount ⇒ Object
The payment amount before tax, greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
27 28 29 |
# File 'lib/komoju-sdk/models/payment.rb', line 27 def amount @amount end |
#amount_refunded ⇒ Object
Amount greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
64 65 66 |
# File 'lib/komoju-sdk/models/payment.rb', line 64 def amount_refunded @amount_refunded end |
#captured_at ⇒ Object
Timestamp when the payment was captured, or null if not yet captured.
52 53 54 |
# File 'lib/komoju-sdk/models/payment.rb', line 52 def captured_at @captured_at end |
#created_at ⇒ Object
Timestamp when the payment was created.
61 62 63 |
# File 'lib/komoju-sdk/models/payment.rb', line 61 def created_at @created_at end |
#currency ⇒ Object
Returns the value of attribute currency.
46 47 48 |
# File 'lib/komoju-sdk/models/payment.rb', line 46 def currency @currency end |
#customer ⇒ Object
Customer UUID if associated with a customer, otherwise null.
33 34 35 |
# File 'lib/komoju-sdk/models/payment.rb', line 33 def customer @customer end |
#customer_family_name ⇒ Object
Customer's family name.
72 73 74 |
# File 'lib/komoju-sdk/models/payment.rb', line 72 def customer_family_name @customer_family_name end |
#customer_given_name ⇒ Object
Customer's given name.
75 76 77 |
# File 'lib/komoju-sdk/models/payment.rb', line 75 def customer_given_name @customer_given_name end |
#description ⇒ Object
A description for this payment. May be null if it's not set.
49 50 51 |
# File 'lib/komoju-sdk/models/payment.rb', line 49 def description @description end |
#external_order_num ⇒ Object
Merchant-assigned external order number for this payment.
55 56 57 |
# File 'lib/komoju-sdk/models/payment.rb', line 55 def external_order_num @external_order_num end |
#id ⇒ Object
A unique 25-character alphanumeric payment identifier.
19 20 21 |
# File 'lib/komoju-sdk/models/payment.rb', line 19 def id @id end |
#locale ⇒ Object
Returns the value of attribute locale.
66 67 68 |
# File 'lib/komoju-sdk/models/payment.rb', line 66 def locale @locale end |
#mcc ⇒ Object
Merchant Category Code used for this payment.
78 79 80 |
# File 'lib/komoju-sdk/models/payment.rb', line 78 def mcc @mcc end |
#metadata ⇒ Object
Arbitrary key-value metadata attached at payment creation time.
58 59 60 |
# File 'lib/komoju-sdk/models/payment.rb', line 58 def @metadata end |
#payment_deadline ⇒ Object
Deadline by which the payment must be completed, or null.
36 37 38 |
# File 'lib/komoju-sdk/models/payment.rb', line 36 def payment_deadline @payment_deadline end |
#payment_details ⇒ Object
Returns the value of attribute payment_details.
38 39 40 |
# File 'lib/komoju-sdk/models/payment.rb', line 38 def payment_details @payment_details end |
#payment_method_fee ⇒ Object
Amount greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
41 42 43 |
# File 'lib/komoju-sdk/models/payment.rb', line 41 def payment_method_fee @payment_method_fee end |
#platform_details ⇒ Object
Returns the value of attribute platform_details.
82 83 84 |
# File 'lib/komoju-sdk/models/payment.rb', line 82 def platform_details @platform_details end |
#refund_requests ⇒ Object
An array of refund requests. Will be an empty array if there are no refund requests.
88 89 90 |
# File 'lib/komoju-sdk/models/payment.rb', line 88 def refund_requests @refund_requests end |
#refunds ⇒ Object
An array of refunds. Will be an empty array if there are no refunds.
85 86 87 |
# File 'lib/komoju-sdk/models/payment.rb', line 85 def refunds @refunds end |
#resource ⇒ Object
Resource name. Will always be payment.
22 23 24 |
# File 'lib/komoju-sdk/models/payment.rb', line 22 def resource @resource end |
#session ⇒ Object
A unique 25-character alphanumeric resource identifier.
69 70 71 |
# File 'lib/komoju-sdk/models/payment.rb', line 69 def session @session end |
#statement_descriptor ⇒ Object
Returns the value of attribute statement_descriptor.
80 81 82 |
# File 'lib/komoju-sdk/models/payment.rb', line 80 def statement_descriptor @statement_descriptor end |
#status ⇒ Object
Returns the value of attribute status.
24 25 26 |
# File 'lib/komoju-sdk/models/payment.rb', line 24 def status @status end |
#tax ⇒ Object
The tax amount, greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
30 31 32 |
# File 'lib/komoju-sdk/models/payment.rb', line 30 def tax @tax end |
#total ⇒ Object
Amount greater than or equal to 0, in the lowest denomination of the currency (e.g. cents for USD).
44 45 46 |
# File 'lib/komoju-sdk/models/payment.rb', line 44 def total @total end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 |
# File 'lib/komoju-sdk/models/payment.rb', line 806 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) rescue value when :Date Date.parse(value) rescue value when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Komoju.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
145 146 147 |
# File 'lib/komoju-sdk/models/payment.rb', line 145 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
150 151 152 |
# File 'lib/komoju-sdk/models/payment.rb', line 150 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/komoju-sdk/models/payment.rb', line 113 def self.attribute_map { :'id' => :'id', :'resource' => :'resource', :'status' => :'status', :'amount' => :'amount', :'tax' => :'tax', :'customer' => :'customer', :'payment_deadline' => :'payment_deadline', :'payment_details' => :'payment_details', :'payment_method_fee' => :'payment_method_fee', :'total' => :'total', :'currency' => :'currency', :'description' => :'description', :'captured_at' => :'captured_at', :'external_order_num' => :'external_order_num', :'metadata' => :'metadata', :'created_at' => :'created_at', :'amount_refunded' => :'amount_refunded', :'locale' => :'locale', :'session' => :'session', :'customer_family_name' => :'customer_family_name', :'customer_given_name' => :'customer_given_name', :'mcc' => :'mcc', :'statement_descriptor' => :'statement_descriptor', :'platform_details' => :'platform_details', :'refunds' => :'refunds', :'refund_requests' => :'refund_requests' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 |
# File 'lib/komoju-sdk/models/payment.rb', line 776 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end begin new(transformed_hash) rescue ArgumentError => e obj = allocate transformed_hash.each { |k, v| obj.instance_variable_set(:"@#{k}", v) } obj end end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/komoju-sdk/models/payment.rb', line 187 def self.openapi_nullable Set.new([ :'customer', :'payment_deadline', :'description', :'captured_at', :'external_order_num', :'customer_family_name', :'customer_given_name', :'mcc', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/komoju-sdk/models/payment.rb', line 155 def self.openapi_types { :'id' => :'String', :'resource' => :'String', :'status' => :'PaymentStatus', :'amount' => :'Integer', :'tax' => :'Integer', :'customer' => :'String', :'payment_deadline' => :'Time', :'payment_details' => :'ResponsePaymentDetailsAll', :'payment_method_fee' => :'Integer', :'total' => :'Integer', :'currency' => :'Currency', :'description' => :'String', :'captured_at' => :'Time', :'external_order_num' => :'String', :'metadata' => :'Object', :'created_at' => :'Time', :'amount_refunded' => :'Integer', :'locale' => :'Locale', :'session' => :'String', :'customer_family_name' => :'String', :'customer_given_name' => :'String', :'mcc' => :'String', :'statement_descriptor' => :'StatementDescriptor', :'platform_details' => :'PlatformDetails', :'refunds' => :'Array<Refund>', :'refund_requests' => :'Array<RefundRequest>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File 'lib/komoju-sdk/models/payment.rb', line 730 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && resource == o.resource && status == o.status && amount == o.amount && tax == o.tax && customer == o.customer && payment_deadline == o.payment_deadline && payment_details == o.payment_details && payment_method_fee == o.payment_method_fee && total == o.total && currency == o.currency && description == o.description && captured_at == o.captured_at && external_order_num == o.external_order_num && == o. && created_at == o.created_at && amount_refunded == o.amount_refunded && locale == o.locale && session == o.session && customer_family_name == o.customer_family_name && customer_given_name == o.customer_given_name && mcc == o.mcc && statement_descriptor == o.statement_descriptor && platform_details == o.platform_details && refunds == o.refunds && refund_requests == o.refund_requests end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
877 878 879 880 881 882 883 884 885 886 887 888 889 |
# File 'lib/komoju-sdk/models/payment.rb', line 877 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
763 764 765 |
# File 'lib/komoju-sdk/models/payment.rb', line 763 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
769 770 771 |
# File 'lib/komoju-sdk/models/payment.rb', line 769 def hash [id, resource, status, amount, tax, customer, payment_deadline, payment_details, payment_method_fee, total, currency, description, captured_at, external_order_num, , created_at, amount_refunded, locale, session, customer_family_name, customer_given_name, mcc, statement_descriptor, platform_details, refunds, refund_requests].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/komoju-sdk/models/payment.rb', line 377 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @id.to_s.length > 25 invalid_properties.push('invalid value for "id", the character length must be smaller than or equal to 25.') end if @id.to_s.length < 25 invalid_properties.push('invalid value for "id", the character length must be greater than or equal to 25.') end if @resource.nil? invalid_properties.push('invalid value for "resource", resource cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @amount.nil? invalid_properties.push('invalid value for "amount", amount cannot be nil.') end if @amount < 0 invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') end if @tax.nil? invalid_properties.push('invalid value for "tax", tax cannot be nil.') end if @tax < 0 invalid_properties.push('invalid value for "tax", must be greater than or equal to 0.') end if @payment_details.nil? invalid_properties.push('invalid value for "payment_details", payment_details cannot be nil.') end if @payment_method_fee.nil? invalid_properties.push('invalid value for "payment_method_fee", payment_method_fee cannot be nil.') end if @payment_method_fee < 0 invalid_properties.push('invalid value for "payment_method_fee", must be greater than or equal to 0.') end if @total.nil? invalid_properties.push('invalid value for "total", total cannot be nil.') end if @total < 0 invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end if @metadata.nil? invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @amount_refunded.nil? invalid_properties.push('invalid value for "amount_refunded", amount_refunded cannot be nil.') end if @amount_refunded < 0 invalid_properties.push('invalid value for "amount_refunded", must be greater than or equal to 0.') end if @locale.nil? invalid_properties.push('invalid value for "locale", locale cannot be nil.') end if @session.nil? invalid_properties.push('invalid value for "session", session cannot be nil.') end if @session.to_s.length > 25 invalid_properties.push('invalid value for "session", the character length must be smaller than or equal to 25.') end if @session.to_s.length < 25 invalid_properties.push('invalid value for "session", the character length must be greater than or equal to 25.') end if @statement_descriptor.nil? invalid_properties.push('invalid value for "statement_descriptor", statement_descriptor cannot be nil.') end if @refunds.nil? invalid_properties.push('invalid value for "refunds", refunds cannot be nil.') end if @refund_requests.nil? invalid_properties.push('invalid value for "refund_requests", refund_requests cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
853 854 855 |
# File 'lib/komoju-sdk/models/payment.rb', line 853 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
859 860 861 862 863 864 865 866 867 868 869 870 871 |
# File 'lib/komoju-sdk/models/payment.rb', line 859 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
847 848 849 |
# File 'lib/komoju-sdk/models/payment.rb', line 847 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/komoju-sdk/models/payment.rb', line 489 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @id.to_s.length > 25 return false if @id.to_s.length < 25 return false if @resource.nil? resource_validator = EnumAttributeValidator.new('String', ["payment"]) return false unless resource_validator.valid?(@resource) return false if @status.nil? return false if @amount.nil? return false if @amount < 0 return false if @tax.nil? return false if @tax < 0 return false if @payment_details.nil? return false if @payment_method_fee.nil? return false if @payment_method_fee < 0 return false if @total.nil? return false if @total < 0 return false if @currency.nil? return false if @metadata.nil? return false if @created_at.nil? return false if @amount_refunded.nil? return false if @amount_refunded < 0 return false if @locale.nil? return false if @session.nil? return false if @session.to_s.length > 25 return false if @session.to_s.length < 25 return false if @statement_descriptor.nil? return false if @refunds.nil? return false if @refund_requests.nil? true end |