Class: ActiveMerchant::Billing::PaypalDigitalGoodsGateway

Inherits:
PaypalExpressGateway show all
Defined in:
lib/active_merchant/billing/gateways/paypal_digital_goods.rb

Constant Summary

Constants included from PaypalCommonAPI

ActiveMerchant::Billing::PaypalCommonAPI::API_VERSION, ActiveMerchant::Billing::PaypalCommonAPI::AUSTRALIAN_STATES, ActiveMerchant::Billing::PaypalCommonAPI::CREDENTIALS_NAMESPACES, ActiveMerchant::Billing::PaypalCommonAPI::EBAY_NAMESPACE, ActiveMerchant::Billing::PaypalCommonAPI::ENVELOPE_NAMESPACES, ActiveMerchant::Billing::PaypalCommonAPI::FRAUD_REVIEW_CODE, ActiveMerchant::Billing::PaypalCommonAPI::PAYPAL_NAMESPACE, ActiveMerchant::Billing::PaypalCommonAPI::SUCCESS_CODES, ActiveMerchant::Billing::PaypalCommonAPI::URLS

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from PaypalExpressGateway

#authorize, #details_for, #purchase, #reference_transaction, #setup_authorization, #setup_purchase

Methods included from PaypalExpressCommon

included, #redirect_url

Methods included from PaypalCommonAPI

#authorize_transaction, #balance, #capture, #credit, included, #initialize, #manage_pending_transaction, #reauthorize, #reference_transaction, #refund, #test?, #transaction_details, #transaction_search, #transfer, #void

Methods inherited from Gateway

#card_brand, card_brand, inherited, #initialize, supports?, #test?

Methods included from CreditCardFormatting

#format

Instance Method Details

#build_setup_request(action, money, options) ⇒ Object

GATEWAY.setup_purchase(100,

:ip                => "127.0.0.1",
:description       => "Test Title",
:return_url        => "http://return.url",
:cancel_return_url => "http://cancel.url",
:items             => [ { :name => "Charge",
                          :number => "1",
                          :quantity => "1",
                          :amount   => 100,
                          :description => "Description",
                          :category => "Digital" } ] )

Raises:

  • (ArgumentError)


30
31
32
33
34
35
36
37
38
39
# File 'lib/active_merchant/billing/gateways/paypal_digital_goods.rb', line 30

def build_setup_request(action, money, options)
  requires!(options, :items)
  raise ArgumentError, "Must include at least 1 Item" unless options[:items].length > 0
  options[:items].each do |item|
    requires!(item, :name, :number, :quantity, :amount, :description, :category)
    raise ArgumentError, "Each of the items must have the category 'Digital'" unless item[:category] == 'Digital'
  end

  super
end

#redirect_url_for(token, options = {}) ⇒ Object



15
16
17
# File 'lib/active_merchant/billing/gateways/paypal_digital_goods.rb', line 15

def redirect_url_for(token, options = {})
  "#{redirect_url}?token=#{token}&useraction=commit"
end