=begin #Treezor #Treezor API. more info [here](https://www.treezor.com). OpenAPI spec version: 0.1.1 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.1 =end require 'date' module TreezorClient class Payin attr_accessor :payin_id attr_accessor :payin_tag attr_accessor :payin_status attr_accessor :code_status attr_accessor :information_status attr_accessor :wallet_id attr_accessor :user_id attr_accessor :cart_id attr_accessor :wallet_event_name attr_accessor :wallet_alias attr_accessor :user_firstname attr_accessor :user_lastname attr_accessor :message_to_user attr_accessor :payment_method_id attr_accessor :subtotal_items attr_accessor :subtotal_services attr_accessor :subtotal_tax attr_accessor :amount attr_accessor :currency attr_accessor :distributor_fee # Date YYYY-MM-DD HH:MM:SS attr_accessor :created_date attr_accessor :created_ip attr_accessor :payment_html attr_accessor :payment_language attr_accessor :payment_post_url attr_accessor :payment_post_data_url attr_accessor :payment_accepted_url attr_accessor :payment_waiting_url attr_accessor :payment_refused_url attr_accessor :payment_canceled_url attr_accessor :payment_exception_url attr_accessor :iban_fullname attr_accessor :iban_id attr_accessor :iban_bic attr_accessor :iban_tx_end_to_end_id attr_accessor :iban_tx_id attr_accessor :refund_amount attr_accessor :total_rows attr_accessor :forward_url # Date YYYY-MM-DD attr_accessor :payin_date attr_accessor :mandate_id attr_accessor :creditor_name attr_accessor :creditor_address_line attr_accessor :creditor_country attr_accessor :creditor_iban attr_accessor :creditor_bic attr_accessor :virtual_iban_id attr_accessor :virtual_iban_reference class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values def initialize(datatype, allowable_values) @allowable_values = allowable_values.map do |value| case datatype.to_s when /Integer/i value.to_i when /Float/i value.to_f else value end end end def valid?(value) !value || allowable_values.include?(value) end end # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'payin_id' => :'payinId', :'payin_tag' => :'payinTag', :'payin_status' => :'payinStatus', :'code_status' => :'codeStatus', :'information_status' => :'informationStatus', :'wallet_id' => :'walletId', :'user_id' => :'userId', :'cart_id' => :'cartId', :'wallet_event_name' => :'walletEventName', :'wallet_alias' => :'walletAlias', :'user_firstname' => :'userFirstname', :'user_lastname' => :'userLastname', :'message_to_user' => :'messageToUser', :'payment_method_id' => :'paymentMethodId', :'subtotal_items' => :'subtotalItems', :'subtotal_services' => :'subtotalServices', :'subtotal_tax' => :'subtotalTax', :'amount' => :'amount', :'currency' => :'currency', :'distributor_fee' => :'distributorFee', :'created_date' => :'createdDate', :'created_ip' => :'createdIp', :'payment_html' => :'paymentHtml', :'payment_language' => :'paymentLanguage', :'payment_post_url' => :'paymentPostUrl', :'payment_post_data_url' => :'paymentPostDataUrl', :'payment_accepted_url' => :'paymentAcceptedUrl', :'payment_waiting_url' => :'paymentWaitingUrl', :'payment_refused_url' => :'paymentRefusedUrl', :'payment_canceled_url' => :'paymentCanceledUrl', :'payment_exception_url' => :'paymentExceptionUrl', :'iban_fullname' => :'ibanFullname', :'iban_id' => :'ibanId', :'iban_bic' => :'ibanBic', :'iban_tx_end_to_end_id' => :'ibanTxEndToEndId', :'iban_tx_id' => :'ibanTxId', :'refund_amount' => :'refundAmount', :'total_rows' => :'totalRows', :'forward_url' => :'forwardUrl', :'payin_date' => :'payinDate', :'mandate_id' => :'mandateId', :'creditor_name' => :'creditorName', :'creditor_address_line' => :'creditorAddressLine', :'creditor_country' => :'creditorCountry', :'creditor_iban' => :'creditorIban', :'creditor_bic' => :'creditorBIC', :'virtual_iban_id' => :'virtualIbanId', :'virtual_iban_reference' => :'virtualIbanReference' } end # Attribute type mapping. def self.swagger_types { :'payin_id' => :'Integer', :'payin_tag' => :'String', :'payin_status' => :'String', :'code_status' => :'Integer', :'information_status' => :'String', :'wallet_id' => :'Integer', :'user_id' => :'Integer', :'cart_id' => :'Integer', :'wallet_event_name' => :'String', :'wallet_alias' => :'String', :'user_firstname' => :'String', :'user_lastname' => :'String', :'message_to_user' => :'String', :'payment_method_id' => :'Integer', :'subtotal_items' => :'String', :'subtotal_services' => :'String', :'subtotal_tax' => :'String', :'amount' => :'String', :'currency' => :'String', :'distributor_fee' => :'String', :'created_date' => :'String', :'created_ip' => :'String', :'payment_html' => :'String', :'payment_language' => :'String', :'payment_post_url' => :'String', :'payment_post_data_url' => :'String', :'payment_accepted_url' => :'String', :'payment_waiting_url' => :'String', :'payment_refused_url' => :'String', :'payment_canceled_url' => :'String', :'payment_exception_url' => :'String', :'iban_fullname' => :'String', :'iban_id' => :'String', :'iban_bic' => :'String', :'iban_tx_end_to_end_id' => :'String', :'iban_tx_id' => :'String', :'refund_amount' => :'String', :'total_rows' => :'Integer', :'forward_url' => :'String', :'payin_date' => :'String', :'mandate_id' => :'Integer', :'creditor_name' => :'String', :'creditor_address_line' => :'String', :'creditor_country' => :'String', :'creditor_iban' => :'String', :'creditor_bic' => :'String', :'virtual_iban_id' => :'Integer', :'virtual_iban_reference' => :'String' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'payinId') self.payin_id = attributes[:'payinId'] end if attributes.has_key?(:'payinTag') self.payin_tag = attributes[:'payinTag'] end if attributes.has_key?(:'payinStatus') self.payin_status = attributes[:'payinStatus'] end if attributes.has_key?(:'codeStatus') self.code_status = attributes[:'codeStatus'] end if attributes.has_key?(:'informationStatus') self.information_status = attributes[:'informationStatus'] end if attributes.has_key?(:'walletId') self.wallet_id = attributes[:'walletId'] end if attributes.has_key?(:'userId') self.user_id = attributes[:'userId'] end if attributes.has_key?(:'cartId') self.cart_id = attributes[:'cartId'] end if attributes.has_key?(:'walletEventName') self.wallet_event_name = attributes[:'walletEventName'] end if attributes.has_key?(:'walletAlias') self.wallet_alias = attributes[:'walletAlias'] end if attributes.has_key?(:'userFirstname') self.user_firstname = attributes[:'userFirstname'] end if attributes.has_key?(:'userLastname') self.user_lastname = attributes[:'userLastname'] end if attributes.has_key?(:'messageToUser') self.message_to_user = attributes[:'messageToUser'] end if attributes.has_key?(:'paymentMethodId') self.payment_method_id = attributes[:'paymentMethodId'] end if attributes.has_key?(:'subtotalItems') self.subtotal_items = attributes[:'subtotalItems'] end if attributes.has_key?(:'subtotalServices') self.subtotal_services = attributes[:'subtotalServices'] end if attributes.has_key?(:'subtotalTax') self.subtotal_tax = attributes[:'subtotalTax'] end if attributes.has_key?(:'amount') self.amount = attributes[:'amount'] end if attributes.has_key?(:'currency') self.currency = attributes[:'currency'] end if attributes.has_key?(:'distributorFee') self.distributor_fee = attributes[:'distributorFee'] end if attributes.has_key?(:'createdDate') self.created_date = attributes[:'createdDate'] end if attributes.has_key?(:'createdIp') self.created_ip = attributes[:'createdIp'] end if attributes.has_key?(:'paymentHtml') self.payment_html = attributes[:'paymentHtml'] end if attributes.has_key?(:'paymentLanguage') self.payment_language = attributes[:'paymentLanguage'] end if attributes.has_key?(:'paymentPostUrl') self.payment_post_url = attributes[:'paymentPostUrl'] end if attributes.has_key?(:'paymentPostDataUrl') self.payment_post_data_url = attributes[:'paymentPostDataUrl'] end if attributes.has_key?(:'paymentAcceptedUrl') self.payment_accepted_url = attributes[:'paymentAcceptedUrl'] end if attributes.has_key?(:'paymentWaitingUrl') self.payment_waiting_url = attributes[:'paymentWaitingUrl'] end if attributes.has_key?(:'paymentRefusedUrl') self.payment_refused_url = attributes[:'paymentRefusedUrl'] end if attributes.has_key?(:'paymentCanceledUrl') self.payment_canceled_url = attributes[:'paymentCanceledUrl'] end if attributes.has_key?(:'paymentExceptionUrl') self.payment_exception_url = attributes[:'paymentExceptionUrl'] end if attributes.has_key?(:'ibanFullname') self.iban_fullname = attributes[:'ibanFullname'] end if attributes.has_key?(:'ibanId') self.iban_id = attributes[:'ibanId'] end if attributes.has_key?(:'ibanBic') self.iban_bic = attributes[:'ibanBic'] end if attributes.has_key?(:'ibanTxEndToEndId') self.iban_tx_end_to_end_id = attributes[:'ibanTxEndToEndId'] end if attributes.has_key?(:'ibanTxId') self.iban_tx_id = attributes[:'ibanTxId'] end if attributes.has_key?(:'refundAmount') self.refund_amount = attributes[:'refundAmount'] end if attributes.has_key?(:'totalRows') self.total_rows = attributes[:'totalRows'] end if attributes.has_key?(:'forwardUrl') self.forward_url = attributes[:'forwardUrl'] end if attributes.has_key?(:'payinDate') self.payin_date = attributes[:'payinDate'] end if attributes.has_key?(:'mandateId') self.mandate_id = attributes[:'mandateId'] end if attributes.has_key?(:'creditorName') self.creditor_name = attributes[:'creditorName'] end if attributes.has_key?(:'creditorAddressLine') self.creditor_address_line = attributes[:'creditorAddressLine'] end if attributes.has_key?(:'creditorCountry') self.creditor_country = attributes[:'creditorCountry'] end if attributes.has_key?(:'creditorIban') self.creditor_iban = attributes[:'creditorIban'] end if attributes.has_key?(:'creditorBIC') self.creditor_bic = attributes[:'creditorBIC'] end if attributes.has_key?(:'virtualIbanId') self.virtual_iban_id = attributes[:'virtualIbanId'] end if attributes.has_key?(:'virtualIbanReference') self.virtual_iban_reference = attributes[:'virtualIbanReference'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? payin_status_validator = EnumAttributeValidator.new('String', ['PENDING', 'CANCELED', 'VALIDATED']) return false unless payin_status_validator.valid?(@payin_status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] payin_status Object to be assigned def payin_status=(payin_status) validator = EnumAttributeValidator.new('String', ['PENDING', 'CANCELED', 'VALIDATED']) unless validator.valid?(payin_status) fail ArgumentError, 'invalid value for "payin_status", must be one of #{validator.allowable_values}.' end @payin_status = payin_status end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && payin_id == o.payin_id && payin_tag == o.payin_tag && payin_status == o.payin_status && code_status == o.code_status && information_status == o.information_status && wallet_id == o.wallet_id && user_id == o.user_id && cart_id == o.cart_id && wallet_event_name == o.wallet_event_name && wallet_alias == o.wallet_alias && user_firstname == o.user_firstname && user_lastname == o.user_lastname && message_to_user == o.message_to_user && payment_method_id == o.payment_method_id && subtotal_items == o.subtotal_items && subtotal_services == o.subtotal_services && subtotal_tax == o.subtotal_tax && amount == o.amount && currency == o.currency && distributor_fee == o.distributor_fee && created_date == o.created_date && created_ip == o.created_ip && payment_html == o.payment_html && payment_language == o.payment_language && payment_post_url == o.payment_post_url && payment_post_data_url == o.payment_post_data_url && payment_accepted_url == o.payment_accepted_url && payment_waiting_url == o.payment_waiting_url && payment_refused_url == o.payment_refused_url && payment_canceled_url == o.payment_canceled_url && payment_exception_url == o.payment_exception_url && iban_fullname == o.iban_fullname && iban_id == o.iban_id && iban_bic == o.iban_bic && iban_tx_end_to_end_id == o.iban_tx_end_to_end_id && iban_tx_id == o.iban_tx_id && refund_amount == o.refund_amount && total_rows == o.total_rows && forward_url == o.forward_url && payin_date == o.payin_date && mandate_id == o.mandate_id && creditor_name == o.creditor_name && creditor_address_line == o.creditor_address_line && creditor_country == o.creditor_country && creditor_iban == o.creditor_iban && creditor_bic == o.creditor_bic && virtual_iban_id == o.virtual_iban_id && virtual_iban_reference == o.virtual_iban_reference end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash [payin_id, payin_tag, payin_status, code_status, information_status, wallet_id, user_id, cart_id, wallet_event_name, wallet_alias, user_firstname, user_lastname, message_to_user, payment_method_id, subtotal_items, subtotal_services, subtotal_tax, amount, currency, distributor_fee, created_date, created_ip, payment_html, payment_language, payment_post_url, payment_post_data_url, payment_accepted_url, payment_waiting_url, payment_refused_url, payment_canceled_url, payment_exception_url, iban_fullname, iban_id, iban_bic, iban_tx_end_to_end_id, iban_tx_id, refund_amount, total_rows, forward_url, payin_date, mandate_id, creditor_name, creditor_address_line, creditor_country, creditor_iban, creditor_bic, virtual_iban_id, virtual_iban_reference].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the 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 # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data 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 temp_model = TreezorClient.const_get(type).new temp_model.build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash 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 # 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 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 end end