Only count completed payment.

Failed payment shouldn't be counted when calculating order payment state.
Merge pull request #1613 from kayue/patch-20

[Bug] Failed payment shouldn't be counted when confirming an order.