class Yapstone::BankAccount
Details for the bank account the customer wants to use for payment.
Attributes
The full bank account number.
The type of account being paid from - choose from checking or savings account.
A bank code is a code assigned by a central bank, a bank supervisory body or a Bankers Association in a country to all its licensed member banks or financial institutions. The name of bank codes can vary.
The name of the bank.
The bank identifier code (BIC) is the SWIFT address assigned to a bank in order to send automated payments quicky and accurately to the banks concerned.
A branch code is part of the Indian Financial System Code (IFSC), which is an 11 character alphanumeric code where the first four characters represent the bank's name, the fifth character is always 0 and the rest of the digits are the branch code.
The country the bank is located in.
The currency of the bank account.
This is an International Bank Account Number (IBAN) which is an internationally agreed system of identifying bank accounts across national borders to facilitate the communication and processing of cross border transactions with a reduced risk of transcription errors.
The name of the person or business entity associated with the account.
The routing transit number for the bank account
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/yapstone-payments/models/bank_account.rb, line 74 def self.attribute_map { :'account_number' => :'accountNumber', :'routing_number' => :'routingNumber', :'account_type' => :'accountType', :'currency' => :'currency', :'bank_name' => :'bankName', :'country' => :'country', :'bic' => :'bic', :'bank_code' => :'bankCode', :'branch_code' => :'branchCode', :'iban' => :'iban', :'name_on_account' => :'nameOnAccount' } end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/yapstone-payments/models/bank_account.rb, line 240 def self.build_from_hash(attributes) new.build_from_hash(attributes) end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/yapstone-payments/models/bank_account.rb, line 109 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Yapstone::BankAccount` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Yapstone::BankAccount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'account_number') self.account_number = attributes[:'account_number'] end if attributes.key?(:'routing_number') self.routing_number = attributes[:'routing_number'] end if attributes.key?(:'account_type') self.account_type = attributes[:'account_type'] end if attributes.key?(:'currency') self.currency = attributes[:'currency'] end if attributes.key?(:'bank_name') self.bank_name = attributes[:'bank_name'] end if attributes.key?(:'country') self.country = attributes[:'country'] end if attributes.key?(:'bic') self.bic = attributes[:'bic'] end if attributes.key?(:'bank_code') self.bank_code = attributes[:'bank_code'] end if attributes.key?(:'branch_code') self.branch_code = attributes[:'branch_code'] end if attributes.key?(:'iban') self.iban = attributes[:'iban'] end if attributes.key?(:'name_on_account') self.name_on_account = attributes[:'name_on_account'] end end
Attribute type mapping.
# File lib/yapstone-payments/models/bank_account.rb, line 91 def self.openapi_types { :'account_number' => :'String', :'routing_number' => :'String', :'account_type' => :'String', :'currency' => :'String', :'bank_name' => :'String', :'country' => :'String', :'bic' => :'String', :'bank_code' => :'String', :'branch_code' => :'String', :'iban' => :'String', :'name_on_account' => :'String' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/yapstone-payments/models/bank_account.rb, line 209 def ==(o) return true if self.equal?(o) self.class == o.class && account_number == o.account_number && routing_number == o.routing_number && account_type == o.account_type && currency == o.currency && bank_name == o.bank_name && country == o.country && bic == o.bic && bank_code == o.bank_code && branch_code == o.branch_code && iban == o.iban && name_on_account == o.name_on_account end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/yapstone-payments/models/bank_account.rb, line 268 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(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 Yapstone.const_get(type).build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/yapstone-payments/models/bank_account.rb, line 333 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
Custom attribute writer method checking allowed values (enum). @param [Object] account_type
Object to be assigned
# File lib/yapstone-payments/models/bank_account.rb, line 199 def account_type=(account_type) validator = EnumAttributeValidator.new('String', ["checking", "saving"]) unless validator.valid?(account_type) fail ArgumentError, "invalid value for \"account_type\", must be one of #{validator.allowable_values}." end @account_type = account_type end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/yapstone-payments/models/bank_account.rb, line 247 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if 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[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
@see the `==` method @param [Object] Object to be compared
# File lib/yapstone-payments/models/bank_account.rb, line 227 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Integer] Hash code
# File lib/yapstone-payments/models/bank_account.rb, line 233 def hash [account_number, routing_number, account_type, currency, bank_name, country, bic, bank_code, branch_code, iban, name_on_account].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/yapstone-payments/models/bank_account.rb, line 169 def list_invalid_properties invalid_properties = Array.new if @account_number.nil? invalid_properties.push('invalid value for "account_number", account_number cannot be nil.') end if @account_type.nil? invalid_properties.push('invalid value for "account_type", account_type cannot be nil.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/yapstone-payments/models/bank_account.rb, line 319 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/yapstone-payments/models/bank_account.rb, line 307 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/yapstone-payments/models/bank_account.rb, line 188 def valid? return false if @account_number.nil? return false if @account_type.nil? account_type_validator = EnumAttributeValidator.new('String', ["checking", "saving"]) return false unless account_type_validator.valid?(@account_type) return false if @currency.nil? true end