Class: ActiveMerchant::Billing::PayULatamGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/pay_u_latam.rb

Constant Summary collapse

QUERIES_API_TEST_URL =
'https://stg.api.payulatam.com/reports-api/4.0/service.cgi'
QUERIES_API_LIVE_URL =
'https://api.payulatam.com/reports-api/4.0/service.cgi'
ORDER_STATUS =
{
    :NEW         => 'The order has been created',
    :IN_PROGRESS => 'The order is being processed',
    :AUTHORIZED  => 'The last transaction of the order has been approved',
    :CAPTURED    => 'The last transaction of the capture process has been approved',
    :CANCELLED   => 'The last transaction of the order has been canceled',
    :DECLINED    => 'The last transaction of the order has been declined',
    :REFUNDED    => 'The last transaction of the order has been refunded'
}
TRANSACTION_STATUS =
{
    :APPROVED  => 'Transaction approved',
    :DECLINED  => 'Transaction declined',
    :ERROR     => 'Error in the processing of the transaction',
    :EXPIRED   => 'Transaction expired',
    :PENDING   => 'Transaction is pending or in validation',
    :SUBMITTED => 'Transaction sent to the bank and for some reason has not finish processing. Only applies to API reports'
}
QUOTAS =
{
    :'1' => 'Payment on site',
    :'2' => 'Business funding',
    :'3' => 'Payment network funding'
}
RESPONSE_CODE =
{
    :ERROR                                               => 'There was an error in the process/transaction',
    :APPROVED                                            => 'The transaction was approved',
    :ANTIFRAUD_REJECTED                                  => 'The transaction was rejected by the anti-fraud module',
    :PAYMENT_NETWORK_REJECTED                            => 'The payment network has rejected the transaction',
    :ENTITY_DECLINED                                     => 'The transaction has been declined by the bank or there has been an error with the payment network',
    :INTERNAL_PAYMENT_PROVIDER_ERROR                     => 'An error has occurred within the system of the payment network',
    :INACTIVE_PAYMENT_PROVIDER                           => 'The payment provide is not currently activated for your account',
    :DIGITAL_CERTIFICATE_NOT_FOUND                       => 'The payment network has reported an error in the authentication of the transaction',
    :INVALID_EXPIRATION_DATE_OR_SECURITY_CODE            => 'The security code or expiration date is invalid',
    :INSUFFICIENT_FUNDS                                  => 'The account does not have sufficient funds for this transaction',
    :CREDIT_CARD_NOT_AUTHORIZE_FOR_INTERNET_TRANSACTIONS => 'The credit card is not authorized for internet transactions',
    :INVALID_TRANSACTION                                 => 'The payment network has reported that this transaction is not valid',
    :INVALID_CARD                                        => 'Invalid card',
    :EXPIRED_CARD                                        => 'Expired card',
    :RESTRICTED_CARD                                     => 'This card has been restricted for purchases',
    :CONTACT_THE_ENTITY                                  => 'Please contact your bank',
    :REPEAT_TRANSACTION                                  => 'Please attempt the transaction again',
    :ENTITY_MESSAGING_ERROR                              => 'The financial network has reported an error in their communication with the bank',
    :BANK_UNREACHABLE                                    => 'The bank is unable to be reached at this time',
    :EXCEEDED_AMOUNT                                     => 'This transaction has exceeded the limit set by the bank',
    :NOT_ACCEPTED_TRANSACTION                            => 'This transaction was not accepted by the bank',
    :ERROR_CONVERTING_TRANSACTION_AMOUNTS                => 'An error has occurred in the currency conversion process',
    :EXPIRED_TRANSACTION                                 => 'The transaction has expired',
    :PENDING_TRANSACTION_REVIEW                          => 'The transaction was been stopped and must be revised, this may occur because of security filters',
    :PENDING_TRANSACTION_CONFIRMATION                    => 'The transaction is pending confirmation',
    :PENDING_TRANSACTION_TRANSMISSION                    => 'The transaction is pending communication with the payment network. Normally this only occurs in cases of cash payment',
    :PAYMENT_NETWORK_BAD_RESPONSE                        => 'This message is communicated when connection with the payment network is inconsistent',
    :PAYMENT_NETWORK_NO_CONNECTION                       => 'A connection with the payment network is unavailable',
    :PAYMENT_NETWORK_NO_RESPONSE                         => 'The payment network has not responded',
    :FIX_NOT_REQUIRED                                    => 'Clinical transactions: Internal code only',
    :AUTOMATICALLY_FIXED_AND_SUCCESS_REVERSAL            => 'Clinical transactions: Internal code only',
    :AUTOMATICALLY_FIXED_AND_UNSUCCESS_REVERSAL          => 'Clinical transactions: Internal code only',
    :AUTOMATIC_FIXED_NOT_SUPPORTED                       => 'Clinical transactions: Internal code only',
    :NOT_FIXED_FOR_ERROR_STATE                           => 'Clinical transactions: Internal code only',
    :ERROR_FIXING_AND_REVERSING                          => 'Clinical transactions: Internal code only',
    :ERROR_FIXING_INCOMPLETE_DATA                        => 'Clinical transactions: Internal code only'
}
SECURITY_CODE =
{
    :'0' => 'Not provided',
    :'1' => 'Provided',
    :'2' => 'Unreadable',
    :'9' => 'Non-existent'
}
SUPPORTED_CURRENCIES =
%w(ARS BRL COP MXN PEN USD)
SUPPORTED_LANGUAGES =
%w(en es pt)
TRANSACTION_SOURCE =
{
    :WEB    => 'Online Transaction (E-commerce)',
    :MOTO   => 'Mail Order Telephone Order',
    :RETAIL => 'Retail',
    :MOBILE => 'Mobile transaction'
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #supported_countries, supported_countries, supported_countries=, supports?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Constructor Details

#initialize(options = {}) ⇒ PayULatamGateway

Returns a new instance of PayULatamGateway.



102
103
104
105
# File 'lib/active_merchant/billing/gateways/pay_u_latam.rb', line 102

def initialize(options={})
  requires!(options, :merchant_id, :api_login, :api_key, :country_account_id)
  super
end

Instance Method Details

#authorize(money, payment, options = {}) ⇒ Object



117
118
119
120
# File 'lib/active_merchant/billing/gateways/pay_u_latam.rb', line 117

def authorize(money, payment, options={})
  requires!(options, :order_id, :language, :description)
  commit(:authorize, money, payment, nil, options)
end

#capture(money, authorization, options = {}) ⇒ Object



122
123
124
125
# File 'lib/active_merchant/billing/gateways/pay_u_latam.rb', line 122

def capture(money, authorization, options={})
  requires!(options, :order_id)
  commit(:capture, money, nil, authorization, options)
end

#purchase(money, payment, options = {}) ⇒ Object



112
113
114
115
# File 'lib/active_merchant/billing/gateways/pay_u_latam.rb', line 112

def purchase(money, payment, options={})
  requires!(options, :order_id, :language, :description)
  commit(:purchase, money, payment, nil, options)
end

#refund(money, authorization, options = {}) ⇒ Object



127
128
129
130
# File 'lib/active_merchant/billing/gateways/pay_u_latam.rb', line 127

def refund(money, authorization, options={})
  requires!(options, :order_id)
  commit(:refund, money, nil, authorization, options)
end

#store(payment, options = {}) ⇒ Object



107
108
109
110
# File 'lib/active_merchant/billing/gateways/pay_u_latam.rb', line 107

def store(payment, options = {})
  requires!(options, :language)
  commit(:store, nil, payment, nil, options)
end

#void(authorization, options = {}) ⇒ Object



132
133
134
135
# File 'lib/active_merchant/billing/gateways/pay_u_latam.rb', line 132

def void(authorization, options={})
  requires!(options, :order_id)
  commit(:void, nil, nil, authorization, options)
end