Feat: Payment Restructuring to be fully event-driven
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* lunarphp/stripe's own stripe_payment_intents table already correlates a
|
||||
* Stripe intent back to a cart/order via cart_id/order_id — exactly what
|
||||
* Modules\Core\Payment\Drivers\StripePaymentDriver needs to recover
|
||||
* $context in handleCallback(), a separate request (a webhook) from the
|
||||
* pay()/authorize() call that originated it. Two columns this driver
|
||||
* needs that the vendor table doesn't have:
|
||||
* - context: the full opaque $context bag pay()/authorize() received,
|
||||
* stored so handleCallback() can dispatch the SAME context the
|
||||
* original call would have, without Payment inventing its own
|
||||
* correlation table — see docs/payments.md "Async resolution".
|
||||
* - payment_type: the payment type key (e.g. 'stripe') pay()/authorize()
|
||||
* were called with — needed to dispatch Payment events with the
|
||||
* correct $type in handleCallback(), which otherwise has no way to
|
||||
* know it (a webhook payload doesn't carry it).
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('stripe_payment_intents', function (Blueprint $table) {
|
||||
$table->json('context')->nullable()->after('status');
|
||||
$table->string('payment_type')->nullable()->after('context');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('stripe_payment_intents', function (Blueprint $table) {
|
||||
$table->dropColumn(['context', 'payment_type']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user