feat(payments): rename match reason from 'exact_amount_different_dni' to 'exact_amount_near_dni'
This commit is contained in:
@@ -317,7 +317,7 @@ class TelepagosWebhookService
|
|||||||
abs((float) $purchaseAmount - (float) $amount),
|
abs((float) $purchaseAmount - (float) $amount),
|
||||||
),
|
),
|
||||||
'match_reason' => $amountMatches
|
'match_reason' => $amountMatches
|
||||||
? ($dniMatches ? 'ambiguous_exact_match' : 'exact_amount_different_dni')
|
? ($dniMatches ? 'ambiguous_exact_match' : 'exact_amount_near_dni')
|
||||||
: 'exact_dni_near_amount',
|
: 'exact_dni_near_amount',
|
||||||
'confidence' => $amountMatches
|
'confidence' => $amountMatches
|
||||||
? ($dniMatches ? 'exact' : 'medium')
|
? ($dniMatches ? 'exact' : 'medium')
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class PurchaseResource extends JsonResource
|
|||||||
return match ($reason) {
|
return match ($reason) {
|
||||||
'ambiguous_exact_match' => 0,
|
'ambiguous_exact_match' => 0,
|
||||||
'exact_dni_near_amount' => 1,
|
'exact_dni_near_amount' => 1,
|
||||||
'exact_amount_different_dni' => 2,
|
'exact_amount_near_dni' => 2,
|
||||||
default => 3,
|
default => 3,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
DB::table('telepagos_payment_candidates')
|
||||||
|
->where('match_reason', 'exact_amount_different_dni')
|
||||||
|
->update(['match_reason' => 'exact_amount_near_dni']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
DB::table('telepagos_payment_candidates')
|
||||||
|
->where('match_reason', 'exact_amount_near_dni')
|
||||||
|
->update(['match_reason' => 'exact_amount_different_dni']);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -455,7 +455,7 @@ class TelepagosWebhookTest extends TestCase
|
|||||||
'payment_amount' => 50,
|
'payment_amount' => 50,
|
||||||
'purchase_amount' => 50,
|
'purchase_amount' => 50,
|
||||||
'amount_difference' => 0,
|
'amount_difference' => 0,
|
||||||
'match_reason' => 'exact_amount_different_dni',
|
'match_reason' => 'exact_amount_near_dni',
|
||||||
'confidence' => 'medium',
|
'confidence' => 'medium',
|
||||||
]);
|
]);
|
||||||
$this->assertDatabaseHas('telepagos_payment_candidates', [
|
$this->assertDatabaseHas('telepagos_payment_candidates', [
|
||||||
@@ -466,7 +466,7 @@ class TelepagosWebhookTest extends TestCase
|
|||||||
'payment_dni' => '12345678',
|
'payment_dni' => '12345678',
|
||||||
'purchase_dni' => '12345087',
|
'purchase_dni' => '12345087',
|
||||||
'amount_matches' => true,
|
'amount_matches' => true,
|
||||||
'match_reason' => 'exact_amount_different_dni',
|
'match_reason' => 'exact_amount_near_dni',
|
||||||
]);
|
]);
|
||||||
$this->assertDatabaseMissing('telepagos_payment_candidates', [
|
$this->assertDatabaseMissing('telepagos_payment_candidates', [
|
||||||
'telepagos_payment_id' => $payment->id,
|
'telepagos_payment_id' => $payment->id,
|
||||||
|
|||||||
Reference in New Issue
Block a user