allow details on a give for a providing project (so we can attach a picture)

This commit is contained in:
2024-09-30 18:11:07 -06:00
parent 7c70e699d8
commit 9925800fbd
8 changed files with 326 additions and 154 deletions

View File

@@ -91,6 +91,7 @@ export interface GiveSummaryRecord {
issuedAt: string;
issuerDid: string;
jwtId: string;
providerPlanHandleId?: string;
recipientDid: string;
unit: string;
}
@@ -530,7 +531,7 @@ const planCache: LRUCache<string, PlanSummaryRecord> = new LRUCache({
* @param apiServer
*/
export async function getPlanFromCache(
handleId: string,
handleId: string | undefined,
axios: Axios,
apiServer: string,
requesterDid?: string,
@@ -593,7 +594,7 @@ export function hydrateGive(
fulfillsOfferHandleId?: string,
isTrade: boolean = false,
imageUrl?: string,
providers?: Array<GenericVerifiableCredential>, // typically @type & identifier
providerPlanHandleId?: string,
lastClaimId?: string,
): GiveVerifiableCredential {
// Remember: replace values or erase if it's null
@@ -652,7 +653,9 @@ export function hydrateGive(
vcClaim.image = imageUrl || undefined;
vcClaim.provider = providers || undefined;
vcClaim.provider = providerPlanHandleId
? [{ "@type": "PlanAction", identifier: providerPlanHandleId }]
: undefined;
return vcClaim;
}
@@ -678,7 +681,7 @@ export async function createAndSubmitGive(
fulfillsOfferHandleId?: string,
isTrade: boolean = false,
imageUrl?: string,
providers?: Array<GenericVerifiableCredential>,
providerPlanHandleId?: string,
): Promise<CreateAndSubmitClaimResult> {
const vcClaim = hydrateGive(
undefined,
@@ -691,7 +694,7 @@ export async function createAndSubmitGive(
fulfillsOfferHandleId,
isTrade,
imageUrl,
providers,
providerPlanHandleId,
undefined,
);
return createAndSubmitClaim(
@@ -724,7 +727,7 @@ export async function editAndSubmitGive(
fulfillsOfferHandleId?: string,
isTrade: boolean = false,
imageUrl?: string,
providers?: Array<GenericVerifiableCredential>,
providerPlanHandleId?: string,
): Promise<CreateAndSubmitClaimResult> {
const vcClaim = hydrateGive(
fullClaim.claim,
@@ -737,7 +740,7 @@ export async function editAndSubmitGive(
fulfillsOfferHandleId,
isTrade,
imageUrl,
providers,
providerPlanHandleId,
fullClaim.id,
);
return createAndSubmitClaim(