Fix 3DS authentication result

This commit is contained in:
Emili Castells Guasch 2023-11-21 14:57:55 +01:00
parent d6ad402219
commit 5e6efdd3e3
3 changed files with 22 additions and 10 deletions

View file

@ -62,19 +62,28 @@ class ThreeDSecure {
return self::NO_DECISION;
}
$result = $payment_source->properties()->authentication_result;
$this->logger->info( '3DS authentication result: ' . wc_print_r( $result->to_array(), true ) );
$authentication_result = $payment_source->properties()->authentication_result ?? null;
if ( $authentication_result ) {
$result = new AuthResult(
$authentication_result->liability_shift ?? '',
$authentication_result->three_d_secure->enrollment_status ?? '',
$authentication_result->three_d_secure->authentication_status ?? ''
);
if ( $result->liability_shift() === AuthResult::LIABILITY_SHIFT_POSSIBLE ) {
return self::PROCCEED;
$this->logger->info( '3DS authentication result: ' . wc_print_r( $result->to_array(), true ) );
if ( $result->liability_shift() === AuthResult::LIABILITY_SHIFT_POSSIBLE ) {
return self::PROCCEED;
}
if ( $result->liability_shift() === AuthResult::LIABILITY_SHIFT_UNKNOWN ) {
return self::RETRY;
}
if ( $result->liability_shift() === AuthResult::LIABILITY_SHIFT_NO ) {
return $this->no_liability_shift( $result );
}
}
if ( $result->liability_shift() === AuthResult::LIABILITY_SHIFT_UNKNOWN ) {
return self::RETRY;
}
if ( $result->liability_shift() === AuthResult::LIABILITY_SHIFT_NO ) {
return $this->no_liability_shift( $result );
}
return self::NO_DECISION;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long