1. Hook & Problem Statement
You're building a Laravel application. You need to create a payment processor. So you write:
$processor = new StripePaymentProcessor(
config('services.stripe.secret'),
config('services.stripe.webhook_secret')
);
Then you need to create a different processor for another part of the system:
$processor = new PayPalPaymentProcessor(
config('services.paypal.client_id'),
config('services.paypal.secret')
);
Then the requirements change. The payment processor now needs a logger, a metrics service, and a cache manager. You find yourself updating every new statement across 15 different controllers and services.
Then the business says: "We want to support a new payment gateway." You search your codebase for new StripePaymentProcessor and new PayPalPaymentProcessor, and you find them scattered across 20 files. You copy-paste the pattern for the new gateway, but you miss a few places. The system breaks in production.
Thi
Discussion
Be the first to comment
Add your perspective to get the discussion started.