switch BVC-meeting-end gift to be from the plan, and add display of providers on claim-view page

This commit is contained in:
2024-09-28 17:31:58 -06:00
parent a271d9c206
commit 7c70e699d8
6 changed files with 110 additions and 7 deletions

View File

@@ -141,6 +141,7 @@ export interface GiveVerifiableCredential extends GenericVerifiableCredential {
identifier?: string;
image?: string;
object?: { amountOfThisGood: number; unitCode: string };
provider?: Array<GenericVerifiableCredential>; // typically @type & identifier
recipient?: { identifier: string };
}
@@ -592,6 +593,7 @@ export function hydrateGive(
fulfillsOfferHandleId?: string,
isTrade: boolean = false,
imageUrl?: string,
providers?: Array<GenericVerifiableCredential>, // typically @type & identifier
lastClaimId?: string,
): GiveVerifiableCredential {
// Remember: replace values or erase if it's null
@@ -650,6 +652,8 @@ export function hydrateGive(
vcClaim.image = imageUrl || undefined;
vcClaim.provider = providers || undefined;
return vcClaim;
}
@@ -674,6 +678,7 @@ export async function createAndSubmitGive(
fulfillsOfferHandleId?: string,
isTrade: boolean = false,
imageUrl?: string,
providers?: Array<GenericVerifiableCredential>,
): Promise<CreateAndSubmitClaimResult> {
const vcClaim = hydrateGive(
undefined,
@@ -686,6 +691,7 @@ export async function createAndSubmitGive(
fulfillsOfferHandleId,
isTrade,
imageUrl,
providers,
undefined,
);
return createAndSubmitClaim(
@@ -718,6 +724,7 @@ export async function editAndSubmitGive(
fulfillsOfferHandleId?: string,
isTrade: boolean = false,
imageUrl?: string,
providers?: Array<GenericVerifiableCredential>,
): Promise<CreateAndSubmitClaimResult> {
const vcClaim = hydrateGive(
fullClaim.claim,
@@ -730,6 +737,7 @@ export async function editAndSubmitGive(
fulfillsOfferHandleId,
isTrade,
imageUrl,
providers,
fullClaim.id,
);
return createAndSubmitClaim(
@@ -1180,7 +1188,7 @@ export const claimSpecialDescription = (
export const BVC_MEETUPS_PROJECT_CLAIM_ID =
import.meta.env.VITE_BVC_MEETUPS_PROJECT_CLAIM_ID ||
"https://endorser.ch/entity/01HWE8FWHQ1YGP7GFZYYPS272F"; // this won't resolve as a URL on production; it's a URN only found in the test system
"https://endorser.ch/entity/01GXYPFF7FA03NXKPYY142PY4H"; // production value, which seems like the safest value if forgotten
export const bvcMeetingJoinClaim = (did: string, startTime: string) => {
return {