=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 OpenAPI spec version: 2.0.0 Contact: support@ultracart.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.15-SNAPSHOT =end require 'date' module UltracartClient class RotatingTransactionGateway # An array of all currencies known to the UltraCart system and a boolean indicating whether this gateway supports that currency. attr_accessor :additional_native_currency_codes # Advanced feature for canceling an auto order unless the transaction gateway response contains a field with this name. If specified, this field must exist and the value must equal a value in the auto_order_cancel_unless_response_values array attr_accessor :auto_order_cancel_unless_response_name # Advanced feature for canceling an auto order unless the transaction gateway response contains a field with the name specified in auto_order_cancel_unless_response_name. If specified, this field must exist and the value must equal a value in this array. If nothing matches, the auto order is canceled. attr_accessor :auto_order_cancel_unless_response_values # The base currency code for your gateway. For example, USD. attr_accessor :base_currency_code # Optional field specifying a different rotating gateway to use if this gateway fails to process the transaction. attr_accessor :cascade_code # A list of other rotating transaction gateways that can be used as a lookup to assign actions based on failures of this gateway attr_accessor :cascade_codes # The code for the next rotating gateway that should be used when this gateway reaches a daily limit attr_accessor :cascade_daily_auto_order_code # Optional field providing an alternate Charge Appears As value for this rotating gateway attr_accessor :charge_appears_on_statement_as # A human friendly short code used to recognize and differentiate this rotating gateway with other rotating gateways attr_accessor :code # The current daily dollar amount this gateway has processed. Providing this will allow UltraCart to track the monthly amount going forward. attr_accessor :current_daily # The current daily dollar amount of auto orders (recurring) this gateway has processed. Providing this will allow UltraCart to track the monthly amount going forward. attr_accessor :current_daily_auto_order # The current monthly dollar amount this gateway has processed. Providing this will allow UltraCart to track the monthly amount going forward. attr_accessor :current_monthly # The customer service email address for this gateway attr_accessor :customer_service_email # The customer service phone number for this gateway attr_accessor :customer_service_phone # Array containing all 31 (possible) days and any optional restrictions for one or more days. attr_accessor :day_of_month_restrictions # Array containing all seven days of the week and any optional restrictions for one or more days attr_accessor :day_of_week_restrictions # If non-zero, this gateway will be deactivated after reaching this amount of consecutive failures. attr_accessor :deactivate_after_failures # Optional field to specify an absolute date when this gateway should stop accepting transactions attr_accessor :end_date # An array of all transaction gateways, not just the one currently configured for this rotating gateway. This allows for easy switching to another gateway. The enabled property on the transaction gateway indicates which one is actually being used. attr_accessor :gateways # The maximum daily dollar amount this gateway may process attr_accessor :maximum_daily # The maximum daily dollar amount of auto orders (recurring) this gateway may process attr_accessor :maximum_daily_auto_order # The maximum monthly dollar amount this gateway may process. attr_accessor :maximum_monthly # The date and time when this gateway daily limit for auto orders will reset attr_accessor :next_daily_auto_order_reset # The date and time when this gateway daily limit will reset attr_accessor :next_daily_reset # The date and time when this gateway monthly limit will reset attr_accessor :next_monthly_reset # This optional field is combined with order_total_comparison to determine if an order should be processed thorugh this gateway. attr_accessor :order_total # The math operator used to determine if the order total is allowed to process through this gateway. attr_accessor :order_total_comparison # If specified auto orders (rebills) are routed to this rotating gateway. This may be needed because rebills lack a credit card cvv. attr_accessor :rebill_auto_orders_against_this_rtg_code # The number of days that your gateway holds any reserves. This aids in profitability reporting. attr_accessor :reserve_days # The percentage of an order which your gateway is holding in reserve. This aids in profitability reporting. attr_accessor :reserve_percentage # If true, reserves are refunded when an order is refunded. This aids in profitability reporting. attr_accessor :reserve_refunded # An optional date specifying the date up to which your gateway has released all reserve funds. This aids in profitability reporting. attr_accessor :reserves_released_through # Internal identifier used to store and retrieve this gateway information attr_accessor :rotating_transaction_gateway_oid # The name of the currently selected transaction gateway used by this rotating gateway attr_accessor :selected_gateway_name # A boolean used by the builtin UltraCart UI to determine if cascading rtg codes should be shown attr_accessor :show_cascade_codes # A flag to help the UltraCart UI to know whether to show merchant account profiles or not. attr_accessor :show_merchant_account_profiles # Optional field to specify an absolute date when this gateway should begin accepting transactions attr_accessor :start_date # A field used to take a gateway offline without removing/deleting the configuration. Inactive marks the gateway as completely unusable. Standby takes the gateway offline and will not be used unless all other active gateways fail. attr_accessor :status # Optional restrictions by theme/storefront attr_accessor :theme_restrictions # Required field between 0 and 1 that dictates the percentage of traffic that should flow through this gateway attr_accessor :traffic_percentage # If specified, limits the total daily dollar amount of trial orders attr_accessor :trial_daily_amount # If specified, limits the total month count of trial orders attr_accessor :trial_daily_limit # If specified, limits the total month dollar amount of trial orders attr_accessor :trial_monthly_limit 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 { :'additional_native_currency_codes' => :'additional_native_currency_codes', :'auto_order_cancel_unless_response_name' => :'auto_order_cancel_unless_response_name', :'auto_order_cancel_unless_response_values' => :'auto_order_cancel_unless_response_values', :'base_currency_code' => :'base_currency_code', :'cascade_code' => :'cascade_code', :'cascade_codes' => :'cascade_codes', :'cascade_daily_auto_order_code' => :'cascade_daily_auto_order_code', :'charge_appears_on_statement_as' => :'charge_appears_on_statement_as', :'code' => :'code', :'current_daily' => :'current_daily', :'current_daily_auto_order' => :'current_daily_auto_order', :'current_monthly' => :'current_monthly', :'customer_service_email' => :'customer_service_email', :'customer_service_phone' => :'customer_service_phone', :'day_of_month_restrictions' => :'day_of_month_restrictions', :'day_of_week_restrictions' => :'day_of_week_restrictions', :'deactivate_after_failures' => :'deactivate_after_failures', :'end_date' => :'end_date', :'gateways' => :'gateways', :'maximum_daily' => :'maximum_daily', :'maximum_daily_auto_order' => :'maximum_daily_auto_order', :'maximum_monthly' => :'maximum_monthly', :'next_daily_auto_order_reset' => :'next_daily_auto_order_reset', :'next_daily_reset' => :'next_daily_reset', :'next_monthly_reset' => :'next_monthly_reset', :'order_total' => :'order_total', :'order_total_comparison' => :'order_total_comparison', :'rebill_auto_orders_against_this_rtg_code' => :'rebill_auto_orders_against_this_rtg_code', :'reserve_days' => :'reserve_days', :'reserve_percentage' => :'reserve_percentage', :'reserve_refunded' => :'reserve_refunded', :'reserves_released_through' => :'reserves_released_through', :'rotating_transaction_gateway_oid' => :'rotating_transaction_gateway_oid', :'selected_gateway_name' => :'selected_gateway_name', :'show_cascade_codes' => :'show_cascade_codes', :'show_merchant_account_profiles' => :'show_merchant_account_profiles', :'start_date' => :'start_date', :'status' => :'status', :'theme_restrictions' => :'theme_restrictions', :'traffic_percentage' => :'traffic_percentage', :'trial_daily_amount' => :'trial_daily_amount', :'trial_daily_limit' => :'trial_daily_limit', :'trial_monthly_limit' => :'trial_monthly_limit' } end # Attribute type mapping. def self.swagger_types { :'additional_native_currency_codes' => :'Array', :'auto_order_cancel_unless_response_name' => :'String', :'auto_order_cancel_unless_response_values' => :'Array', :'base_currency_code' => :'String', :'cascade_code' => :'String', :'cascade_codes' => :'Array', :'cascade_daily_auto_order_code' => :'String', :'charge_appears_on_statement_as' => :'String', :'code' => :'String', :'current_daily' => :'Float', :'current_daily_auto_order' => :'Float', :'current_monthly' => :'Float', :'customer_service_email' => :'String', :'customer_service_phone' => :'String', :'day_of_month_restrictions' => :'Array', :'day_of_week_restrictions' => :'Array', :'deactivate_after_failures' => :'Integer', :'end_date' => :'String', :'gateways' => :'Array', :'maximum_daily' => :'Float', :'maximum_daily_auto_order' => :'Float', :'maximum_monthly' => :'Float', :'next_daily_auto_order_reset' => :'String', :'next_daily_reset' => :'String', :'next_monthly_reset' => :'String', :'order_total' => :'Float', :'order_total_comparison' => :'String', :'rebill_auto_orders_against_this_rtg_code' => :'String', :'reserve_days' => :'Integer', :'reserve_percentage' => :'Float', :'reserve_refunded' => :'BOOLEAN', :'reserves_released_through' => :'String', :'rotating_transaction_gateway_oid' => :'Integer', :'selected_gateway_name' => :'String', :'show_cascade_codes' => :'BOOLEAN', :'show_merchant_account_profiles' => :'BOOLEAN', :'start_date' => :'String', :'status' => :'String', :'theme_restrictions' => :'Array', :'traffic_percentage' => :'Float', :'trial_daily_amount' => :'Integer', :'trial_daily_limit' => :'Integer', :'trial_monthly_limit' => :'Integer' } 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?(:'additional_native_currency_codes') if (value = attributes[:'additional_native_currency_codes']).is_a?(Array) self.additional_native_currency_codes = value end end if attributes.has_key?(:'auto_order_cancel_unless_response_name') self.auto_order_cancel_unless_response_name = attributes[:'auto_order_cancel_unless_response_name'] end if attributes.has_key?(:'auto_order_cancel_unless_response_values') if (value = attributes[:'auto_order_cancel_unless_response_values']).is_a?(Array) self.auto_order_cancel_unless_response_values = value end end if attributes.has_key?(:'base_currency_code') self.base_currency_code = attributes[:'base_currency_code'] end if attributes.has_key?(:'cascade_code') self.cascade_code = attributes[:'cascade_code'] end if attributes.has_key?(:'cascade_codes') if (value = attributes[:'cascade_codes']).is_a?(Array) self.cascade_codes = value end end if attributes.has_key?(:'cascade_daily_auto_order_code') self.cascade_daily_auto_order_code = attributes[:'cascade_daily_auto_order_code'] end if attributes.has_key?(:'charge_appears_on_statement_as') self.charge_appears_on_statement_as = attributes[:'charge_appears_on_statement_as'] end if attributes.has_key?(:'code') self.code = attributes[:'code'] end if attributes.has_key?(:'current_daily') self.current_daily = attributes[:'current_daily'] end if attributes.has_key?(:'current_daily_auto_order') self.current_daily_auto_order = attributes[:'current_daily_auto_order'] end if attributes.has_key?(:'current_monthly') self.current_monthly = attributes[:'current_monthly'] end if attributes.has_key?(:'customer_service_email') self.customer_service_email = attributes[:'customer_service_email'] end if attributes.has_key?(:'customer_service_phone') self.customer_service_phone = attributes[:'customer_service_phone'] end if attributes.has_key?(:'day_of_month_restrictions') if (value = attributes[:'day_of_month_restrictions']).is_a?(Array) self.day_of_month_restrictions = value end end if attributes.has_key?(:'day_of_week_restrictions') if (value = attributes[:'day_of_week_restrictions']).is_a?(Array) self.day_of_week_restrictions = value end end if attributes.has_key?(:'deactivate_after_failures') self.deactivate_after_failures = attributes[:'deactivate_after_failures'] end if attributes.has_key?(:'end_date') self.end_date = attributes[:'end_date'] end if attributes.has_key?(:'gateways') if (value = attributes[:'gateways']).is_a?(Array) self.gateways = value end end if attributes.has_key?(:'maximum_daily') self.maximum_daily = attributes[:'maximum_daily'] end if attributes.has_key?(:'maximum_daily_auto_order') self.maximum_daily_auto_order = attributes[:'maximum_daily_auto_order'] end if attributes.has_key?(:'maximum_monthly') self.maximum_monthly = attributes[:'maximum_monthly'] end if attributes.has_key?(:'next_daily_auto_order_reset') self.next_daily_auto_order_reset = attributes[:'next_daily_auto_order_reset'] end if attributes.has_key?(:'next_daily_reset') self.next_daily_reset = attributes[:'next_daily_reset'] end if attributes.has_key?(:'next_monthly_reset') self.next_monthly_reset = attributes[:'next_monthly_reset'] end if attributes.has_key?(:'order_total') self.order_total = attributes[:'order_total'] end if attributes.has_key?(:'order_total_comparison') self.order_total_comparison = attributes[:'order_total_comparison'] end if attributes.has_key?(:'rebill_auto_orders_against_this_rtg_code') self.rebill_auto_orders_against_this_rtg_code = attributes[:'rebill_auto_orders_against_this_rtg_code'] end if attributes.has_key?(:'reserve_days') self.reserve_days = attributes[:'reserve_days'] end if attributes.has_key?(:'reserve_percentage') self.reserve_percentage = attributes[:'reserve_percentage'] end if attributes.has_key?(:'reserve_refunded') self.reserve_refunded = attributes[:'reserve_refunded'] end if attributes.has_key?(:'reserves_released_through') self.reserves_released_through = attributes[:'reserves_released_through'] end if attributes.has_key?(:'rotating_transaction_gateway_oid') self.rotating_transaction_gateway_oid = attributes[:'rotating_transaction_gateway_oid'] end if attributes.has_key?(:'selected_gateway_name') self.selected_gateway_name = attributes[:'selected_gateway_name'] end if attributes.has_key?(:'show_cascade_codes') self.show_cascade_codes = attributes[:'show_cascade_codes'] end if attributes.has_key?(:'show_merchant_account_profiles') self.show_merchant_account_profiles = attributes[:'show_merchant_account_profiles'] end if attributes.has_key?(:'start_date') self.start_date = attributes[:'start_date'] end if attributes.has_key?(:'status') self.status = attributes[:'status'] end if attributes.has_key?(:'theme_restrictions') if (value = attributes[:'theme_restrictions']).is_a?(Array) self.theme_restrictions = value end end if attributes.has_key?(:'traffic_percentage') self.traffic_percentage = attributes[:'traffic_percentage'] end if attributes.has_key?(:'trial_daily_amount') self.trial_daily_amount = attributes[:'trial_daily_amount'] end if attributes.has_key?(:'trial_daily_limit') self.trial_daily_limit = attributes[:'trial_daily_limit'] end if attributes.has_key?(:'trial_monthly_limit') self.trial_monthly_limit = attributes[:'trial_monthly_limit'] 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? order_total_comparison_validator = EnumAttributeValidator.new('String', ['<', '<=', '=', '>', '>=']) return false unless order_total_comparison_validator.valid?(@order_total_comparison) status_validator = EnumAttributeValidator.new('String', ['active', 'inactive', 'standby']) return false unless status_validator.valid?(@status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] order_total_comparison Object to be assigned def order_total_comparison=(order_total_comparison) validator = EnumAttributeValidator.new('String', ['<', '<=', '=', '>', '>=']) unless validator.valid?(order_total_comparison) fail ArgumentError, 'invalid value for "order_total_comparison", must be one of #{validator.allowable_values}.' end @order_total_comparison = order_total_comparison end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ['active', 'inactive', 'standby']) unless validator.valid?(status) fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.' end @status = 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 && additional_native_currency_codes == o.additional_native_currency_codes && auto_order_cancel_unless_response_name == o.auto_order_cancel_unless_response_name && auto_order_cancel_unless_response_values == o.auto_order_cancel_unless_response_values && base_currency_code == o.base_currency_code && cascade_code == o.cascade_code && cascade_codes == o.cascade_codes && cascade_daily_auto_order_code == o.cascade_daily_auto_order_code && charge_appears_on_statement_as == o.charge_appears_on_statement_as && code == o.code && current_daily == o.current_daily && current_daily_auto_order == o.current_daily_auto_order && current_monthly == o.current_monthly && customer_service_email == o.customer_service_email && customer_service_phone == o.customer_service_phone && day_of_month_restrictions == o.day_of_month_restrictions && day_of_week_restrictions == o.day_of_week_restrictions && deactivate_after_failures == o.deactivate_after_failures && end_date == o.end_date && gateways == o.gateways && maximum_daily == o.maximum_daily && maximum_daily_auto_order == o.maximum_daily_auto_order && maximum_monthly == o.maximum_monthly && next_daily_auto_order_reset == o.next_daily_auto_order_reset && next_daily_reset == o.next_daily_reset && next_monthly_reset == o.next_monthly_reset && order_total == o.order_total && order_total_comparison == o.order_total_comparison && rebill_auto_orders_against_this_rtg_code == o.rebill_auto_orders_against_this_rtg_code && reserve_days == o.reserve_days && reserve_percentage == o.reserve_percentage && reserve_refunded == o.reserve_refunded && reserves_released_through == o.reserves_released_through && rotating_transaction_gateway_oid == o.rotating_transaction_gateway_oid && selected_gateway_name == o.selected_gateway_name && show_cascade_codes == o.show_cascade_codes && show_merchant_account_profiles == o.show_merchant_account_profiles && start_date == o.start_date && status == o.status && theme_restrictions == o.theme_restrictions && traffic_percentage == o.traffic_percentage && trial_daily_amount == o.trial_daily_amount && trial_daily_limit == o.trial_daily_limit && trial_monthly_limit == o.trial_monthly_limit 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 [additional_native_currency_codes, auto_order_cancel_unless_response_name, auto_order_cancel_unless_response_values, base_currency_code, cascade_code, cascade_codes, cascade_daily_auto_order_code, charge_appears_on_statement_as, code, current_daily, current_daily_auto_order, current_monthly, customer_service_email, customer_service_phone, day_of_month_restrictions, day_of_week_restrictions, deactivate_after_failures, end_date, gateways, maximum_daily, maximum_daily_auto_order, maximum_monthly, next_daily_auto_order_reset, next_daily_reset, next_monthly_reset, order_total, order_total_comparison, rebill_auto_orders_against_this_rtg_code, reserve_days, reserve_percentage, reserve_refunded, reserves_released_through, rotating_transaction_gateway_oid, selected_gateway_name, show_cascade_codes, show_merchant_account_profiles, start_date, status, theme_restrictions, traffic_percentage, trial_daily_amount, trial_daily_limit, trial_monthly_limit].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 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<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+?), (?.+)>\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 = UltracartClient.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