From b9edc2592d8983060e8334074d1acb0c6bd82bf9 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 11 Dec 2008 16:28:58 +0000 Subject: [PATCH] Forward port templated ITransact edit credentials screen. --- docs/changelog/7.x.x.txt | 1 + ...llateral-items_itransact-credentials.wgpkg | Bin 0 -> 1423 bytes lib/WebGUI/Help/PayDriver_ITransact.pm | 104 ++++++++++++ lib/WebGUI/Shop/PayDriver/ITransact.pm | 155 +++++++++--------- .../i18n/English/PayDriver_ITransact.pm | 103 ++++++++++++ 5 files changed, 288 insertions(+), 75 deletions(-) create mode 100644 docs/upgrades/packages-7.6.6/shopping-cart-collateral-items_itransact-credentials.wgpkg create mode 100644 lib/WebGUI/Help/PayDriver_ITransact.pm diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index cbf995fee..b9e2e2608 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/docs/upgrades/packages-7.6.6/shopping-cart-collateral-items_itransact-credentials.wgpkg b/docs/upgrades/packages-7.6.6/shopping-cart-collateral-items_itransact-credentials.wgpkg new file mode 100644 index 0000000000000000000000000000000000000000..0d23b1c56be0fa953f46bcd5957496b06c13afa6 GIT binary patch literal 1423 zcmV;A1#tQwiwFP!00000|Ls^?PvbZg?(_VLsPi%-QJNIWCDTQMVHhgSFi2cxSKD3W zCT`=!wIkc1lo9`ZkDZH6X;~_Qv=8K=Npmj#&asdEovb%r|MGo*yW4Fv^nGj7+=ETH zd)4JPf*|Ples^=z_Zwai_Oe!P*TEr<~*UQJtBo=bHSO*7}3C`S~Q2jrN z3~ER>T;_MTcwYZUa#j;i@V%wy8}19{KY&^9&dvX3XS>_*Ae*m$z1IA%zdrOjM)>s( zim)ja7if%|Ug-V#*P3~i3Z7!22$uS-QPY|fN%iG6M78@A|nqA!Nt`CWH8Bv5X7#vQ31=`<_3v*BUWzKy^QV+>_0OG zGigkWmTQiAp0JV|9ipj#Lr&L8cUErLh@I ztBtsr=%s>1B|<~$SY;nSLG;>@PC#6Sl8@vhsxmqvn8puv!O%kNInU34s|)r?w57r-U`v~t zv7&qdFHLMAUj=DlQZvwqsM%7KTDS^CtzR=fv)e8OXr!wkGzK+8jCj1fg0yfIfLgzH zd>K>XiCN}Gz8XqnQZvvr;S8T-lOYyMXWZy`%qXpb*x1#K7f%qOOOYDs+9{eH3UUJx z_0Nlg_?g?Nv9B31P=xqD5^PmofZaN&Ie-agD)|GWsT8y1k+1{{qAmnI5`1!s1Q6SK?g?Em zE?R*mG;Bp%_^>&&9?i+{IYDf^i1Zt3s>z2L0}z37MGz9!FMcwREusz)ej?gaGF5pRk@iUF(xeZ9ks`%_c;&; zy_rr6J@?X5JawVuW~P^LOxJUczbNeYPz4pTMQBH`zqY1%XhTlpO1a2To(-Ff$G{0o zGqvV9c%U4p3g~mmfz3=-MehZ)f5E;Hq$k!i}ba?619+77=3C*#I(uoeL+ { + 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; diff --git a/lib/WebGUI/Shop/PayDriver/ITransact.pm b/lib/WebGUI/Shop/PayDriver/ITransact.pm index c26101c9a..ca048d361 100644 --- a/lib/WebGUI/Shop/PayDriver/ITransact.pm +++ b/lib/WebGUI/Shop/PayDriver/ITransact.pm @@ -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') - . '
  • ' . join( '
  • ', @{ $errors } ) . '
'; + 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)); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/i18n/English/PayDriver_ITransact.pm b/lib/WebGUI/i18n/English/PayDriver_ITransact.pm index 13a0ea977..3bffb793b 100644 --- a/lib/WebGUI/i18n/English/PayDriver_ITransact.pm +++ b/lib/WebGUI/i18n/English/PayDriver_ITransact.pm @@ -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,