a little streamlining
This commit is contained in:
parent
31729dc14a
commit
fdb151fc35
2 changed files with 5 additions and 14 deletions
|
|
@ -482,14 +482,14 @@ sub processTransaction {
|
|||
my ($self, $paymentAddress) = @_;
|
||||
my $cart = $self->getCart;
|
||||
my $transaction = WebGUI::Shop::Transaction->create($self->session,{
|
||||
cart => $cart,
|
||||
paymentMethod => $self,
|
||||
paymentAddress => $paymentAddress,
|
||||
});
|
||||
my ($success, $transactionCode, $statusCode, $statusMessage) = $self->processPayment;
|
||||
if ($success) {
|
||||
$transaction->completePurchase($cart, $transactionCode, $statusCode, $statusMessage);
|
||||
$self->sendNotifications($transaction);
|
||||
$transaction->completePurchase($cart, $transactionCode, $statusCode, $statusMessage);
|
||||
$cart->onCompletePurchase;
|
||||
$self->sendNotifications($transaction);
|
||||
}
|
||||
else {
|
||||
$transaction->denyTransaction($transactionCode, $statusCode, $statusMessage);
|
||||
|
|
|
|||
|
|
@ -67,18 +67,10 @@ sub addItem {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 completePurchase ( cart transactionCode, statusCode, statusMessage )
|
||||
=head2 completePurchase ( transactionCode, statusCode, statusMessage )
|
||||
|
||||
See also denyPurchase(). Completes a purchase by updating the transaction as a success, and clearing the cart of it's items.
|
||||
|
||||
=head3 cart
|
||||
|
||||
A reference to the current cart that's full of items just purchased.
|
||||
|
||||
=head3 paydriver
|
||||
|
||||
A reference to the pay driver that just completed the transaction.
|
||||
|
||||
=head3 transactionCode
|
||||
|
||||
The transaction id or code given by the payment gateway.
|
||||
|
|
@ -94,8 +86,7 @@ The extended status message that came back from the payment gateway when trying
|
|||
=cut
|
||||
|
||||
sub completePurchase {
|
||||
my ($self, $cart, $transactionCode, $statusCode, $statusMessage) = @_;
|
||||
$cart->onCompletePurchase;
|
||||
my ($self, $transactionCode, $statusCode, $statusMessage) = @_;
|
||||
$self->update({
|
||||
transactionCode => $transactionCode,
|
||||
isSuccessful => 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue