@malga-checkout/core
Version:
Core components for Malga Checkout
22 lines (21 loc) • 537 B
JavaScript
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);
}
}