Class: ActiveMerchant::Billing::OrbitalSoftDescriptors

Inherits:
Object
  • Object
show all
Includes:
Validateable
Defined in:
lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb

Constant Summary collapse

PHONE_FORMAT_1 =
/\A\d{3}-\d{3}-\d{4}\z/
PHONE_FORMAT_2 =
/\A\d{3}-\w{7}\z/

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validateable

#errors, #valid?

Constructor Details

#initialize(options = {}) ⇒ OrbitalSoftDescriptors

Returns a new instance of OrbitalSoftDescriptors.



21
22
23
24
25
26
27
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 21

def initialize(options = {})
  self.merchant_name = options[:merchant_name]
  self.merchant_city = options[:merchant_city]
  self.merchant_phone = options[:merchant_phone]
  self.merchant_url = options[:merchant_url]
  self.merchant_email = options[:merchant_email]
end

Instance Attribute Details

#merchant_cityObject

Unlike Salem, the only value that gets passed on the cardholder statement is the Merchant Name field.

And for these customers, it is a maximum of 25 bytes of data.

All other Soft Descriptor fields can optionally be sent, but will not be submitted to the settlement host and will not display on the cardholder statement.



19
20
21
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 19

def merchant_city
  @merchant_city
end

#merchant_emailObject

Unlike Salem, the only value that gets passed on the cardholder statement is the Merchant Name field.

And for these customers, it is a maximum of 25 bytes of data.

All other Soft Descriptor fields can optionally be sent, but will not be submitted to the settlement host and will not display on the cardholder statement.



19
20
21
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 19

def merchant_email
  @merchant_email
end

#merchant_nameObject

Unlike Salem, the only value that gets passed on the cardholder statement is the Merchant Name field.

And for these customers, it is a maximum of 25 bytes of data.

All other Soft Descriptor fields can optionally be sent, but will not be submitted to the settlement host and will not display on the cardholder statement.



19
20
21
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 19

def merchant_name
  @merchant_name
end

#merchant_phoneObject

Unlike Salem, the only value that gets passed on the cardholder statement is the Merchant Name field.

And for these customers, it is a maximum of 25 bytes of data.

All other Soft Descriptor fields can optionally be sent, but will not be submitted to the settlement host and will not display on the cardholder statement.



19
20
21
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 19

def merchant_phone
  @merchant_phone
end

#merchant_urlObject

Unlike Salem, the only value that gets passed on the cardholder statement is the Merchant Name field.

And for these customers, it is a maximum of 25 bytes of data.

All other Soft Descriptor fields can optionally be sent, but will not be submitted to the settlement host and will not display on the cardholder statement.



19
20
21
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 19

def merchant_url
  @merchant_url
end

#product_descriptionObject

Unlike Salem, the only value that gets passed on the cardholder statement is the Merchant Name field.

And for these customers, it is a maximum of 25 bytes of data.

All other Soft Descriptor fields can optionally be sent, but will not be submitted to the settlement host and will not display on the cardholder statement.



19
20
21
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 19

def product_description
  @product_description
end

Instance Method Details

#validateObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 29

def validate
  errors.add(:merchant_name, "is required") if self.merchant_name.blank?
  errors.add(:merchant_name, "is required to be 25 bytes or less") if self.merchant_name.bytesize > 25
  
  unless self.merchant_phone.blank? || self.merchant_phone.match(PHONE_FORMAT_1) || self.merchant_phone.match(PHONE_FORMAT_2)
    errors.add(:merchant_phone, "is required to follow \"NNN-NNN-NNNN\" or \"NNN-AAAAAAA\" format")
  end
  
  [:merchant_email, :merchant_url].each do |attr|
    unless self.send(attr).blank?
      errors.add(attr, "is required to be 13 bytes or less") if self.send(attr).bytesize > 13
    end
  end
end