Class: ActiveMerchant::Billing::OrbitalSoftDescriptors

Inherits:
Model
  • Object
show all
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 Compatibility::Model

#errors, #valid?

Constructor Details

#initialize(options = {}) ⇒ OrbitalSoftDescriptors

Returns a new instance of OrbitalSoftDescriptors.



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

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.



17
18
19
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 17

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.



17
18
19
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 17

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.



17
18
19
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 17

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.



17
18
19
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 17

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.



17
18
19
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 17

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.



17
18
19
# File 'lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb', line 17

def product_description
  @product_description
end

Instance Method Details

#validateObject



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

def validate
  errors = []

  errors << [:merchant_name, "is required"] if self.merchant_name.blank?
  errors << [:merchant_name, "is required to be 25 bytes or less"] if self.merchant_name.bytesize > 25

  if(!empty?(self.merchant_phone) && !self.merchant_phone.match(PHONE_FORMAT_1) && !self.merchant_phone.match(PHONE_FORMAT_2))
    errors << [: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 << [attr, "is required to be 13 bytes or less"] if(self.send(attr).bytesize > 13)
    end
  end

  errors_hash(errors)
end