Class: ActiveMerchant::Billing::PaypalDigitalGoodsGateway

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

Constant Summary

Constants inherited from PaypalExpressGateway

ActiveMerchant::Billing::PaypalExpressGateway::NON_STANDARD_LOCALE_CODES

Constants included from PaypalRecurringApi

ActiveMerchant::Billing::PaypalRecurringApi::API_VERSION, ActiveMerchant::Billing::PaypalRecurringApi::EBAY_NAMESPACE, ActiveMerchant::Billing::PaypalRecurringApi::PAYPAL_NAMESPACE

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::STANDARD_ERROR_CODE_MAPPING, ActiveMerchant::Billing::PaypalCommonAPI::SUCCESS_CODES, ActiveMerchant::Billing::PaypalCommonAPI::URLS

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, 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 PaypalExpressGateway

#agreement_details, #authorize, #authorize_reference_transaction, #details_for, #purchase, #reference_transaction, #setup_authorization, #setup_purchase, #store, #unstore

Methods included from PaypalRecurringApi

#bill_outstanding_amount, #cancel_recurring, #reactivate_recurring, #recurring, #status_recurring, #suspend_recurring, #update_recurring

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, #transaction_details, #transaction_search, #transfer, #void

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, #initialize, #scrub, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

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)


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

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
18
# File 'lib/active_merchant/billing/gateways/paypal_digital_goods.rb', line 15

def redirect_url_for(token, options = {})
  options[:review] ||= false
  super
end