Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Shopify/active_merchant
...
head fork: jimmybaker/active_merchant
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
View
2  lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb
@@ -140,7 +140,7 @@ def build_capture_request(money, authorization, options)
xml.tag! 'n2:Version', API_VERSION
xml.tag! 'AuthorizationID', authorization
xml.tag! 'Amount', amount(money), 'currencyID' => options[:currency] || currency(money)
- xml.tag! 'CompleteType', 'Complete'
+ xml.tag! 'CompleteType', options[:complete_type] || 'Complete'
xml.tag! 'InvoiceID', options[:order_id] unless options[:order_id].blank?
xml.tag! 'Note', options[:description]
end
View
32 lib/active_merchant/billing/gateways/paypal_express.rb
@@ -25,6 +25,12 @@ def setup_purchase(money, options = {})
commit 'SetExpressCheckout', build_setup_request('Sale', money, options)
end
+ def setup_order(money, options = {})
+ requires!(options, :return_url, :cancel_return_url)
+
+ commit 'SetExpressCheckout', build_setup_request('Order', money, options)
+ end
+
def details_for(token)
commit 'GetExpressCheckoutDetails', build_get_details_request(token)
end
@@ -41,6 +47,14 @@ def purchase(money, options = {})
commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Sale', money, options)
end
+ def order(money, options = {})
+ commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Order', money, options)
+ end
+
+ def authorize_order(money, transaction_id)
+ commit 'DoAuthorization', build_order_authorization_request(money, transaction_id)
+ end
+
def reference_transaction(money, options = {})
requires!(options, :reference_id, :payment_type, :invoice_id, :description, :ip)
@@ -59,6 +73,20 @@ def build_get_details_request(token)
xml.target!
end
+
+ def build_order_authorization_request(money, transaction_id)
+ xml = Builder::XmlMarkup.new :indent => 2
+ xml.tag! 'DoAuthorizationReq', 'xmlns' => PAYPAL_NAMESPACE do
+ xml.tag! 'DoAuthorizationRequest', 'xmlns:n2' => EBAY_NAMESPACE do
+ xml.tag! 'n2:Version', API_VERSION
+ xml.tag! 'TransactionID', transaction_id
+ xml.tag! 'Amount', money
+ xml.tag! 'TransactionEntity', 'Order'
+ end
+ end
+
+ xml.target!
+ end
def build_sale_or_authorization_request(action, money, options)
currency_code = options[:currency] || currency(money)
@@ -148,6 +176,10 @@ def build_setup_request(action, money, options)
xml.tag! 'n2:TaxTotal', localized_amount(options[:tax], currency_code), 'currencyID' => currency_code
end
+ if options.has_key?(:shipping_discount)
+ xml.tag! 'n2:ShippingDiscount', localized_amount(options[:shipping_discount], currency_code), 'currencyID' => currency_code
+ end
+
xml.tag! 'n2:OrderDescription', options[:description]
xml.tag! 'n2:InvoiceID', options[:order_id]

No commit comments for this range

Something went wrong with that request. Please try again.