canUse should check whether the driver is enabled or not.
PayDrivers update the local object cache on update.
This commit is contained in:
parent
f9c917e426
commit
dc226e3268
3 changed files with 35 additions and 7 deletions
|
|
@ -13,6 +13,7 @@ use WebGUI::Macro;
|
|||
use WebGUI::User;
|
||||
use WebGUI::Shop::Cart;
|
||||
use JSON;
|
||||
use Clone qw/clone/;
|
||||
use Scalar::Util qw/blessed/;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -87,7 +88,9 @@ sub cancelRecurringPayment {
|
|||
|
||||
=head2 canUse ( user )
|
||||
|
||||
Checks to see if the user can use this Payment Driver.
|
||||
Checks to see if the user can use this Payment Driver. Ability to use
|
||||
is based on whether or not this user has the correct privileges, and if
|
||||
the driver is enabled or not.
|
||||
|
||||
=head3 user
|
||||
|
||||
|
|
@ -107,6 +110,7 @@ A user object that will be used directly.
|
|||
|
||||
sub canUse {
|
||||
my $self = shift;
|
||||
return 0 unless $self->get('enabled');
|
||||
my $user = shift;
|
||||
my $userObject;
|
||||
if (!defined $user or ref($user) ne 'HASH') {
|
||||
|
|
@ -304,7 +308,7 @@ sub get {
|
|||
return $options->{ $param };
|
||||
}
|
||||
else {
|
||||
return { %$options };
|
||||
return { %{ $options } };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -729,6 +733,8 @@ sub update {
|
|||
$jsonOptions,
|
||||
$self->paymentGatewayId
|
||||
]);
|
||||
my $storedProperties = clone $properties;
|
||||
$options{ id $self } = $storedProperties;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue