### Home Classes Methods

### In Files

- lib/active_merchant/billing/gateways/barclays_epdq.rb

### Parent

Object

### Methods

- ::new
- #add_consumer
- #add_creditcard
- #add_order_form
- #add_transaction
- #build
- #format_expiry_date
- #to_xml

### Class/Module Index

Quicksearch

- ActiveMerchant
- ActiveMerchant::Billing
- ActiveMerchant::Billing::AVSResult
- ActiveMerchant::Billing::BarclaysEpdqGateway
- ActiveMerchant::Billing::BarclaysEpdqGateway::Document
- ActiveMerchant::Billing::BarclaysEpdqGateway::Parser
- ActiveMerchant::Billing::Base
- ActiveMerchant::Billing::BeanstreamGateway
- ActiveMerchant::Billing::BeanstreamInteracGateway
- ActiveMerchant::Billing::BeanstreamInteracResponse
- ActiveMerchant::Billing::BluePayGateway
- ActiveMerchant::Billing::BogusGateway
- ActiveMerchant::Billing::BraintreeBlueGateway
- ActiveMerchant::Billing::BraintreeGateway
- ActiveMerchant::Billing::BraintreeOrangeGateway
- ActiveMerchant::Billing::CVVResult
- ActiveMerchant::Billing::CardSaveGateway
- ActiveMerchant::Billing::CardStreamGateway
- ActiveMerchant::Billing::Check
- ActiveMerchant::Billing::CreditCard
- ActiveMerchant::Billing::CreditCardFormatting
- ActiveMerchant::Billing::CreditCardMethods
- ActiveMerchant::Billing::CreditCardMethods::ClassMethods
- ActiveMerchant::Billing::CyberSourceGateway
- ActiveMerchant::Billing::DataCashGateway
- ActiveMerchant::Billing::EfsnetGateway
- ActiveMerchant::Billing::ElavonGateway
- ActiveMerchant::Billing::EpayGateway
- ActiveMerchant::Billing::EwayGateway
- ActiveMerchant::Billing::EwayManagedGateway
- ActiveMerchant::Billing::EwayManagedGateway::EwayResponse
- ActiveMerchant::Billing::ExactGateway
- ActiveMerchant::Billing::FederatedCanadaGateway
- ActiveMerchant::Billing::FirstPayGateway
- ActiveMerchant::Billing::FirstPayGateway::FirstPayPostData
- ActiveMerchant::Billing::GarantiGateway
- ActiveMerchant::Billing::Gateway
- ActiveMerchant::Billing::IdealBaseGateway
- ActiveMerchant::Billing::IdealRabobankGateway
- ActiveMerchant::Billing::IdealResponse
- ActiveMerchant::Billing::InspireGateway
- ActiveMerchant::Billing::InstapayGateway
- ActiveMerchant::Billing::Integrations
- ActiveMerchant::Billing::Integrations::ActionViewHelper
- ActiveMerchant::Billing::Integrations::Bogus
- ActiveMerchant::Billing::Integrations::Bogus::Helper
- ActiveMerchant::Billing::Integrations::Bogus::Notification
- ActiveMerchant::Billing::Integrations::Bogus::Return
- ActiveMerchant::Billing::Integrations::Chronopay
- ActiveMerchant::Billing::Integrations::Chronopay::Helper
- ActiveMerchant::Billing::Integrations::Chronopay::Return
- ActiveMerchant::Billing::Integrations::DirecPay
- ActiveMerchant::Billing::Integrations::DirecPay::Helper
- ActiveMerchant::Billing::Integrations::DirecPay::Notification
- ActiveMerchant::Billing::Integrations::DirecPay::Return
- ActiveMerchant::Billing::Integrations::DirecPay::Status
- ActiveMerchant::Billing::Integrations::Directebanking
- ActiveMerchant::Billing::Integrations::Directebanking::Helper
- ActiveMerchant::Billing::Integrations::Directebanking::Notification
- ActiveMerchant::Billing::Integrations::Directebanking::Return
- ActiveMerchant::Billing::Integrations::Dwolla
- ActiveMerchant::Billing::Integrations::Dwolla::Helper
- ActiveMerchant::Billing::Integrations::Dwolla::Notification
- ActiveMerchant::Billing::Integrations::Dwolla::Return
- ActiveMerchant::Billing::Integrations::EPaymentPlans
- ActiveMerchant::Billing::Integrations::EPaymentPlans::Helper
- ActiveMerchant::Billing::Integrations::EPaymentPlans::Notification
- ActiveMerchant::Billing::Integrations::Gestpay
- ActiveMerchant::Billing::Integrations::Gestpay::Common
- ActiveMerchant::Billing::Integrations::Gestpay::Helper
- ActiveMerchant::Billing::Integrations::Gestpay::Notification
- ActiveMerchant::Billing::Integrations::Gestpay::Return
- ActiveMerchant::Billing::Integrations::HiTrust
- ActiveMerchant::Billing::Integrations::HiTrust::Notification
- ActiveMerchant::Billing::Integrations::HiTrust::Return
- ActiveMerchant::Billing::Integrations::Moneybookers
- ActiveMerchant::Billing::Integrations::Moneybookers::Helper
- ActiveMerchant::Billing::Integrations::Nochex
- ActiveMerchant::Billing::Integrations::Nochex::Helper
- ActiveMerchant::Billing::Integrations::Nochex::Notification
- ActiveMerchant::Billing::Integrations::Nochex::Return
- ActiveMerchant::Billing::Integrations::Notification
- ActiveMerchant::Billing::Integrations::PayflowLink
- ActiveMerchant::Billing::Integrations::PayflowLink::Helper
- ActiveMerchant::Billing::Integrations::PayflowLink::Notification
- ActiveMerchant::Billing::Integrations::Paypal
- ActiveMerchant::Billing::Integrations::Paypal::Helper
- ActiveMerchant::Billing::Integrations::Paypal::Notification
- ActiveMerchant::Billing::Integrations::Paypal::Return
- ActiveMerchant::Billing::Integrations::Quickpay
- ActiveMerchant::Billing::Integrations::Quickpay::Helper
- ActiveMerchant::Billing::Integrations::Quickpay::Notification
- ActiveMerchant::Billing::Integrations::Return
- ActiveMerchant::Billing::Integrations::SagePayForm
- ActiveMerchant::Billing::Integrations::SagePayForm::Encryption
- ActiveMerchant::Billing::Integrations::SagePayForm::Helper
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification::CryptError
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification::InvalidCryptData
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification::MissingCryptData
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification::MissingCryptKey
- ActiveMerchant::Billing::Integrations::SagePayForm::Return
- ActiveMerchant::Billing::Integrations::TwoCheckout
- ActiveMerchant::Billing::Integrations::TwoCheckout::Helper
- ActiveMerchant::Billing::Integrations::TwoCheckout::Notification
- ActiveMerchant::Billing::Integrations::TwoCheckout::Return
- ActiveMerchant::Billing::Integrations::Valitor
- ActiveMerchant::Billing::Integrations::Valitor::Helper
- ActiveMerchant::Billing::Integrations::Valitor::Notification
- ActiveMerchant::Billing::Integrations::Valitor::ResponseFields
- ActiveMerchant::Billing::Integrations::Valitor::Return
- ActiveMerchant::Billing::Integrations::WorldPay
- ActiveMerchant::Billing::Integrations::WorldPay::Helper
- ActiveMerchant::Billing::Integrations::WorldPay::Notification
- ActiveMerchant::Billing::IridiumGateway
- ActiveMerchant::Billing::JetpayGateway
- ActiveMerchant::Billing::LinkpointGateway
- ActiveMerchant::Billing::MerchantESolutionsGateway
- ActiveMerchant::Billing::MerchantWareGateway
- ActiveMerchant::Billing::ModernPaymentsGateway
- ActiveMerchant::Billing::MonerisGateway
- ActiveMerchant::Billing::NetRegistryGateway
- ActiveMerchant::Billing::NetaxeptGateway
- ActiveMerchant::Billing::NetaxeptGateway::Response
- ActiveMerchant::Billing::NetbillingGateway
- ActiveMerchant::Billing::NmiGateway
- ActiveMerchant::Billing::OptimalPaymentGateway
- ActiveMerchant::Billing::OrbitalSoftDescriptors
- ActiveMerchant::Billing::PayJunctionGateway
- ActiveMerchant::Billing::PaySecureGateway
- ActiveMerchant::Billing::PayboxDirectGateway
- ActiveMerchant::Billing::PayflowCommonAPI
- ActiveMerchant::Billing::PayflowExpressResponse
- ActiveMerchant::Billing::PayflowExpressUkGateway
- ActiveMerchant::Billing::PayflowGateway
- ActiveMerchant::Billing::PayflowResponse
- ActiveMerchant::Billing::PayflowUkGateway
- ActiveMerchant::Billing::PaymentExpressGateway
- ActiveMerchant::Billing::PaymentExpressResponse
- ActiveMerchant::Billing::PaypalCaGateway
- ActiveMerchant::Billing::PaypalCommonAPI
- ActiveMerchant::Billing::PaypalExpressCommon
- ActiveMerchant::Billing::PaypalExpressGateway
- ActiveMerchant::Billing::PaypalExpressResponse
- ActiveMerchant::Billing::PaypalGateway
- ActiveMerchant::Billing::PlugnpayGateway
- ActiveMerchant::Billing::PlugnpayGateway::PlugnpayPostData
- ActiveMerchant::Billing::PsigateGateway
- ActiveMerchant::Billing::QbmsGateway
- ActiveMerchant::Billing::QuantumGateway
- ActiveMerchant::Billing::QuickpayGateway
- ActiveMerchant::Billing::RealexGateway
- ActiveMerchant::Billing::Response
- ActiveMerchant::Billing::SageGateway
- ActiveMerchant::Billing::SagePayGateway
- ActiveMerchant::Billing::SallieMaeGateway
- ActiveMerchant::Billing::SamuraiGateway
- ActiveMerchant::Billing::SecureNetGateway
- ActiveMerchant::Billing::SecurePayAuGateway
- ActiveMerchant::Billing::SecurePayGateway
- ActiveMerchant::Billing::SecurePayTechGateway
- ActiveMerchant::Billing::SecurePayTechGateway::SecurePayTechPostData
- ActiveMerchant::Billing::SkipJackGateway
- ActiveMerchant::Billing::StripeGateway
- ActiveMerchant::Billing::TransFirstGateway
- ActiveMerchant::Billing::TransaxGateway
- ActiveMerchant::Billing::TrustCommerceGateway
- ActiveMerchant::Billing::UsaEpayAdvancedGateway
- ActiveMerchant::Billing::UsaEpayGateway
- ActiveMerchant::Billing::UsaEpayTransactionGateway
- ActiveMerchant::Billing::VerifiGateway
- ActiveMerchant::Billing::VerifiGateway::VerifiPostData
- ActiveMerchant::Billing::ViaklixGateway
- ActiveMerchant::Billing::WirecardGateway
- ActiveMerchant::Billing::WorldpayGateway
- ActiveMerchant::Billing::WorldpayGateway::MultiResponse
- BraintreeCommon
- OutboundHosts

No matching classes.

# ActiveMerchant::Billing::BarclaysEpdqGateway::Document

### Constants

EPDQ_CARD_TYPES
PAYMENT_INTERVALS

### Attributes

type[R]
xml[R]

### Public Class Methods

new(gateway, options = {}, document_options = {}, &block) click to toggle source

    # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 184
    def initialize(gateway, options = {}, document_options = {}, &block)
      @gateway = gateway
      @options = options
      @document_options = document_options
      @xml = Builder::XmlMarkup.new(:indent => 2)
      build(&block)
    end

### Public Instance Methods

add_consumer(options=nil, &block) click to toggle source

    # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 228
    def add_consumer(options=nil, &block)
      xml.Consumer do
        if options
          xml.Email(options[:email]) if options[:email]
          billing_address = options[:billing_address] || options[:address]
          if billing_address
            xml.BillTo do
              xml.Location do
                xml.Address do
                  xml.Street1 billing_address[:address1]
                  xml.Street2 billing_address[:address2]
                  xml.City billing_address[:city]
                  xml.StateProv billing_address[:state]
                  xml.PostalCode billing_address[:zip]
                  xml.Country billing_address[:country_code]
                end
              end
            end
          end
        end
        instance_eval(&block)
      end
    end

add_creditcard(creditcard) click to toggle source

    # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 252
    def add_creditcard(creditcard)
      xml.PaymentMech do
        xml.CreditCard do
          xml.Type({ :DataType => 'S32' }, EPDQ_CARD_TYPES[creditcard.brand.to_sym])
          xml.Number creditcard.number
          xml.Expires({ :DataType => 'ExpirationDate', :Locale => 826 }, format_expiry_date(creditcard))
          if creditcard.verification_value.present?
            xml.Cvv2Indicator 1
            xml.Cvv2Val creditcard.verification_value
          else
            xml.Cvv2Indicator 5
          end
          xml.IssueNum(creditcard.issue_number) if creditcard.issue_number.present?
        end
      end
    end

add_order_form(order_id=nil, group_id=nil, &block) click to toggle source

    # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 219
    def add_order_form(order_id=nil, group_id=nil, &block)
      xml.OrderFormDoc do
        xml.Mode 'P'
        xml.Id(order_id) if order_id
        xml.GroupId(group_id) if group_id
        instance_eval(&block)
      end
    end

add_transaction(auth_type, amount = nil, options = {}) click to toggle source

    # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 269
    def add_transaction(auth_type, amount = nil, options = {})
      @auth_type = auth_type
      xml.Transaction do
        xml.Type @auth_type.to_s
        if options[:payment_number] && options[:payment_number] > 1
          xml.CardholderPresentCode({ :DataType => 'S32' }, 8)
        else
          xml.CardholderPresentCode({ :DataType => 'S32' }, 7)
        end
        if options[:payment_number]
          xml.PaymentNumber({ :DataType => 'S32' }, options[:payment_number])
        end
        if options[:total_payments]
          xml.TotalNumberPayments({ :DataType => 'S32' }, options[:total_payments])
        end
        if amount
          xml.CurrentTotals do
            xml.Totals do
              xml.Total({ :DataType => 'Money', :Currency => 826 }, amount)
            end
          end
        end
      end
    end

build(&block) click to toggle source

    # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 196
    def build(&block)
      xml.instruct!(:xml, :version => '1.0')
      xml.EngineDocList do
        xml.DocVersion "1.0"
        xml.EngineDoc do
          xml.ContentType "OrderFormDoc"
          xml.User do
            xml.Name(@options[:login])
            xml.Password(@options[:password])
            xml.ClientId({ :DataType => "S32" }, @options[:client_id])
          end
          xml.Instructions do
            if @document_options[:no_fraud]
              xml.Pipeline "PaymentNoFraud"
            else
              xml.Pipeline "Payment"
            end
          end
          instance_eval(&block)
        end
      end
    end

format_expiry_date(creditcard) click to toggle source

date must be formatted MM/YY

    # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 295
    def format_expiry_date(creditcard)
      month_str = "%02d" % creditcard.month
      if match = creditcard.year.to_s.match(/^\d{2}(\d{2})$/)
        year_str = "%02d" % match[1].to_i
      else
        year_str = "%02d" % creditcard.year
      end
      "#{month_str}/#{year_str}"
    end

to_xml() click to toggle source

    # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 192
    def to_xml
      @xml.target!
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.