lib/active_merchant/billing/gateways/payflow_express.rb in activemerchant-1.43.3 vs lib/active_merchant/billing/gateways/payflow_express.rb in activemerchant-1.44.0
- old
+ new
@@ -39,11 +39,11 @@
# Support for order line items is available, but has to be enabled on the PayFlow backend. This is what I was told by Todd Sieber at Technical Support:
#
# <em>You will need to call Payflow Support at 1-888-883-9770, choose option #2. Request that they update your account in "Pandora" under Product Settings >> PayPal Mark and update the Features Bitmap to 1111111111111112. This is 15 ones and a two.</em>
#
# See here[https://www.x.com/message/206214#206214] for the forum discussion (requires login to {x.com}[https://x.com]
- #
+ #
# [<tt>:items</tt>] (opt) Array of Order Line Items hashes. These are shown to the buyer after redirect to PayPal.
#
#
#
# The following keys are supported for line items:
@@ -62,62 +62,62 @@
class PayflowExpressGateway < Gateway
include PayflowCommonAPI
include PaypalExpressCommon
-
+
self.test_redirect_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=xpt/merchant/ExpressCheckoutIntro-outside'
self.display_name = 'PayPal Express Checkout'
def authorize(money, options = {})
requires!(options, :token, :payer_id)
request = build_sale_or_authorization_request('Authorization', money, options)
commit(request, options)
end
-
- def purchase(money, options = {})
+
+ def purchase(money, options = {})
requires!(options, :token, :payer_id)
request = build_sale_or_authorization_request('Sale', money, options)
commit(request, options)
end
-
+
def refund(money, identification, options = {})
request = build_reference_request(:credit, money, identification, options)
commit(request, options)
- end
+ end
def credit(money, identification, options = {})
- deprecated CREDIT_DEPRECATION_MESSAGE
+ ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
refund(money, identification, options)
end
def setup_authorization(money, options = {})
requires!(options, :return_url, :cancel_return_url)
-
+
request = build_setup_express_sale_or_authorization_request('Authorization', money, options)
commit(request, options)
end
-
+
def setup_purchase(money, options = {})
requires!(options, :return_url, :cancel_return_url)
-
+
request = build_setup_express_sale_or_authorization_request('Sale', money, options)
commit(request, options)
end
-
+
def details_for(token)
request = build_get_express_details_request(token)
commit(request, options)
end
-
+
private
def build_get_express_details_request(token)
- xml = Builder::XmlMarkup.new :indent => 2
+ xml = Builder::XmlMarkup.new :indent => 2
xml.tag! 'GetExpressCheckout' do
xml.tag! 'Authorization' do
- xml.tag! 'PayData' do
+ xml.tag! 'PayData' do
xml.tag! 'Tender' do
xml.tag! 'PayPal' do
xml.tag! 'Token', token
end
end
@@ -134,12 +134,12 @@
add_pay_data xml, money, options
end
end
xml.target!
end
-
- def build_sale_or_authorization_request(action, money, options)
+
+ def build_sale_or_authorization_request(action, money, options)
xml = Builder::XmlMarkup.new :indent => 2
xml.tag! 'DoExpressCheckout' do
xml.tag! action do
add_pay_data xml, money, options
end
@@ -199,12 +199,12 @@
xml.tag! 'NotifyURL', options[:notify_url] unless options[:notify_url].blank?
xml.tag! 'PayerID', options[:payer_id] unless options[:payer_id].blank?
xml.tag! 'Token', options[:token] unless options[:token].blank?
xml.tag! 'NoShipping', options[:no_shipping] ? '1' : '0'
xml.tag! 'AddressOverride', options[:address_override] ? '1' : '0'
- xml.tag! 'ButtonSource', application_id.to_s.slice(0,32) unless application_id.blank?
-
+ xml.tag! 'ButtonSource', application_id.to_s.slice(0,32) unless application_id.blank?
+
# Customization of the payment page
xml.tag! 'PageStyle', options[:page_style] unless options[:page_style].blank?
xml.tag! 'HeaderImage', options[:header_image] unless options[:header_image].blank?
xml.tag! 'PayflowColor', options[:background_color] unless options[:background_color].blank?
# Note: HeaderImage and PayflowColor apply to both the new (as of 2010) and the old checkout experience
@@ -212,10 +212,10 @@
xml.tag! 'HeaderBackColor', options[:header_background_color] unless options[:header_background_color].blank?
xml.tag! 'HeaderBorderColor', options[:header_border_color] unless options[:header_border_color].blank?
xml.tag! 'ExtData', 'Name' => 'ALLOWNOTE', 'Value' => options[:allow_note]
end
end
-
+
def build_response(success, message, response, options = {})
PayflowExpressResponse.new(success, message, response, options)
end
end
end