Sha256: df28ff8cf6f10ec2ad305550b20884bc2780908b8086bba5dc410b2e6eb4f9b7

Contents?: true

Size: 1.64 KB

Versions: 5

Compression:

Stored size: 1.64 KB

Contents

module ShipCompliant
  # == ShipCompliant::CheckCompliance
  #
  # The CheckComplianceOfSalesOrderWithAddressValidation API method is used for
  # real time compliance checks from the order point of entry (eCommerce, POS).  
  #
  # The method can do three things in one call:
  #
  # - Calculate Sales Tax Due for order and return product level tax rates
  #   (IncludeSalesTaxRates = true)
  # - Validate the ShipTo address and get normalized address result
  # - Check compliance of the order
  #  
  # This method takes requires specific order information from the order point
  # of entry for ShipCompliant to check the order for compliance.  The sales
  # order will not be committed via this method.  This API call is usually
  # paired with CommitSalesOrder() to save the sales order to ShipCompliant.
  #
  # Look at the following example request: http://git.io/xMNOvw
  class CheckCompliance

    # Checks the compliance of a sales order from the data specified.
    #
    # An example of all the required fields can be seen here: http://git.io/xMNOvw
    #
    #   ShipCompliant::CheckCompliance.of_sales_order({
    #     address_option: {
    #       ignore_street_level_errors: true,
    #       reject_if_address_suggested: 'false' # Savon bug? Passes the value as an attribute when a boolean
    #     },
    #     include_sales_tax_rates: true,
    #     # ...
    #   })
    def self.of_sales_order(data)
      camel_cased_keys = data.deep_transform_keys { |key| key.to_s.camelize }
      result = ShipCompliant.client.call(:check_compliance_of_sales_order_with_address_validation, camel_cased_keys)
      CheckComplianceResult.new(result)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ship_compliant-0.2.1 lib/ship_compliant/check_compliance.rb
ship_compliant-0.2.0 lib/ship_compliant/check_compliance.rb
ship_compliant-0.1.2 lib/ship_compliant/check_compliance.rb
ship_compliant-0.1.1 lib/ship_compliant/check_compliance.rb
ship_compliant-0.1.0 lib/ship_compliant/check_compliance.rb