Handle denied authorization when capturing via order action

If nothing to capture and do not have captures, then show error.
This commit is contained in:
Alex P 2021-10-05 08:57:55 +03:00
parent 06e437e0c3
commit ea7f56c402
4 changed files with 72 additions and 36 deletions

View file

@ -117,6 +117,12 @@ class AuthorizedPaymentsProcessorTest extends TestCase
$this->assertEquals(AuthorizedPaymentsProcessor::ALREADY_CAPTURED, $this->testee->process($this->wcOrder));
}
public function testBadAuthorization() {
$this->paypalOrder = $this->createPaypalOrder([$this->createAuthorization($this->authorizationId, AuthorizationStatus::DENIED)]);
$this->assertEquals(AuthorizedPaymentsProcessor::BAD_AUTHORIZATION, $this->testee->process($this->wcOrder));
}
private function createWcOrder(string $paypalOrderId): WC_Order {
$wcOrder = Mockery::mock(WC_Order::class);
$wcOrder