Skip to content

Commit 3942580

Browse files
reformat code
1 parent 83f6cec commit 3942580

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/services/customerPaymentService.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,18 @@ async function sendCustomerPaymentMessage(event, customerPayment, req) {
8787
export async function createCustomerPayment(
8888
amount, currency, paymentMethodId, reference, referenceId, receiptEmail, userId, req,
8989
) {
90-
const intent = await convertStripError(() => stripe.paymentIntents.create({
90+
const intentBody = {
9191
amount,
9292
currency: _.lowerCase(currency),
9393
payment_method: paymentMethodId,
9494
capture_method: STRIPE_CONSTANT.CAPTURE_METHOD,
9595
confirmation_method: STRIPE_CONSTANT.CONFIRMATION_METHOD,
9696
confirm: true,
97-
...(receiptEmail ? { receipt_email: receiptEmail } : {}),
98-
}));
97+
};
98+
if (receiptEmail) {
99+
intentBody.receipt_email = receiptEmail;
100+
}
101+
const intent = await convertStripError(() => stripe.paymentIntents.create(intentBody));
99102
const customerPayment = await models.CustomerPayment.create({
100103
reference,
101104
referenceId,

0 commit comments

Comments
 (0)