class Minfraud::Components::Order
Order
corresponds to the order object of a minFraud request.
Attributes
The ID of the affiliate where the order is coming from. No specific format is required.
@return [String, nil]
The total order amount for the transaction before taxes and discounts. The value must be at least 0 and at most 1e14 - 1.
@return [Float, nil]
The ISO 4217 currency code for the currency used in the transaction.
@see en.wikipedia.org/wiki/ISO_4217
@return [String, nil]
The discount code applied to the transaction. If multiple discount codes are used, please separate them with a comma.
@return [String, nil]
Whether the purchaser included a gift message.
@return [Boolean, nil]
Whether order was marked as a gift by the purchaser.
@return [Boolean, nil]
The URI of the referring site for this order. Needs to be absolute and have a URI scheme such as https://
.
@return [String, nil]
The ID of the sub-affiliate where the order is coming from. No specific format is required.
@return [String, nil]
Public Class Methods
@param params [Hash] Hash of parameters. Each key/value should
correspond to one of the available attributes.
# File lib/minfraud/components/order.rb, line 60 def initialize(params = {}) @amount = params[:amount] @has_gift_message = params[:has_gift_message] @affiliate_id = params[:affiliate_id] @subaffiliate_id = params[:subaffiliate_id] @currency = params[:currency] @discount_code = params[:discount_code] @referrer_uri = params[:referrer_uri] @is_gift = params[:is_gift] validate end
Private Instance Methods
# File lib/minfraud/components/order.rb, line 75 def validate return if !Minfraud.enable_validation validate_nonnegative_number('amount', @amount) validate_boolean('has_gift_message', @has_gift_message) validate_string('affiliate_id', 255, @affiliate_id) validate_string('subaffiliate_id', 255, @subaffiliate_id) validate_regex('currency', /\A[A-Z]{3}\z/, @currency) validate_string('discount_code', 255, @discount_code) validate_uri('referrer_uri', @referrer_uri) validate_boolean('is_gift', @is_gift) end