Sha256: 0c75aa464dea2761b036567d076ad24da65402bf39686331c1e467fe950585fd

Contents?: true

Size: 1.83 KB

Versions: 40

Compression:

Stored size: 1.83 KB

Contents

require 'active_merchant/billing/gateways/paypal/paypal_common_api'
require 'active_merchant/billing/gateways/paypal/paypal_express_response'
require 'active_merchant/billing/gateways/paypal_express_common'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class PaypalDigitalGoodsGateway < PaypalExpressGateway
      self.test_redirect_url = 'https://www.sandbox.paypal.com/incontext'
      self.live_redirect_url = 'https://www.paypal.com/incontext'

      self.supported_countries = %w(AU CA CN FI GB ID IN IT MY NO NZ PH PL SE SG TH VN)
      self.homepage_url = 'https://www.x.com/community/ppx/xspaces/digital_goods'
      self.display_name = 'PayPal Express Checkout for Digital Goods'

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

      # 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" } ] )
      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

    end
  end
end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
activemerchant-1.61.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.60.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.59.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.58.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.57.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.56.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.55.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.54.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.53.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
start_activemerchant-1.50.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/paypal_digital_goods.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.52.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.51.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.50.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.49.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.48.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.47.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb
activemerchant-1.46.0 lib/active_merchant/billing/gateways/paypal_digital_goods.rb