From 3c0cf0f1a54d2f028994a3f4b8351985ecc5608b Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 6 Jun 2011 10:32:14 -0700 Subject: [PATCH] Pass the user's locale along to PayPal. If it is supported, then the checkout screen on PayPal will be in the user's locale. Fixes bug #12119. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm | 2 ++ lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm | 2 ++ 3 files changed, 5 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index b654b5032..cdb143c37 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -9,6 +9,7 @@ - fixed #12136: Unable to add more than one image in Story - fixed #12133: RenderThingData macro doesn't accept templateId - fixed #12152: PayPal Standard ignores shop-credit + - fixed #12119: Locale setting for paypal 7.10.17 - fixed: Forced to use a PayDriver even with a balance of 0 in the cart. diff --git a/lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm b/lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm index 868540a8e..19533ded3 100644 --- a/lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm +++ b/lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm @@ -191,6 +191,7 @@ PayPal API spit back. sub processPayment { my ( $self, $transaction ) = @_; + my $i18n = WebGUI::International->new($self->session); my $form = $self->payPalForm( METHOD => 'DoExpressCheckoutPayment', PAYERID => $self->session->form->process('PayerId'), @@ -198,6 +199,7 @@ sub processPayment { AMT => $self->getCart->calculateTotal, CURRENCYCODE => $self->get('currency'), PAYMENTACTION => 'SALE', + LOCALECODE => $i18n->getLanguage->{locale}, ); my $response = LWP::UserAgent->new->post( $self->apiUrl, $form ); my $params = $self->responseHash($response); diff --git a/lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm b/lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm index 90839aa99..d4a320d1f 100644 --- a/lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm +++ b/lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm @@ -240,6 +240,7 @@ sub paymentVariables { my $url = $self->session->url; my $base = $url->getSiteURL . $url->page; my $cart = $self->getCart; + my $i18n = WebGUI::International->new($self->session); my $return = URI->new($base); $return->query_form( { @@ -262,6 +263,7 @@ sub paymentVariables { return => $return->as_string, cancel_return => $cancel->as_string, + lc => $i18n->getLanguage->{locale}, handling_cart => $cart->calculateShipping, ##According to https://www.x.com/message/180018#180018 tax_cart => $cart->calculateTaxes,