Saber Commerce includes a core component named “Payment” which lives at /components/Payment. The payment component has the namespace \SaberCommerce\Component\Payment.
PHP classes in the Payment Component include:
The payment system has two data models, the PaymentModel and the PaymentInvoiceModel. We can think of a “payment” as a record stored in the database referencing a single processed transaction. The “payment_invoice” is designed to hold the reference associating a payment to an invoice.
In the future it is possible that instead of “invoice” we might use a more generic association such as “payment_target”. The point is to connect payments to the “thing that is being paid”. Currently that is one or more invoices. The use of a one-to-many relationship between payments and invoices does enable support for payment of multiple invoices in a single transaction. The amount paid (per invoice) is recorded in the PaymentInvoice record.
Each of these data models has a custom database table where the model data is stored.
In the first version of SACOM only 1 payment method is provided and this is Stripe. The early stages of supporting multiple payment systems or different payment methods is in place, but will undergo more changes to become extendable.
Payment methods are housed in the PaymentComponent in the /Methods folder.
For Stripe support the Stripe official PHP SDK is loaded. This may cause interference with other plugins that also load a Stripe PHP SDK version.
Stripe payment integration is contained inside the folder components\Payment\Methods\Stripe.
The namespace for the Stripe Payment Method is SaberCommerce\Component\Payment\Methods\Stripe.
The main class for the Stripe Payment integration is \SaberCommerce\Component\Payment\Methods\StripeStripePayments which extends the \SaberCommerce\Component\Payment\PaymentMethod abstract class.
Currently the base payment class doesn’t do anything and is only extended as part of future proofing the integration. The addition of more payment methods will likely result in changes to the configuration and structure.
Powered by BetterDocs