Skip to content

Commit d48e34c

Browse files
authored
[staff] populate attributes from userDataResponse when UpdateStorage returns data (#4982)
/cc @vishnukvmd mentioned that the json Response does not include attributes data (like customerID, StripeAccountCountry) and it is skipped in the jsonResponse while updating the storage.
2 parents ebf5a63 + 3ef7dca commit d48e34c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

infra/staff/src/components/UpdateSubscription.tsx

+20
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ interface Subscription {
2222
originalTransactionID: string;
2323
expiryTime: number;
2424
userID: string;
25+
attributes: {
26+
customerID: string;
27+
stripeAccountCountry: string;
28+
};
2529
}
2630

2731
interface UserDataResponse {
@@ -40,6 +44,10 @@ interface FormValues {
4044
transactionId: string;
4145
expiryTime: string | Date | null;
4246
userId: string;
47+
attributes: {
48+
customerID: string;
49+
stripeAccountCountry: string;
50+
};
4351
}
4452

4553
const UpdateSubscription: React.FC<UpdateSubscriptionProps> = ({
@@ -53,6 +61,10 @@ const UpdateSubscription: React.FC<UpdateSubscriptionProps> = ({
5361
transactionId: "",
5462
expiryTime: "",
5563
userId: "",
64+
attributes: {
65+
"customerID": "",
66+
"stripeAccountCountry": ""
67+
},
5668
});
5769

5870
const [isDatePickerOpen, setIsDatePickerOpen] = useState(false);
@@ -95,6 +107,10 @@ const UpdateSubscription: React.FC<UpdateSubscriptionProps> = ({
95107
"",
96108
expiryTime: expiryTime,
97109
userId: userDataResponse.subscription.userID || "",
110+
attributes: {
111+
customerID: userDataResponse.subscription.attributes.customerID || "",
112+
stripeAccountCountry: userDataResponse.subscription.attributes.stripeAccountCountry || ""
113+
}
98114
});
99115
} catch (error) {
100116
console.error("Error fetching data:", error);
@@ -156,6 +172,10 @@ const UpdateSubscription: React.FC<UpdateSubscriptionProps> = ({
156172
productId: values.productId,
157173
paymentProvider: values.provider,
158174
transactionId: values.transactionId,
175+
attributes: {
176+
customerID: values.attributes.customerID,
177+
stripeAccountCountry: values.attributes.stripeAccountCountry
178+
}
159179
};
160180

161181
try {

0 commit comments

Comments
 (0)