Class: ActiveMerchant::Billing::PaypalGateway
- Includes:
- PaypalCommonAPI
- Defined in:
- lib/active_merchant/billing/gateways/paypal.rb
Direct Known Subclasses
Constant Summary collapse
- RECURRING_ACTIONS =
Set.new([:add, :cancel, :inquiry, :suspend])
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
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(money, credit_card_or_referenced_id, options = {}) ⇒ Object
-
#cancel_recurring(profile_id) ⇒ Object
cancels an existing recurring profile.
- #express ⇒ Object
- #purchase(money, credit_card_or_referenced_id, options = {}) ⇒ Object
-
#recurring(money, credit_card, options = {}) ⇒ Object
For recurring options see cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_WPRecurringPayments.
-
#recurring_inquiry(profile_id, options = {}) ⇒ Object
retrieves information about a recurring profile.
-
#suspend_recurring(profile_id) ⇒ Object
suspends a recurring profile.
Methods included from PaypalCommonAPI
#capture, #credit, included, #initialize, #reauthorize, #test?, #transfer, #void
Methods inherited from Gateway
#card_brand, card_brand, inherited, #initialize, supports?, #test?
Methods included from Utils
Methods included from CreditCardFormatting
Methods included from RequiresParameters
Methods included from PostsData
Instance Method Details
#authorize(money, credit_card_or_referenced_id, options = {}) ⇒ Object
14 15 16 17 |
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 14 def (money, credit_card_or_referenced_id, = {}) requires!(, :ip) commit define_transaction_type(credit_card_or_referenced_id), ('Authorization', money, credit_card_or_referenced_id, ) end |
#cancel_recurring(profile_id) ⇒ Object
cancels an existing recurring profile
41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 41 def cancel_recurring(profile_id) request = build_recurring_request(:cancel, 0, :profile_id => profile_id) {} commit('ManageRecurringPaymentsProfileStatus', request) end |
#express ⇒ Object
24 25 26 |
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 24 def express @express ||= PaypalExpressGateway.new(@options) end |
#purchase(money, credit_card_or_referenced_id, options = {}) ⇒ Object
19 20 21 22 |
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 19 def purchase(money, credit_card_or_referenced_id, = {}) requires!(, :ip) commit define_transaction_type(credit_card_or_referenced_id), ('Sale', money, credit_card_or_referenced_id, ) end |
#recurring(money, credit_card, options = {}) ⇒ Object
For recurring options see cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_WPRecurringPayments
32 33 34 35 36 37 38 |
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 32 def recurring(money, credit_card, = {}) [:name] = credit_card.name if [:name].blank? && credit_card request = build_recurring_request([:profile_id] ? :modify : :add, money, ) do |xml| add_credit_card(xml, credit_card, [:billing_address], ) if credit_card end commit('CreateRecurringPaymentsProfile', request) end |
#recurring_inquiry(profile_id, options = {}) ⇒ Object
retrieves information about a recurring profile
47 48 49 50 |
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 47 def recurring_inquiry(profile_id, = {}) request = build_recurring_request(:inquiry, nil, .update( :profile_id => profile_id )) commit('GetRecurringPaymentsProfileDetails', request) end |
#suspend_recurring(profile_id) ⇒ Object
suspends a recurring profile
53 54 55 56 |
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 53 def suspend_recurring(profile_id) request = build_recurring_request(:suspend, 0, :profile_id => profile_id) {} commit('ManageRecurringPaymentsProfileStatus', request) end |