I have a number of payment methods but want to restrict my digital download orders to only be able to select the Credit Card method. How can I do this?
To restrict the digital download files to only use a particular payment method, you need to edit a perl script.
1. browse to your site folder and locate the 'ActinicOrder.pm' file (take a backup)
2. open the file in a text editor such as notepad
3. search for: Sub GenerateValidPayments
4. replace this whole function with the following (that is from 'Sub GenerateValidPayments' to the '}' just above the line of '#'s'):
sub GenerateValidPayments
{
my ($parrMethods, $bValidateDelivery) = @_;
if (!defined $bValidateDelivery)
{
$bValidateDelivery = $::FALSE;
}
my @arrFullList = @{$$::g_pPaymentList{'ORDER'}};
my %Lookup = GetPaymentsForLocation($bValidateDelivery);
my $nMethodID;
my $bOnlyCC = $::FALSE;
my @Response = $::Session->GetCartObject();
if ($Response[0] == $::SUCCESS)
{
my $pCartObject = $Response[2];
my $pCartList = $pCartObject->GetCartList();
@Response = ACTINIC::GetDigitalContent($pCartList, $::TRUE);
$bOnlyCC = ((scalar (keys %{$Response[2]}) > 0)) ? $::TRUE : $::FALSE;
}
foreach $nMethodID (@arrFullList)
{
if ($bOnlyCC &&
($nMethodID != 10005))
{
next;
}
if ($$::g_pPaymentList{$nMethodID}{ENABLED}) # if the method is enabled
{
#
# Is there any location dependency?
#
if ( $::g_pLocationList->{EXPECT_PAYMENT} && # if so look up the allowed payments
!$Lookup{$nMethodID}) # check for availability
{
next; # and skip if not available
}
push (@$parrMethods, $nMethodID); # add to valid payments else
}
}
#
# Add default payment method for business customers
# if it isn't in the list
#
my $sDigest = $ACTINIC::B2B->Get('UserDigest');
if ( $sDigest )
{
my @Response = ActinicOrder::GetAccountDefaultPaymentMethod($sDigest);
if ($Response[0] != $::SUCCESS)
{
return(@Response);
}
if (!$Lookup{$Response[2]}) # if the method is
{
push (@$parrMethods, $Response[2]);
}
}
}
5. in the above code '10005' in the line:
($nMethodID != 10005))
relates to the 'Credit Card Details captured for later processing' payment method. To set for a different method you can look in the 'ActinicCatalog.mdb' file (using MS Access) | PaymentMethods table' for the ID of the payment method that you want to use for digital download orders.
6. close and save the file and update your site.
If you want to set it to more than one payment method then replace:
($nMethodID != 10005))
with:
($nMethodID != 22 && $nMethodID != 900))
and change the ID numbers for the correct payment method ID's that you want to use (eg 22 = Sage Pay and 900 = Paypal).
To restrict the digital download files to only use a particular payment method, you need to edit a perl script.
1. browse to your site folder and locate the 'ActinicOrder.pm' file (take a backup)
2. open the file in a text editor such as notepad
3. search for: Sub GenerateValidPayments
4. replace this whole function with the following (that is from 'Sub GenerateValidPayments' to the '}' just above the line of '#'s'):
sub GenerateValidPayments
{
my ($parrMethods, $bValidateDelivery) = @_;
if (!defined $bValidateDelivery)
{
$bValidateDelivery = $::FALSE;
}
my @arrFullList = @{$$::g_pPaymentList{'ORDER'}};
my %Lookup = GetPaymentsForLocation($bValidateDelivery);
my $nMethodID;
my $bOnlyCC = $::FALSE;
my @Response = $::Session->GetCartObject();
if ($Response[0] == $::SUCCESS)
{
my $pCartObject = $Response[2];
my $pCartList = $pCartObject->GetCartList();
@Response = ACTINIC::GetDigitalContent($pCartList, $::TRUE);
$bOnlyCC = ((scalar (keys %{$Response[2]}) > 0)) ? $::TRUE : $::FALSE;
}
foreach $nMethodID (@arrFullList)
{
if ($bOnlyCC &&
($nMethodID != 10005))
{
next;
}
if ($$::g_pPaymentList{$nMethodID}{ENABLED}) # if the method is enabled
{
#
# Is there any location dependency?
#
if ( $::g_pLocationList->{EXPECT_PAYMENT} && # if so look up the allowed payments
!$Lookup{$nMethodID}) # check for availability
{
next; # and skip if not available
}
push (@$parrMethods, $nMethodID); # add to valid payments else
}
}
#
# Add default payment method for business customers
# if it isn't in the list
#
my $sDigest = $ACTINIC::B2B->Get('UserDigest');
if ( $sDigest )
{
my @Response = ActinicOrder::GetAccountDefaultPaymentMethod($sDigest);
if ($Response[0] != $::SUCCESS)
{
return(@Response);
}
if (!$Lookup{$Response[2]}) # if the method is
{
push (@$parrMethods, $Response[2]);
}
}
}
5. in the above code '10005' in the line:
($nMethodID != 10005))
relates to the 'Credit Card Details captured for later processing' payment method. To set for a different method you can look in the 'ActinicCatalog.mdb' file (using MS Access) | PaymentMethods table' for the ID of the payment method that you want to use for digital download orders.
6. close and save the file and update your site.
If you want to set it to more than one payment method then replace:
($nMethodID != 10005))
with:
($nMethodID != 22 && $nMethodID != 900))
and change the ID numbers for the correct payment method ID's that you want to use (eg 22 = Sage Pay and 900 = Paypal).