Add a method for Payment Drivers to see if they can used by a particular user, canUse.
Add some tests for the method. Have Pay->getOptions use the method.
This commit is contained in:
parent
a3274f47ec
commit
8779905ac3
4 changed files with 66 additions and 3 deletions
|
|
@ -91,7 +91,10 @@ sub getDrivers {
|
|||
|
||||
=head2 getOptions ( $cart )
|
||||
|
||||
Returns a list of options for the user to pay to. It is a hash of hashrefs, with the key of the primary hash being the paymentGatewayId of the driver, and sub keys of label and button.
|
||||
Returns a set of options for the user to pay to. It is a hash of
|
||||
hashrefs, with the key of the primary hash being the paymentGatewayId
|
||||
of the driver, and sub keys of label and button. The hash will only
|
||||
contain payment gateways that this user is allowed to use.
|
||||
|
||||
=head3 $cart
|
||||
|
||||
|
|
@ -110,6 +113,7 @@ sub getOptions {
|
|||
my %options = ();
|
||||
|
||||
foreach my $gateway (@{ $self->getPaymentGateways() }) {
|
||||
next unless $gateway->canUse;
|
||||
if (!$recurringRequired || $gateway->handlesRecurring) {
|
||||
$options{$gateway->getId} = {
|
||||
label => $gateway->get("label"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue