Skip to content

Commit 0f88ff4

Browse files
committed
Random fixes for trolley widget
1 parent 548ff89 commit 0f88ff4

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/api/payment-providers/trolley.service.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,21 @@ export class TrolleyService {
4242
user.email,
4343
);
4444

45-
if (foundRecipient?.length === 1) {
45+
if (
46+
foundRecipient?.length === 1 &&
47+
// make sure it's same email address
48+
foundRecipient[0].email === user.email
49+
) {
4650
return foundRecipient[0];
4751
}
4852

4953
const userInfo = await this.tcMembersService.getMemberInfoByUserHandle(
5054
user.handle,
5155
{ fields: BASIC_MEMBER_FIELDS },
5256
);
53-
const address = userInfo.addresses?.[0] ?? {};
57+
const address = (userInfo.addresses?.[0] ?? {}) as unknown as {
58+
[key: string]: string;
59+
};
5460

5561
const recipientPayload = {
5662
type: 'individual' as const,
@@ -148,7 +154,7 @@ export class TrolleyService {
148154
const recipient = await this.getPayeeRecipient(user);
149155
const link = this.trolley.getRecipientPortalUrl({
150156
email: user.email,
151-
trolleyId: recipient.trolley_id,
157+
userId: user.id,
152158
});
153159

154160
return { link, recipientId: recipient.trolley_id };

src/dto/adminWinning.dto.ts

+1
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ export class WinningCreateRequestDto {
471471
grossAmount: 15.0,
472472
installmentNumber: 1,
473473
currency: 'string',
474+
billingAccount: '1234',
474475
},
475476
],
476477
})

src/shared/global/trolley.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ export class TrolleyService {
2929
* @throws This function assumes that `TROLLEY_WIDGET_BASE_URL`, `TROLLEY_ACCESS_KEY`,
3030
* and `TROLLEY_SECRET_KEY` are defined and valid. Ensure these constants are properly set.
3131
*/
32-
getRecipientPortalUrl(recipient: { email: string; trolleyId: string }) {
32+
getRecipientPortalUrl(recipient: { email: string; userId: string }) {
3333
const widgetBaseUrl = new url.URL(TROLLEY_WIDGET_BASE_URL as string);
3434
const querystring = new url.URLSearchParams({
3535
ts: `${Math.floor(new Date().getTime() / 1000)}`,
3636
key: TROLLEY_ACCESS_KEY,
3737
email: recipient.email,
38-
refid: recipient.trolleyId,
38+
refid: recipient.userId,
3939
hideEmail: 'false',
4040
roEmail: 'true',
4141
locale: 'en',

0 commit comments

Comments
 (0)