UNPKG

@malga-checkout/core

Version:
22 lines (21 loc) 537 B
import { formatCustomerPayload } from './base-provider.utils'; export class BaseProvider { constructor({ customerId, customer }) { this.customerId = customerId; this.customer = customer; } getCustomerMethod() { if (this.customerId) { return { customerId: this.customerId, }; } return { customer: formatCustomerPayload(this.customer), }; } getPaymentSource() { const customer = this.getCustomerMethod(); return Object.assign({ sourceType: 'customer' }, customer); } }