Forward port templated ITransact edit credentials screen.

This commit is contained in:
Colin Kuskie 2008-12-11 16:28:58 +00:00
parent c15cc0ca51
commit b9edc2592d
5 changed files with 288 additions and 75 deletions

View file

@ -3,6 +3,7 @@
- fixed: Alter WebGUI::Asset::Template's update method so that it can import packages that use the old, deprecated headBlock property. The update method change is deprecatd.
- fixed #9266: controls missing on product asset
- fixed #9150: Edit Data Table - Cannot add column (David Delikat)
- fixed #9261: Cart Payment Screen not templated
7.6.6
- fixed #8792: Image Preview gives ERROR in Collateral Manager

View file

@ -0,0 +1,104 @@
package WebGUI::Help::Shop::PayDriver::ITransact;
use strict;
our $HELP = {
'edit credentials template' => {
title => 'edit credentials template',
body => 'edit credentials template help',
isa => [],
fields => [],
variables => [
{
name => "errors",
description => "errors help",
required => 1,
},
{
name => "error",
description => "error help",
required => 1,
},
{
name => "formHeader",
description => "formHeader help",
required => 1,
namespace => 'Shop',
},
{
name => "formFooter",
description => "formFooter help",
required => 1,
namespace => 'Shop',
},
{
name => "addressField",
description => "addressField help",
required => 1,
},
{
name => "cityField",
description => "cityField help",
required => 1,
namespace => 'Shop',
},
{
name => "stateField",
description => "stateField help",
required => 1,
namespace => 'Shop',
},
{
name => "countryField",
description => "countryField help",
required => 1,
namespace => 'Shop',
},
{
name => "codeField",
description => "codeField help",
required => 1,
namespace => 'Shop',
},
{
name => "phoneField",
description => "phoneNumberField help",
required => 1,
namespace => 'Shop',
},
{
name => "emailField",
description => "emailNumberField help",
required => 1,
},
{
name => "cardNumberField",
description => "cardNumberField help",
required => 1,
},
{
name => "monthYearField",
description => "monthYearNumberField help",
required => 1,
},
{
name => "cvv2Field",
description => "cvv2NumberField help",
required => 1,
},
{
name => "checkoutButton",
description => "checkoutButton help",
required => 1,
namespace => 'Shop',
},
],
related => [
],
},
};
1;

View file

@ -367,6 +367,12 @@ sub definition {
label => $i18n->get('use cvv2'),
hoverHelp => $i18n->get('use cvv2 help'),
},
credentialsTemplateId => {
fieldType => 'template',
label => $i18n->get('credentials template'),
hoverHelp => $i18n->get('credentials template help'),
namespace => 'Shop/Credentials',
},
emailMessage => {
fieldType => 'textarea',
label => $i18n->get('emailMessage'),
@ -617,91 +623,90 @@ sub www_getCredentials {
}
my $output;
my $var = {};
# Process form errors
if ( $errors ) {
$var->{errors} = [];
#### TODO: i18n
$output .= $i18n->get('error occurred message')
. '<ul><li>' . join( '</li><li>', @{ $errors } ) . '</li></ul>';
if ($errors) {
$var->{error_message} = $i18n->get('error occurred message');
foreach my $error (@{ $errors} ) {
push @{ $var->{errors} }, { error => $error };
}
}
$output .= $self->getSelectAddressButton( 'getCredentials' );
$var->{getSelectAddressButton} = $self->getSelectAddressButton( 'getCredentials' );
$self->session->log->warn("selectAddressButton: ".$var->{getSelectAddressButton});
$var->{formHeader} = WebGUI::Form::formHeader($session)
. $self->getDoFormTags('pay');
if ($var->{formHeader}) {
$var->{formHeader} .= WebGUI::Form::hidden($session, {name => 'addressId', value => $addressId});
}
$var->{formFooter} = WebGUI::Form::formFooter();
$self->session->log->warn("formHeader: ".$var->{formHeader});
my $f = WebGUI::HTMLForm->new( $session );
$self->getDoFormTags( 'pay', $f );
$f->hidden(
-name => 'addressId',
-value => $addressId,
) if $addressId;
# Address data form
$f->text(
-name => 'firstName',
-label => $i18n->get('firstName'),
-value => $form->process("firstName") || $addressData->{ "firstName" } || $u->profileField('firstName'),
);
$f->text(
-name => 'lastName',
-label => $i18n->get('lastName'),
-value => $form->process("lastName") || $addressData->{ "lastName" } || $u->profileField('lastName'),
);
$f->text(
-name => 'address',
-label => $i18n->get('address'),
-value => $form->process("address") || $addressData->{ address1 } || $u->profileField('homeAddress'),
);
$f->text(
-name => 'city',
-label => $i18n->get('city'),
-value => $form->process("city") || $addressData->{ city } || $u->profileField('homeCity'),
);
$f->text(
-name => 'state',
-label => $i18n->get('state'),
-value => $form->process("state") || $addressData->{ state } || $u->profileField('homeState'),
);
$f->zipcode(
-name => 'zipcode',
-label => $i18n->get('zipcode'),
-value => $form->process("zipcode") || $addressData->{ code } || $u->profileField('homeZip'),
);
$f->country(
-name => "country",
-label => $i18n->get("country"),
-value => ($form->process("country",'country') || $addressData->{ country } || $u->profileField("homeCountry") || 'United States'),
);
$f->phone(
-name => "phone",
-label => $i18n->get("phone"),
-value => $form->process("phone",'phone') || $addressData->{ phoneNumber } || $u->profileField("homePhone"),
);
$f->email(
-name => 'email',
-label => $i18n->get('email'),
-value => $self->session->form->process("email") || $u->profileField('email'),
);
$var->{firstNameField} = WebGUI::Form::text($session, {
name => 'firstName',
value => $form->process("firstName") || $addressData->{ "firstName" } || $u->profileField('firstName'),
});
$var->{lastNameField} = WebGUI::Form::text($session, {
name => 'lastName',
value => $form->process("lastName") || $addressData->{ "lastName" } || $u->profileField('lastName'),
});
$var->{addressField} = WebGUI::Form::text($session, {
name => 'address',
value => $form->process("address") || $addressData->{ address1 } || $u->profileField('homeAddress'),
});
$var->{cityField} = WebGUI::Form::text($session, {
name => 'city',
value => $form->process("city") || $addressData->{ city } || $u->profileField('homeCity'),
});
$var->{stateField} = WebGUI::Form::text($session, {
name => 'state',
value => $form->process("state") || $addressData->{ state } || $u->profileField('homeState'),
});
$var->{codeField} = WebGUI::Form::zipcode($session, {
name => 'zipcode',
value => $form->process("zipcode") || $addressData->{ code } || $u->profileField('homeZip'),
});
$var->{countryField} = WebGUI::Form::country($session, {
name => 'country',
value => ($form->process("country",'country') || $addressData->{ country } || $u->profileField("homeCountry") || 'United States'),
});
$var->{phoneField} = WebGUI::Form::phone($session, {
name => 'phone',
value => $form->process("phone",'phone') || $addressData->{ phoneNumber } || $u->profileField("homePhone"),
});
$var->{emailField} = WebGUI::Form::email($session, {
name => 'email',
value => $self->session->form->process("email") || $u->profileField('email'),
});
# Credit card information
$f->text(
-name => 'cardNumber',
-label => $i18n->get('cardNumber'),
-value => $self->session->form->process("cardNumber"),
);
$f->readOnly(
-label => $i18n->get('expiration date'),
-value => _monthYear( $session ),
);
$f->integer(
-name => 'cvv2',
-label => $i18n->get('cvv2'),
-value => $self->session->form->process("cvv2")
) if ($self->get('useCVV2'));
$f->submit(
-value => 'Checkout',
);
$output .= $f->print;
return $session->style->userStyle( $output );
$var->{cardNumberField} = WebGUI::Form::text($session, {
name => 'cardNumber',
value => $self->session->form->process("cardNumber"),
});
$var->{monthYearField} = WebGUI::Form::readOnly($session, {
value => _monthYear( $session ),
});
$var->{cvv2Field} = WebGUI::Form::integer($session, {
name => 'cvv2',
value => $self->session->form->process("cvv2"),
}) if $self->get('useCVV2');
$var->{checkoutButton} = WebGUI::Form::submit($session, {
value => $i18n->get('checkout button', 'Shop'),
});
my $template = WebGUI::Asset::Template->new($session, $self->get("credentialsTemplateId"));
$template->prepare;
return $session->style->userStyle($template->process($var));
}
#-------------------------------------------------------------------

View file

@ -112,6 +112,109 @@ our $I18N = {
},
'credentials template' => {
message => q|Credentials Template|,
lastUpdated => 0,
context => q|Form label in the configuration form of the iTransact module.|
},
'credentials template help' => {
message => q|Pick a template to display the form where the user will enter in their billing information and credit card information.|,
lastUpdated => 0,
context => q|Hover help for the credentials template field in the configuration form of the iTransact module.|
},
'edit credentials template' => {
message => q|Edit Credentials Template|,
lastUpdated => 0,
context => q|Title of the help page.|
},
'edit credentials template help' => {
message => q|This template is used to display a form to the user where they can enter in contact and credit card billing information.|,
lastUpdated => 0,
context => q|Title of the help page.|
},
'errors help' => {
message => q|A template loop containing a list of errors from processing the form.|,
lastUpdated => 0,
context => q|Template variable help.|
},
'error help' => {
message => q|One error from the errors loop. It will have minimal markup.|,
lastUpdated => 0,
context => q|Template variable help.|
},
'checkoutButton help' => {
message => q|A button with an internationalized label to submit the form and continue the checkout process.|,
lastUpdated => 0,
context => q|Template variable help.|
},
'addressField help' => {
message => q|A single text field for the user to enter in their street address.|,
lastUpdated => 0,
context => q|Template variable help.|
},
'emailField help' => {
message => q|A single text field for the user to enter in their street address.|,
lastUpdated => 0,
context => q|Template variable help.|
},
'cardNumberField help' => {
message => q|A single text field for the user to enter in their credit card number.|,
lastUpdated => 0,
context => q|Template variable help.|
},
'monthYearField help' => {
message => q|A combination form field for the user to enter in the month and year of the expiration date for the credit card.|,
lastUpdated => 0,
context => q|Template variable help.|
},
'cvv2Field help' => {
message => q|A single text field for the user to enter in their credit card verification number. If the PayDriver is not configured to use CVV2, then this field will be empty.|,
lastUpdated => 0,
context => q|Template variable help.|
},
'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.|
},
'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.|
},
'credentials template' => {
message => q|Credentials Template|,
lastUpdated => 0,
context => q|Form label in the configuration form of the iTransact module.|
},
'credentials template help' => {
message => q|Pick a template to display the form where the user will enter in their billing information and credit card information.|,
lastUpdated => 0,
context => q|Hover help for the credentials template field in the configuration form of the iTransact module.|
},
'password' => {
message => q|Password|,
lastUpdated => 0,