Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openstack-uicore-foundation",
"version": "5.0.8",
"version": "5.0.9-beta.1",
"description": "ui reactjs components for openstack marketing site",
"main": "lib/openstack-uicore-foundation.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/components/mui/StripePayment/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const StripePayment = ({
paymentProfile,
client,
redirectUrl,
paymentOptions,
stripeFormTitle,
onPaymentSuccess,
onPaymentError,
Expand All @@ -47,6 +48,7 @@ const StripePayment = ({
client={client}
amount={paymentIntent.total_amount}
redirectUrl={redirectUrl}
paymentOptions={paymentOptions}
onSuccess={onPaymentSuccess}
onError={onPaymentError}
onPaymentMethodChange={updatePaymentIntent}
Expand Down
6 changes: 4 additions & 2 deletions src/components/mui/StripePayment/stripe-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const StripeForm = ({
amount = 0,
client,
redirectUrl,
paymentOptions = {},
onSuccess,
onError,
onPaymentMethodChange
Expand Down Expand Up @@ -75,7 +76,7 @@ const StripeForm = ({
return_url: `${window.location.origin}${redirectUrl}`,
payment_method_data: {
billing_details: {
name: `${client.first_name} ${client.last_name}`,
name: client.full_name || `${client.first_name} ${client.last_name}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid sending blank/placeholder billing names.

Line 79 can still send poor values (e.g., whitespace-only full_name or "undefined undefined"). Normalize first and only include name when non-empty.

Suggested hardening
+    const fallbackName = `${client?.first_name ?? ""} ${client?.last_name ?? ""}`.trim();
+    const billingName = (client?.full_name ?? "").trim() || fallbackName;
+
     const {error, paymentIntent} = await stripe.confirmPayment({
       elements,
       confirmParams: {
         return_url: `${window.location.origin}${redirectUrl}`,
         payment_method_data: {
           billing_details: {
-            name: client.full_name || `${client.first_name} ${client.last_name}`,
+            ...(billingName ? {name: billingName} : {}),
             email: client.email,
             ...buildAddress(client.address)
           }
         }
       },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/mui/StripePayment/stripe-form.jsx` at line 79, The billing
name currently uses client.full_name || `${client.first_name}
${client.last_name}` which can produce whitespace-only or "undefined undefined"
values; change this to compute a normalized fullName (trim strings, fallback
per-field only if defined) and only set the billing name property when the
resulting fullName is a non-empty string. Specifically, derive a variable like
fullName = (client.full_name || `${client.first_name || ''} ${client.last_name
|| ''}`).trim(), then if fullName.length > 0 include name: fullName in the
billing object (otherwise omit the name key); update the assignment site where
client.full_name, client.first_name, and client.last_name are used.

email: client.email,
...buildAddress(client.address)
}
Expand Down Expand Up @@ -114,7 +115,8 @@ const StripeForm = ({

<PaymentElement
options={{
layout: "tabs"
layout: "tabs",
...paymentOptions
}}
/>
<Button
Expand Down
Loading