WebGUI 8 adjustments and test upgrades.
This commit is contained in:
parent
9a4703eca0
commit
3b9f7ae127
14 changed files with 115 additions and 132 deletions
|
|
@ -1076,8 +1076,8 @@ sub www_preview {
|
|||
my $session = $self->session;
|
||||
return $session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $form = $session->form;
|
||||
my $http = $session->http;
|
||||
my $form = $session->form;
|
||||
my $response = $session->response;
|
||||
|
||||
try {
|
||||
my $output = $self->processRaw(
|
||||
|
|
@ -1087,14 +1087,14 @@ sub www_preview {
|
|||
$form->get('parser'),
|
||||
);
|
||||
if ($form->get('plainText')) {
|
||||
$http->setMimeType('text/plain');
|
||||
$response->content_type('text/plain');
|
||||
}
|
||||
elsif ($output !~ /<html>/) {
|
||||
$output = $session->style->userStyle($output);
|
||||
}
|
||||
return $output;
|
||||
} catch {
|
||||
$http->setMimeType('text/plain');
|
||||
$response->content_type('text/plain');
|
||||
$_[0];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -916,7 +916,7 @@ sub www_createAccountSave {
|
|||
$profile->{'language'} = $self->session->scratch->getLanguageOverride;
|
||||
}
|
||||
$u->karma($self->session->setting->get("karmaPerLogin"),"Login","Just for logging in.") if ($self->session->setting->get("useKarma"));
|
||||
$u->updateProfileFields($profile) if ($profile);
|
||||
$u->update($profile);
|
||||
$self->update($properties);
|
||||
|
||||
my $address = {};
|
||||
|
|
@ -927,6 +927,8 @@ sub www_createAccountSave {
|
|||
$address->{$address_key} = $profile->{$fieldId} if ($address_key);
|
||||
}
|
||||
|
||||
$self->session->user({user=>$u});
|
||||
|
||||
#Update or create and update the shop address
|
||||
if ( keys %$address ) {
|
||||
$address->{'isProfile' } = 1;
|
||||
|
|
@ -962,7 +964,6 @@ sub www_createAccountSave {
|
|||
});
|
||||
}
|
||||
|
||||
$self->session->user({user=>$u});
|
||||
$self->_logLogin($userId,"success");
|
||||
|
||||
if ($self->session->setting->get("runOnRegistration")) {
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ sub handler {
|
|||
return undef unless $op && $op eq 'generatePdf';
|
||||
my $asset = getRequestedAsset($session);
|
||||
return $session->privilege->noAccess unless $asset->canView;
|
||||
$session->http->setMimeType('application/pdf');
|
||||
$session->response->content_type('application/pdf');
|
||||
return cache($asset);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ property "addressBookId" => (
|
|||
property "isProfile" => (
|
||||
noFormPost => 1,
|
||||
required => 0,
|
||||
default => 0,
|
||||
);
|
||||
|
||||
has [ qw/addressId addressBook/] => (
|
||||
|
|
|
|||
|
|
@ -625,18 +625,18 @@ sub www_ajaxSearch {
|
|||
|
||||
my $name = $form->get('name');
|
||||
my $fields = {
|
||||
firstName => (split(" ",$name))[0] || "",
|
||||
lastName => (split(" ",$name))[1] || "",
|
||||
organization => $form->get('organization') || "",
|
||||
address1 => $form->get('address1') || "",
|
||||
address2 => $form->get('address2') || "",
|
||||
address3 => $form->get('address3') || "",
|
||||
city => $form->get('city') || "",
|
||||
state => $form->get('state') || "",
|
||||
code => $form->get('zipcode') || "",
|
||||
country => $form->get('country') || "",
|
||||
email => $form->get('email') || "",
|
||||
phoneNumber => $form->get('phone') || "",
|
||||
'address.firstName' => (split(" ",$name))[0] || "",
|
||||
'address.lastName' => (split(" ",$name))[1] || "",
|
||||
'address.organization' => $form->get('organization') || "",
|
||||
'address.address1' => $form->get('address1') || "",
|
||||
'address.address2' => $form->get('address2') || "",
|
||||
'address.address3' => $form->get('address3') || "",
|
||||
'address.city' => $form->get('city') || "",
|
||||
'address.state' => $form->get('state') || "",
|
||||
'address.code' => $form->get('zipcode') || "",
|
||||
'address.country' => $form->get('country') || "",
|
||||
'address.email' => $form->get('email') || "",
|
||||
'address.phoneNumber' => $form->get('phone') || "",
|
||||
};
|
||||
|
||||
my $clause = [];
|
||||
|
|
@ -645,7 +645,7 @@ sub www_ajaxSearch {
|
|||
foreach my $field (keys %$fields) {
|
||||
my $field_value = $fields->{$field};
|
||||
if($field_value) {
|
||||
$field = $session->db->dbh->quote_identifier($field);
|
||||
$field = join('.', map { $session->db->quote_identifier($_) } split(/\./, $field));
|
||||
$field_value = $field_value."%";
|
||||
push(@$clause,qq{$field like ?});
|
||||
push(@$params,$field_value);
|
||||
|
|
@ -663,8 +663,8 @@ sub www_ajaxSearch {
|
|||
|
||||
my $query = qq{
|
||||
select
|
||||
address.*,
|
||||
users.username
|
||||
users.username,
|
||||
address.*
|
||||
from
|
||||
address
|
||||
join addressBook on address.addressBookId = addressBook.addressBookId
|
||||
|
|
@ -679,7 +679,7 @@ sub www_ajaxSearch {
|
|||
push(@$var,$hash);
|
||||
}
|
||||
|
||||
$session->http->setMimeType('text/plain');
|
||||
$session->response->content_type('text/plain');
|
||||
return JSON->new->encode($var);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ sub getDrivers {
|
|||
my $self = shift;
|
||||
my %drivers = ();
|
||||
CLASS: foreach my $class (@{$self->session->config->get('paymentDrivers')}) {
|
||||
$self->session->log->warn($class);
|
||||
my $driverName = eval { WebGUI::Pluggable::instanciate($class, 'getName', [ $self->session ])};
|
||||
if ($@) {
|
||||
$self->session->log->warn("Error loading $class: $@");
|
||||
|
|
|
|||
|
|
@ -20,10 +20,26 @@ The following methods are available from this class.
|
|||
|
||||
=cut
|
||||
|
||||
use base qw/WebGUI::Shop::PayDriver/;
|
||||
use Moose;
|
||||
use WebGUI::Definition::Shop;
|
||||
extends 'WebGUI::Shop::PayDriver';
|
||||
|
||||
Readonly my $I18N => 'PayDriver_CreditCard';
|
||||
|
||||
define pluginName => 'Credit Card Base Class';
|
||||
property useCVV2 => (
|
||||
fieldType => 'yesNo',
|
||||
label => ['use cvv2', $I18N],
|
||||
hoverHelp => ['use cvv2 help', $I18N],
|
||||
);
|
||||
property credentialsTemplateId => (
|
||||
fieldType => 'template',
|
||||
label => ['credentials template', $I18N],
|
||||
hoverHelp => ['credentials template help', $I18N],
|
||||
namespace => 'Shop/Credentials',
|
||||
default => 'itransact_credentials1',
|
||||
);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _monthYear {
|
||||
my $session = shift;
|
||||
|
|
@ -92,35 +108,6 @@ sub appendCredentialVars {
|
|||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my ($class, $session, $definition) = @_;
|
||||
|
||||
my $i18n = WebGUI::International->new($session, $I18N);
|
||||
|
||||
tie my %fields, 'Tie::IxHash', (
|
||||
useCVV2 => {
|
||||
fieldType => 'yesNo',
|
||||
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',
|
||||
defaultValue => 'itransact_credentials1',
|
||||
},
|
||||
);
|
||||
|
||||
push @{ $definition }, {
|
||||
name => 'Credit Card Base Class',
|
||||
properties => \%fields,
|
||||
};
|
||||
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 processCredentials
|
||||
|
|
|
|||
|
|
@ -8,8 +8,29 @@ use DateTime;
|
|||
use Readonly;
|
||||
use Business::OnlinePayment;
|
||||
|
||||
use Moose;
|
||||
use WebGUI::Definition::Shop;
|
||||
extends 'WebGUI::Shop::PayDriver::CreditCard';
|
||||
|
||||
Readonly my $I18N => 'PayDriver_AuthorizeNet';
|
||||
|
||||
define pluginName => ['name', $I18N];
|
||||
property login => (
|
||||
fieldType => 'text',
|
||||
label => ['login', $I18N],
|
||||
hoverHelp => ['login help', $I18N],
|
||||
);
|
||||
property transaction_key => (
|
||||
fieldType => 'text',
|
||||
label => ['transaction key', $I18N],
|
||||
hoverHelp => ['transaction key help', $I18N],
|
||||
);
|
||||
property testMode => (
|
||||
fieldType => 'YesNo',
|
||||
label => ['test mode', $I18N],
|
||||
hoverHelp => ['test mode help', $I18N],
|
||||
);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
WebGUI::Shop::PayDriver::CreditCard::AuthorizeNet
|
||||
|
|
@ -87,38 +108,6 @@ sub cancelRecurringPayment {
|
|||
return $self->gatewayResponse($tx);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my ( $class, $session, $definition ) = @_;
|
||||
|
||||
my $i18n = WebGUI::International->new( $session, $I18N );
|
||||
|
||||
tie my %fields, 'Tie::IxHash', (
|
||||
login => {
|
||||
fieldType => 'text',
|
||||
label => $i18n->get('login'),
|
||||
hoverHelp => $i18n->get('login help'),
|
||||
},
|
||||
transaction_key => {
|
||||
fieldType => 'text',
|
||||
label => $i18n->get('transaction key'),
|
||||
hoverHelp => $i18n->get('transaction key help'),
|
||||
},
|
||||
testMode => {
|
||||
fieldType => 'YesNo',
|
||||
label => $i18n->get('test mode'),
|
||||
hoverHelp => $i18n->get('test mode help'),
|
||||
},
|
||||
);
|
||||
|
||||
push @{$definition}, {
|
||||
name => $i18n->get('name'),
|
||||
properties => \%fields,
|
||||
};
|
||||
|
||||
return $class->SUPER::definition( $session, $definition );
|
||||
} ## end sub definition
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 gatewayObject ( params )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue