mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: update payment method retrieval to include _id field in Invoices component
This commit is contained in:
@@ -93,32 +93,35 @@ const Settings: FunctionComponent<ComponentProps> = (
|
||||
return;
|
||||
}
|
||||
|
||||
// get payment methods.
|
||||
const paymentMethodsResult: ListResult<BillingPaymentMethod> = await ModelAPI.getList({
|
||||
modelType: BillingPaymentMethod,
|
||||
select: {
|
||||
id: true,
|
||||
paymentProviderPaymentMethodId: true,
|
||||
paymentProviderCustomerId: true,
|
||||
isDefault: true,
|
||||
},
|
||||
query: {
|
||||
paymentProviderCustomerId: customerId,
|
||||
projectId: ProjectUtil.getCurrentProjectId()!,
|
||||
},
|
||||
sort: {},
|
||||
skip: 0,
|
||||
limit: LIMIT_PER_PROJECT
|
||||
});
|
||||
// get payment methods.
|
||||
const paymentMethodsResult: ListResult<BillingPaymentMethod> =
|
||||
await ModelAPI.getList({
|
||||
modelType: BillingPaymentMethod,
|
||||
select: {
|
||||
_id: true,
|
||||
paymentProviderPaymentMethodId: true,
|
||||
paymentProviderCustomerId: true,
|
||||
isDefault: true,
|
||||
},
|
||||
query: {
|
||||
paymentProviderCustomerId: customerId,
|
||||
projectId: ProjectUtil.getCurrentProjectId()!,
|
||||
},
|
||||
sort: {},
|
||||
skip: 0,
|
||||
limit: LIMIT_PER_PROJECT,
|
||||
});
|
||||
|
||||
if(!paymentMethodsResult || paymentMethodsResult.data.length === 0) {
|
||||
if (!paymentMethodsResult || paymentMethodsResult.data.length === 0) {
|
||||
setError("Payment methods not found. Please try again later");
|
||||
return;
|
||||
}
|
||||
|
||||
const paymentIntentResult: PaymentIntentResult =
|
||||
await stripe.confirmCardPayment(clientSecret || "", {
|
||||
payment_method: paymentMethodsResult.data[0]!.paymentProviderPaymentMethodId || ""
|
||||
payment_method:
|
||||
paymentMethodsResult.data[0]!.paymentProviderPaymentMethodId ||
|
||||
"",
|
||||
});
|
||||
|
||||
if (paymentIntentResult.error) {
|
||||
|
||||
Reference in New Issue
Block a user