=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 PaymentsConfigurationPayPal # Master flag that determine if PayPal is an active payment for this account attr_accessor :accept_paypal # Optional accounting code that is set to Quickbooks when an order uses this payment method. attr_accessor :accounting_code # PayPal API password attr_accessor :api_password # PayPal API username attr_accessor :api_username # (Legacy) true if there is a PayPal certificate already on file. Used to manage the internal UI attr_accessor :certificate_on_file # The account to deposit funds attr_accessor :deposit_to_account # The main PayPal email address attr_accessor :email # PayPal configuration, live or sandbox attr_accessor :environment # The URL for the PayPal header attr_accessor :header_image_url # True if the Bill Me Later button should be hidden during checkout attr_accessor :hide_bill_me_later # True if the PayPal express checkout button should be hidden on the view cart page. This will force the customer to enter address information before being able to checkout with PayPal attr_accessor :hide_express_checkout_on_view_cart # True if PayPal should be hidden for orders with no shippable product, such as digital orders attr_accessor :hide_for_unshipped_orders # If true, PayPal orders are held in Accounts Receivable for review attr_accessor :hold_in_ar # PayPal landing page attr_accessor :landing_page # The PayPal mode attr_accessor :mode # PayPal API private key password attr_accessor :private_key_password # Optional additional fee to charge if PayPal is used. It is rare for this to be used. attr_accessor :processing_fee # The processing percentage charged by PayPal attr_accessor :processing_percentage # True if the internal UI should recommend opening a PayPal account attr_accessor :push_paypal attr_accessor :restrictions # True if UltraCart should send recurring orders to PayPal. There are restrictions to what PayPal will accept for recurring orders. Be careful. attr_accessor :send_recurring # Short marketing text attr_accessor :short_paypal_marketing_text # internal ui flag attr_accessor :show_card_logos_not_directly_supported # Internal flag used to manage UI attr_accessor :show_signature # PayPal signature attr_accessor :signature # PayPal solution type attr_accessor :solution_type # The email where PayPal summaries should be sent attr_accessor :summary_email # Description of what mode PayPal is operating attr_accessor :summary_mode # Send free items to PayPal as one cent items and subtract this penny from shipping. PayPal does not allow the sale of free items. attr_accessor :zero_dollar_penny 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 { :'accept_paypal' => :'accept_paypal', :'accounting_code' => :'accounting_code', :'api_password' => :'api_password', :'api_username' => :'api_username', :'certificate_on_file' => :'certificate_on_file', :'deposit_to_account' => :'deposit_to_account', :'email' => :'email', :'environment' => :'environment', :'header_image_url' => :'header_image_url', :'hide_bill_me_later' => :'hide_bill_me_later', :'hide_express_checkout_on_view_cart' => :'hide_express_checkout_on_view_cart', :'hide_for_unshipped_orders' => :'hide_for_unshipped_orders', :'hold_in_ar' => :'hold_in_ar', :'landing_page' => :'landing_page', :'mode' => :'mode', :'private_key_password' => :'private_key_password', :'processing_fee' => :'processing_fee', :'processing_percentage' => :'processing_percentage', :'push_paypal' => :'push_paypal', :'restrictions' => :'restrictions', :'send_recurring' => :'send_recurring', :'short_paypal_marketing_text' => :'short_paypal_marketing_text', :'show_card_logos_not_directly_supported' => :'show_card_logos_not_directly_supported', :'show_signature' => :'show_signature', :'signature' => :'signature', :'solution_type' => :'solution_type', :'summary_email' => :'summary_email', :'summary_mode' => :'summary_mode', :'zero_dollar_penny' => :'zero_dollar_penny' } end # Attribute type mapping. def self.swagger_types { :'accept_paypal' => :'BOOLEAN', :'accounting_code' => :'String', :'api_password' => :'String', :'api_username' => :'String', :'certificate_on_file' => :'BOOLEAN', :'deposit_to_account' => :'String', :'email' => :'String', :'environment' => :'String', :'header_image_url' => :'String', :'hide_bill_me_later' => :'BOOLEAN', :'hide_express_checkout_on_view_cart' => :'BOOLEAN', :'hide_for_unshipped_orders' => :'BOOLEAN', :'hold_in_ar' => :'BOOLEAN', :'landing_page' => :'String', :'mode' => :'String', :'private_key_password' => :'String', :'processing_fee' => :'String', :'processing_percentage' => :'String', :'push_paypal' => :'BOOLEAN', :'restrictions' => :'PaymentsConfigurationRestrictions', :'send_recurring' => :'BOOLEAN', :'short_paypal_marketing_text' => :'BOOLEAN', :'show_card_logos_not_directly_supported' => :'BOOLEAN', :'show_signature' => :'BOOLEAN', :'signature' => :'String', :'solution_type' => :'String', :'summary_email' => :'String', :'summary_mode' => :'String', :'zero_dollar_penny' => :'BOOLEAN' } 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?(:'accept_paypal') self.accept_paypal = attributes[:'accept_paypal'] end if attributes.has_key?(:'accounting_code') self.accounting_code = attributes[:'accounting_code'] end if attributes.has_key?(:'api_password') self.api_password = attributes[:'api_password'] end if attributes.has_key?(:'api_username') self.api_username = attributes[:'api_username'] end if attributes.has_key?(:'certificate_on_file') self.certificate_on_file = attributes[:'certificate_on_file'] end if attributes.has_key?(:'deposit_to_account') self.deposit_to_account = attributes[:'deposit_to_account'] end if attributes.has_key?(:'email') self.email = attributes[:'email'] end if attributes.has_key?(:'environment') self.environment = attributes[:'environment'] end if attributes.has_key?(:'header_image_url') self.header_image_url = attributes[:'header_image_url'] end if attributes.has_key?(:'hide_bill_me_later') self.hide_bill_me_later = attributes[:'hide_bill_me_later'] end if attributes.has_key?(:'hide_express_checkout_on_view_cart') self.hide_express_checkout_on_view_cart = attributes[:'hide_express_checkout_on_view_cart'] end if attributes.has_key?(:'hide_for_unshipped_orders') self.hide_for_unshipped_orders = attributes[:'hide_for_unshipped_orders'] end if attributes.has_key?(:'hold_in_ar') self.hold_in_ar = attributes[:'hold_in_ar'] end if attributes.has_key?(:'landing_page') self.landing_page = attributes[:'landing_page'] end if attributes.has_key?(:'mode') self.mode = attributes[:'mode'] end if attributes.has_key?(:'private_key_password') self.private_key_password = attributes[:'private_key_password'] end if attributes.has_key?(:'processing_fee') self.processing_fee = attributes[:'processing_fee'] end if attributes.has_key?(:'processing_percentage') self.processing_percentage = attributes[:'processing_percentage'] end if attributes.has_key?(:'push_paypal') self.push_paypal = attributes[:'push_paypal'] end if attributes.has_key?(:'restrictions') self.restrictions = attributes[:'restrictions'] end if attributes.has_key?(:'send_recurring') self.send_recurring = attributes[:'send_recurring'] end if attributes.has_key?(:'short_paypal_marketing_text') self.short_paypal_marketing_text = attributes[:'short_paypal_marketing_text'] end if attributes.has_key?(:'show_card_logos_not_directly_supported') self.show_card_logos_not_directly_supported = attributes[:'show_card_logos_not_directly_supported'] end if attributes.has_key?(:'show_signature') self.show_signature = attributes[:'show_signature'] end if attributes.has_key?(:'signature') self.signature = attributes[:'signature'] end if attributes.has_key?(:'solution_type') self.solution_type = attributes[:'solution_type'] end if attributes.has_key?(:'summary_email') self.summary_email = attributes[:'summary_email'] end if attributes.has_key?(:'summary_mode') self.summary_mode = attributes[:'summary_mode'] end if attributes.has_key?(:'zero_dollar_penny') self.zero_dollar_penny = attributes[:'zero_dollar_penny'] 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? environment_validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox']) return false unless environment_validator.valid?(@environment) landing_page_validator = EnumAttributeValidator.new('String', ['Billing', 'Login']) return false unless landing_page_validator.valid?(@landing_page) mode_validator = EnumAttributeValidator.new('String', ['WPPECO', 'WPPECDP']) return false unless mode_validator.valid?(@mode) solution_type_validator = EnumAttributeValidator.new('String', ['Sole', 'Mark']) return false unless solution_type_validator.valid?(@solution_type) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] environment Object to be assigned def environment=(environment) validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox']) unless validator.valid?(environment) fail ArgumentError, 'invalid value for "environment", must be one of #{validator.allowable_values}.' end @environment = environment end # Custom attribute writer method checking allowed values (enum). # @param [Object] landing_page Object to be assigned def landing_page=(landing_page) validator = EnumAttributeValidator.new('String', ['Billing', 'Login']) unless validator.valid?(landing_page) fail ArgumentError, 'invalid value for "landing_page", must be one of #{validator.allowable_values}.' end @landing_page = landing_page end # Custom attribute writer method checking allowed values (enum). # @param [Object] mode Object to be assigned def mode=(mode) validator = EnumAttributeValidator.new('String', ['WPPECO', 'WPPECDP']) unless validator.valid?(mode) fail ArgumentError, 'invalid value for "mode", must be one of #{validator.allowable_values}.' end @mode = mode end # Custom attribute writer method checking allowed values (enum). # @param [Object] solution_type Object to be assigned def solution_type=(solution_type) validator = EnumAttributeValidator.new('String', ['Sole', 'Mark']) unless validator.valid?(solution_type) fail ArgumentError, 'invalid value for "solution_type", must be one of #{validator.allowable_values}.' end @solution_type = solution_type 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 && accept_paypal == o.accept_paypal && accounting_code == o.accounting_code && api_password == o.api_password && api_username == o.api_username && certificate_on_file == o.certificate_on_file && deposit_to_account == o.deposit_to_account && email == o.email && environment == o.environment && header_image_url == o.header_image_url && hide_bill_me_later == o.hide_bill_me_later && hide_express_checkout_on_view_cart == o.hide_express_checkout_on_view_cart && hide_for_unshipped_orders == o.hide_for_unshipped_orders && hold_in_ar == o.hold_in_ar && landing_page == o.landing_page && mode == o.mode && private_key_password == o.private_key_password && processing_fee == o.processing_fee && processing_percentage == o.processing_percentage && push_paypal == o.push_paypal && restrictions == o.restrictions && send_recurring == o.send_recurring && short_paypal_marketing_text == o.short_paypal_marketing_text && show_card_logos_not_directly_supported == o.show_card_logos_not_directly_supported && show_signature == o.show_signature && signature == o.signature && solution_type == o.solution_type && summary_email == o.summary_email && summary_mode == o.summary_mode && zero_dollar_penny == o.zero_dollar_penny 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 [accept_paypal, accounting_code, api_password, api_username, certificate_on_file, deposit_to_account, email, environment, header_image_url, hide_bill_me_later, hide_express_checkout_on_view_cart, hide_for_unshipped_orders, hold_in_ar, landing_page, mode, private_key_password, processing_fee, processing_percentage, push_paypal, restrictions, send_recurring, short_paypal_marketing_text, show_card_logos_not_directly_supported, show_signature, signature, solution_type, summary_email, summary_mode, zero_dollar_penny].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