Update both paypal drivers for the new shop checkout procedure.

This commit is contained in:
Colin Kuskie 2010-04-28 15:26:39 -07:00
parent 17dd742c08
commit 470710abb9
6 changed files with 118 additions and 2 deletions

View file

@ -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,

View file

@ -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;