added recurring transaction cancellation handling

This commit is contained in:
JT Smith 2008-05-23 18:21:51 +00:00
parent e67699e019
commit 54146e32a5
5 changed files with 91 additions and 1 deletions

View file

@ -64,6 +64,24 @@ sub _buildObj {
}
#-------------------------------------------------------------------
=head2 cancelRecurringPayment ( transaction )
Cancels a recurring transaction. Returns an array containing ( isSuccess, gatewayStatus, gatewayError). Needs to be overridden by subclasses capable of dealing with recurring payments.
=head3 transaction
The instanciated recurring transaction object.
=cut
sub cancelRecurringPayment {
my $self = shift;
my $transaction = shift;
WebGUI::Error::OverrideMe->throw();
}
#-------------------------------------------------------------------
=head2 className ( )

View file

@ -13,6 +13,7 @@ use WebGUI::Shop::Admin;
use WebGUI::Shop::AddressBook;
use WebGUI::Shop::Credit;
use WebGUI::Shop::TransactionItem;
use WebGUI::Shop::Pay;
=head1 NAME
@ -68,6 +69,21 @@ sub addItem {
#-------------------------------------------------------------------
=head2 cancelRecurring ( )
Cancel a recurring transaction, and calls onCancelRecurring in whatever sku is attached to this transaction.
=cut
sub cancelRecurring {
my ($self) = @_;
$self->getPaymentGateway->cancelRecurringPayment($self);
my ($item) = $self->getItems;
$item->getSku->onCancelRecurring($item);
}
#-------------------------------------------------------------------
=head2 completePurchase ( transactionCode, statusCode, statusMessage )
See also denyPurchase(). Completes a purchase by updating the transaction as a success, and calling onCompletePurchase on all the skus in the transaction.
@ -321,6 +337,21 @@ sub getItems {
return \@itemsObjects;
}
#-------------------------------------------------------------------
=head2 getPaymentGateway ()
Returns a reference to the payment gateway attached to this transaction.
=cut
sub getPaymentGateway {
my ($self) = @_;
my $pay = WebGUI::Shop::Pay->new($self->session);
return $pay->getPaymentGateway($self->get('paymentDriverId'));
}
#-------------------------------------------------------------------
=head2 new ( session, transactionId )