### Home Classes Methods

### In Files

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

### Parent

ActiveMerchant::Billing::Gateway

### Methods

- ::new
- #authorize
- #capture
- #credit
- #purchase
- #recurring
- #refund
- #test?
- #void

### 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::PayJunctionGateway

PayJunction Gateway

This gateway accepts the following arguments:

    :login    => your PayJunction username
    :password => your PayJunction pass

Example use:

    gateway = ActiveMerchant::Billing::Base.gateway(:pay_junction).new(
                :login => "my_account",
                :password => "my_pass"
             )

    # set up credit card obj as in main ActiveMerchant example
    creditcard = ActiveMerchant::Billing::CreditCard.new(
      :type       => 'visa',
      :number     => '4242424242424242',
      :month      => 8,
      :year       => 2009,
      :first_name => 'Bob',
      :last_name  => 'Bobsen'
    )

    # optionally specify address if using AVS
    address = { :address1 => '101 Test Ave', :city => 'Test', :state => 'TS',
                :zip  => '10101', :country => 'US' }

    # run request
    response = gateway.purchase(1000, creditcard, :address => address) # charge 10 dollars

1) Check whether the transaction was successful

    response.success?

2) Retrieve the message returned by PayJunction

    response.message

3) Retrieve the unique transaction ID returned by PayJunction

    response.authorization

This gateway supports "instant" transactions. These transactions allow you to execute an operation on a previously run card without card information provided you have the transaction id from a previous transaction with the same card. All functions that take a credit card object for this gateway can take a transaction id string instead.

Test Transactions

See the source for initialize() for test account information. Note that PayJunction does not allow test transactions on your account, so if the gateway is running in :test mode your transaction will be run against PayJunction's global test account and will not show up in your account.

Transactions ran on this account go through a test processor, so there is no need to void or otherwise cancel transactions. However, for further safety, please use the special card numbers 4433221111223344 or 4444333322221111 and keep transaction amounts below $4.00 when testing.

Also note, transactions ran for an amount between $0.00 and $1.99 will likely result in denial. To demonstrate approvals, use amounts between $2.00 and $4.00.

Test transactions can be checked by logging into PayJunction Web Login with username 'pj-cm-01' and password 'pj-cm-01p'

Usage Details

Below is a map of values accepted by PayJunction and how you should submit each to ActiveMerchant

PayJunction Field ActiveMerchant Use

dc_logon provide as :login value to gateway instantation dc_password provide as :password value to gateway instantiation

dc_name will be retrieved from credit_card.name dc_first_name :first_name on CreditCard object instantation dc_last_name :last_name on CreditCard object instantation dc_number :number on CreditCard object instantation dc_expiration_month :month on CreditCard object instantation dc_expiration_year :year on CreditCard object instantation dc_verification_number :verification_value on CC object instantation

dc_transaction_amount include as argument to method for your transaction type dc_transaction_type do nothing, set by your transaction type dc_version do nothing, always "1.2"

dc_transaction_id submit as a string in place of CreditCard obj for

    "instant" transactions.

dc_invoice :order_id in options for transaction method dc_notes :description in options for transaction method

See example use above for address AVS fields See recurring for periodic transaction fields

### Constants

API_VERSION
DECLINE_CODES
FAILURE_MESSAGE
SUCCESS_CODES
SUCCESS_MESSAGE
TEST_LOGIN
TEST_PASSWORD

### Public Class Methods

new(options = {}) click to toggle source

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 158
    def initialize(options = {})
      requires!(options, :login, :password)
      @options = options
      super
    end

### Public Instance Methods

authorize(money, payment_source, options = {}) click to toggle source

The first half of the preauth(authorize)/postauth(capture) model. Checks to make sure funds are available for a transaction, and returns a transaction_id that can be used later to postauthorize (capture) the funds.

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 167
    def authorize(money, payment_source, options = {})
      parameters = {
        :transaction_amount => amount(money),
      }

      add_payment_source(parameters, payment_source)
      add_address(parameters, options)
      add_optional_fields(parameters, options)
      commit('AUTHORIZATION', parameters)
    end

capture(money, authorization, options = {}) click to toggle source

The second half of the preauth(authorize)/postauth(capture) model. Retrieve funds that have been previously authorized with authorization

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 193
    def capture(money, authorization, options = {})
      parameters = {
        :transaction_id => authorization,
        :posture => 'capture'
      }

      add_optional_fields(parameters, options)
      commit('update', parameters)
    end

credit(money, authorization, options = {}) click to toggle source

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 214
    def credit(money, authorization, options = {})
      deprecated CREDIT_DEPRECATION_MESSAGE
      refund(money, authorization, options)
    end

purchase(money, payment_source, options = {}) click to toggle source

A simple sale, capturing funds immediately. Execute authorization and capture in a single step.

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 180
    def purchase(money, payment_source, options = {})
      parameters = {
        :transaction_amount => amount(money),
      }

      add_payment_source(parameters, payment_source)
      add_address(parameters, options)
      add_optional_fields(parameters, options)
      commit('AUTHORIZATION_CAPTURE', parameters)
    end

recurring(money, payment_source, options = {}) click to toggle source

Set up a sale that will be made on a regular basis for the same amount (ex. $20 a month for 12 months)

The parameter :periodicity should be specified as either :monthly, :weekly, or :daily The parameter :payments should be the number of payments to be made

    gateway.recurring('2000', creditcard, :periodicity => :monthly, :payments => 12)

The optional parameter :starting_at takes a date or time argument or a string in YYYYMMDD format and can be used to specify when the first charge will be made. If omitted the first charge will be immediate.

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 242
    def recurring(money, payment_source, options = {})
      requires!(options, [:periodicity, :monthly, :weekly, :daily], :payments)

      periodic_type = case options[:periodicity]
      when :monthly
        'month'
      when :weekly
        'week'
      when :daily
        'day'
      end

      if options[:starting_at].nil?
        start_date = Time.now.strftime('%Y-%m-%d')
      elsif options[:starting_at].is_a?(String)
        sa = options[:starting_at]
        start_date = "#{sa[0..3]}-#{sa[4..5]}-#{sa[6..7]}"
      else
        start_date = options[:starting_at].strftime('%Y-%m-%d')
      end

      parameters = {
        :transaction_amount => amount(money),
        :schedule_periodic_type => periodic_type,
        :schedule_create => 'true',
        :schedule_limit => options[:payments].to_i > 1 ? options[:payments] : 1,
        :schedule_periodic_number => 1,
        :schedule_start => start_date
      }

      add_payment_source(parameters, payment_source)
      add_optional_fields(parameters, options)
      add_address(parameters, options)
      commit('AUTHORIZATION_CAPTURE', parameters)
    end

refund(money, authorization, options = {}) click to toggle source

Return money to a card that was previously billed. authorization should be the transaction id of the transaction we are returning.

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 205
    def refund(money, authorization, options = {})
      parameters = {
        :transaction_amount => amount(money),
        :transaction_id => authorization
      }

      commit('CREDIT', parameters)
    end

test?() click to toggle source

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 278
    def test?
      test_login? || @options[:test] || super
    end

void(authorization, options = {}) click to toggle source

Cancel a transaction that has been charged but has not yet made it through the batch process.

    # File lib/active_merchant/billing/gateways/pay_junction.rb, line 221
    def void(authorization, options = {})
      parameters = {
        :transaction_id => authorization,
        :posture => 'void'
      }

      add_optional_fields(parameters, options)
      commit('update', parameters)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.