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 862559599..f82b31164 100644 --- a/docs/upgrades/upgrade_7.9.3-7.9.4.pl +++ b/docs/upgrades/upgrade_7.9.3-7.9.4.pl @@ -165,6 +165,9 @@ sub addPayDriverTemplates { if ($gateway->isa('WebGUI::Shop::PayDriver::Cash')) { $properties->{summaryTemplateId} = '30h5rHxzE_Q0CyI3Gg7EJw'; } + elsif ($gateway->isa('WebGUI::Shop::PayDriver::Ogone')) { + $properties->{summaryTemplateId} = 'jysVZeUR0Bx2NfrKs5sulg'; + } $gateway->update($properties); } print "DONE!\n" unless $quiet; diff --git a/lib/WebGUI/Shop/PayDriver/ITransact.pm b/lib/WebGUI/Shop/PayDriver/ITransact.pm index 50fe977e6..de6bc0665 100644 --- a/lib/WebGUI/Shop/PayDriver/ITransact.pm +++ b/lib/WebGUI/Shop/PayDriver/ITransact.pm @@ -469,27 +469,6 @@ sub doXmlRequest { #------------------------------------------------------------------- -=head2 getButton - -Return a form to select this payment driver and to accept credentials from those -who wish to use it. - -=cut - -sub getButton { - my $self = shift; - my $session = $self->session; - - my $payForm = WebGUI::Form::formHeader($session) - . $self->getDoFormTags('getCredentials') - . WebGUI::Form::submit($session, {value => $self->get('label') }) - . WebGUI::Form::formFooter($session); - - return $payForm; -} - -#------------------------------------------------------------------- - =head2 handlesRecurring Tells the commerce system that this payment plugin can handle recurring payments. diff --git a/lib/WebGUI/Shop/PayDriver/Ogone.pm b/lib/WebGUI/Shop/PayDriver/Ogone.pm index de95ed1c0..81a6687b3 100644 --- a/lib/WebGUI/Shop/PayDriver/Ogone.pm +++ b/lib/WebGUI/Shop/PayDriver/Ogone.pm @@ -101,6 +101,13 @@ sub definition { hoverHelp => $i18n->get('use test mode help'), defaultValue => 1, }, + summaryTemplateId => { + fieldType => 'template', + label => $i18n->get('summary template'), + hoverHelp => $i18n->get('summary template help'), + namespace => 'Shop/Credentials', + defaultValue => 'jysVZeUR0Bx2NfrKs5sulg', + }, ); push @{ $definition }, { @@ -113,28 +120,6 @@ sub definition { #------------------------------------------------------------------- -=head2 getButton ( ) - -Returns the HTML for a form containing a button that, when clicked, will take the user to the checkout screen of -this plugin. - -=cut - -sub getButton { - my $self = shift; - my $session = $self->session; - my $i18n = WebGUI::International->new($session, 'PayDriver_Ogone'); - - my $payForm = WebGUI::Form::formHeader($session) - . $self->getDoFormTags('getCredentials') - . WebGUI::Form::submit($session, {value => $i18n->get('Ogone') }) - . WebGUI::Form::formFooter($session); - - return $payForm; -} - -#------------------------------------------------------------------- - =head2 getCart Returns the cart for either the current user or the transaction passed back by Ogone. @@ -287,17 +272,6 @@ sub www_getCredentials { my $session = $self->session; my $i18n = WebGUI::International->new( $session, 'PayDriver_Ogone' ); - # Process address from address book if passed - $addressId = $session->form->process( 'addressId' ); - my $address; - if ( $addressId ) { - $address = eval{ $self->getAddress( $addressId ) }; - } - else { - $address = $self->getCart->getShippingAddress; - } - my $billingAddressHtml = $address->getHtmlFormatted; - # Fetch transaction my $transactionId = $session->form->process('transactionId'); my $transaction; @@ -307,41 +281,26 @@ sub www_getCredentials { # Or generate a new one unless ($transaction) { - $transaction = $self->processTransaction( $address ); + $transaction = $self->processTransaction( ); } - # Set the billing address - $transaction->update( { - paymentAddress => $address, - } ); - - # Generate the json string that defines where the address book posts the selected address - my $callbackParams = { - url => $session->url->page, - params => [ - { name => 'shop', value => 'pay' }, - { name => 'method', value => 'do' }, - { name => 'do', value => 'getCredentials' }, - { name => 'paymentGatewayId', value => $self->getId }, - ], - }; - my $callbackJson = JSON::to_json( $callbackParams ); - - # Generate 'Choose billing address' button - my $addressButton = WebGUI::Form::formHeader( $session ) - . WebGUI::Form::hidden( $session, { name => 'shop', value => 'address' } ) - . WebGUI::Form::hidden( $session, { name => 'method', value => 'view' } ) - . WebGUI::Form::hidden( $session, { name => 'callback', value => $callbackJson } ) - . WebGUI::Form::submit( $session, { value => $i18n->get('choose billing address') } ) - . WebGUI::Form::formFooter( $session); - - # Generate 'Proceed' button - my $proceedButton = $address - ? $self->ogoneCheckoutButton( $transaction, $address ) - : $i18n->get('please choose a billing address') - ; - return $session->style->userStyle($addressButton.'
'.$billingAddressHtml.'
'.$proceedButton); + my $var = { + proceedButton => $self->ogoneCheckoutButton, + }; + $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); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/i18n/English/PayDriver_Cash.pm b/lib/WebGUI/i18n/English/PayDriver_Cash.pm index 2e75be4b4..a731d08a4 100644 --- a/lib/WebGUI/i18n/English/PayDriver_Cash.pm +++ b/lib/WebGUI/i18n/English/PayDriver_Cash.pm @@ -164,7 +164,7 @@ our $I18N = { lastUpdated => 0, context => q|Form label in the configuration form of the Cash module.| }, - 'summary template help' => { + '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.| diff --git a/lib/WebGUI/i18n/English/PayDriver_Ogone.pm b/lib/WebGUI/i18n/English/PayDriver_Ogone.pm index 4c9f1e4cd..ee044c12d 100755 --- a/lib/WebGUI/i18n/English/PayDriver_Ogone.pm +++ b/lib/WebGUI/i18n/English/PayDriver_Ogone.pm @@ -80,6 +80,34 @@ our $I18N = { context => q|Hover help of a setting in the ogone config screen.|, }, + '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| + }, +}; + 'pay' => { message => q|Pay|, lastUpdated => 0,