diff --git a/docs/upgrades/packages-7.9.4/shopping-cart-collateral-items.wgpkg b/docs/upgrades/packages-7.9.4/shopping-cart-collateral-items.wgpkg index d51f74489..acd0af195 100644 Binary files a/docs/upgrades/packages-7.9.4/shopping-cart-collateral-items.wgpkg and b/docs/upgrades/packages-7.9.4/shopping-cart-collateral-items.wgpkg differ diff --git a/docs/upgrades/upgrade_7.9.3-7.9.4.pl b/docs/upgrades/upgrade_7.9.3-7.9.4.pl index f82b31164..35d29f3c0 100644 --- a/docs/upgrades/upgrade_7.9.3-7.9.4.pl +++ b/docs/upgrades/upgrade_7.9.3-7.9.4.pl @@ -168,6 +168,15 @@ sub addPayDriverTemplates { elsif ($gateway->isa('WebGUI::Shop::PayDriver::Ogone')) { $properties->{summaryTemplateId} = 'jysVZeUR0Bx2NfrKs5sulg'; } + elsif ($gateway->isa('WebGUI::Shop::PayDriver::PayPal::PayPalStd')) { + $properties->{summaryTemplateId} = '300AozDaeveAjB_KN0ljlQ'; + } + elsif ($gateway->isa('WebGUI::Shop::PayDriver::PayPal::ExpressCheckout')) { + $properties->{summaryTemplateId} = 'GqnZPB0gLoZmqQzYFaq7bg'; + } + else { + die "Unknown payment driver type found. Unable to automatically upgrade.\n"; + } $gateway->update($properties); } print "DONE!\n" unless $quiet; diff --git a/lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm b/lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm index d728afd21..4826fe4fb 100644 --- a/lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm +++ b/lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm @@ -106,6 +106,14 @@ sub definition { $fields{paypal}{defaultValue} = 'https://www.paypal.com/webscr'; $fields{api}{defaultValue} = 'https://api-3t.payPal.com/nvp'; + $fields{summaryTemplateId} = { + fieldType => 'template', + label => $i18n->get('summary template'), + hoverHelp => $i18n->get('summary template help'), + namespace => 'Shop/Credentials', + defaultValue => 'GqnZPB0gLoZmqQzYFaq7bg', + }, + push @{$definition}, { name => $i18n->get('name'), properties => \%fields, diff --git a/lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm b/lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm index 57d060c9e..7698b137f 100644 --- a/lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm +++ b/lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm @@ -122,6 +122,13 @@ sub definition { hoverHelp => $i18n->get('button image help'), defaultValue => '', }, + summaryTemplateId => { + fieldType => 'template', + label => $i18n->get('summary template'), + hoverHelp => $i18n->get('summary template help'), + namespace => 'Shop/Credentials', + defaultValue => '', + }, ); push @{$definition}, @@ -163,7 +170,7 @@ sub getButton { # do a submit button with i18n'd paypal text. If they did, we'll use an # image submit. my $button; - my $i18n = WebGUI::International->new( $session, 'PayDriver_PayPalStd' ); + my $i18n = WebGUI::International->new( $session, 'PayDriver_PayPalStd' ); my $text = $i18n->get('PayPal'); if ( $self->get('buttonImage') ) { my $raw = $self->get('buttonImage'); @@ -328,5 +335,41 @@ sub www_completeTransaction { : $self->displayPaymentError($transaction); } -1; +#------------------------------------------------------------------- +=head2 www_getCredentials ( [ addressId ] ) + +Displays the checkout form for this plugin. + +=head3 addressId + +Optionally supply this variable which will set the payment address to this addressId. + +=cut + +sub www_getCredentials { + my ($self, $addressId) = @_; + my $session = $self->session; + + # Generate 'Proceed' button + my $i18n = WebGUI::International->new($session, 'PayDriver_PayPalStd'); + my $var = { + proceedButton => $self->getButton, + }; + $self->appendCartVariables($var); + + my $template = WebGUI::Asset::Template->new($session, $self->get("summaryTemplateId")); + my $output; + if (defined $template) { + $template->prepare; + $output = $template->process($var); + } + else { + $output = $i18n->get('template gone', 'PayDriver_ITransact'); + } + + return $session->style->userStyle($output); +} + + +1; diff --git a/lib/WebGUI/i18n/English/PayDriver_ExpressCheckout.pm b/lib/WebGUI/i18n/English/PayDriver_ExpressCheckout.pm index faff0b86a..d2b9451c8 100644 --- a/lib/WebGUI/i18n/English/PayDriver_ExpressCheckout.pm +++ b/lib/WebGUI/i18n/English/PayDriver_ExpressCheckout.pm @@ -95,6 +95,34 @@ our $I18N = { message => q{Username from Paypal credentials}, lastUpdated => 1247254128, }, + + 'summary template' => { + message => q|Summary Template|, + lastUpdated => 0, + context => q|Form label in the configuration form of the Cash module.| + }, + 'summary template help' => { + message => q|Pick a template to display the screen where the user confirms the cart summary info and agrees to pay.|, + lastUpdated => 0, + context => q|Hover help for the summary template field in the configuration form of the Cash module.| + }, + + 'password' => { + message => q|Password|, + lastUpdated => 0, + context => q|Form label in the configuration form of the iTransact module.| + }, + 'password help' => { + message => q|The password for your ITransact account.|, + lastUpdated => 0, + context => q|Hover help for the password field in the configuration form of the iTransact module.| + }, + 'Pay' => { + message => q|Pay|, + lastUpdated => 0, + context => q|Button label| + }, +}; }; 1; diff --git a/lib/WebGUI/i18n/English/PayDriver_PayPalStd.pm b/lib/WebGUI/i18n/English/PayDriver_PayPalStd.pm index df1bdcab0..a9fe25561 100644 --- a/lib/WebGUI/i18n/English/PayDriver_PayPalStd.pm +++ b/lib/WebGUI/i18n/English/PayDriver_PayPalStd.pm @@ -204,6 +204,34 @@ Additionally, set the "Return URL" to:|, lastUpdated => 1245364211, context => q|An informational message that's shown in the configuration form of this plugin.| }, + + 'summary template' => { + message => q|Summary Template|, + lastUpdated => 0, + context => q|Form label in the configuration form| + }, + 'summary template help' => { + message => q|Pick a template to display the screen where the user confirms the cart summary info and agrees to pay.|, + lastUpdated => 0, + context => q|Hover help for the summary template field in the configuration form| + }, + + 'password' => { + message => q|Password|, + lastUpdated => 0, + context => q|Form label in the configuration form of the iTransact module.| + }, + 'password help' => { + message => q|The password for your ITransact account.|, + lastUpdated => 0, + context => q|Hover help for the password field in the configuration form of the iTransact module.| + }, + 'Pay' => { + message => q|Pay|, + lastUpdated => 0, + context => q|Button label| + }, +}; }; 1;