forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom-metadata.example.ts
More file actions
51 lines (44 loc) · 1.15 KB
/
Copy pathcustom-metadata.example.ts
File metadata and controls
51 lines (44 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { Injectable } from "@nestjs/common";
import { ActivitiesService } from "./activities.service";
/**
* Example 5: Custom Metadata Usage
* Leverage the flexible metadata field for rich activity data
*/
@Injectable()
export class CustomMetadataExample {
constructor(private readonly activitiesService: ActivitiesService) {}
async trackPaymentWithCustomData(
userId: string,
splitId: string,
amount: number,
txHash: string
) {
await this.activitiesService.trackPaymentMade(
userId,
splitId,
amount,
txHash,
{
// Payment details
asset: "USDC",
network: "stellar",
// User context
deviceType: "mobile",
appVersion: "1.2.3",
// Split context
splitName: "Dinner at Restaurant",
category: "food",
// Timing
processedAt: new Date().toISOString(),
// Additional data
isFirstPayment: true,
completionPercentage: 50,
// You can add any JSON-serializable data
customFields: {
referenceNumber: "REF-12345",
notes: "Paid via mobile app",
},
}
);
}
}