Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refreshing payment_complete creates a new payment with approving_amount etc set to 0 #118

Open
gonzalovilaseca opened this issue Aug 23, 2013 · 0 comments
Milestone

Comments

@gonzalovilaseca
Copy link

If the user accidentally refreshes the browser at payment_complete, a new payment is created with all values set to zero, and state STATE_APPROVING.
The cause is this piece of code:

$instruction = $order->getPaymentInstruction();
if (null === $pendingTransaction = $instruction->getPendingTransaction()) {
$payment = $this->ppc->createPayment($instruction->getId(), $instruction->getAmount() - $instruction->getDepositedAmount());
} else {
$payment = $pendingTransaction->getPayment();
}

Shouldn't a check be placed before?
Something like:
if (( $instruction->getAmount() - $instruction->getDepositedAmount() ) > 0) {
if (null === $pendingTransaction = $instruction->getPendingTransaction()) {
$payment = $this->ppc->createPayment($instruction->getId(), $instruction->getAmount() - $instruction->getDepositedAmount());
} else {
$payment = $pendingTransaction->getPayment();
}
..etc
}

@psrpinto psrpinto added this to the 1.3.0 milestone Oct 19, 2016
@psrpinto psrpinto modified the milestones: 1.3.0, 1.3.1 Jan 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants