Skip to content

Commit

Permalink
add(marupay): raw field implementation
Browse files Browse the repository at this point in the history
add(marupay): raw field implementation
  • Loading branch information
iamshabell authored Dec 15, 2023
2 parents 30347ac + 9620932 commit f721f75
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/docs/pages/guide/credit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ The `credit` method returns a `PaymentInfo` object. It'll return these details:

- **`referenceId`:** The reference ID is specific to Marupay and is provided in Marupay's response. It serves as a unique identifier for the transaction within Marupay's system.

- **`raw`:** This will return unfiltered response details from the vendor.

These details are essential for tracking and reconciling transactions between your application, the vendor, and Marupay. Ensure that you appropriately handle and store these values for accurate record-keeping and future reference.

2 changes: 2 additions & 0 deletions apps/docs/pages/guide/purchase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ It'll return the same response detail as from [`credit`](credit.mdx) method `Pay

- **`referenceId`**

- **`raw`**

Feel free to incorporate these details into your application's logic based on your specific use case and requirements.
1 change: 1 addition & 0 deletions packages/marupay/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface IPaymentInfo {
transactionId: string
paymentStatus: string;
referenceId: string;
raw: any;
}

export const baseConfigSchema = z.object({});
Expand Down
2 changes: 2 additions & 0 deletions packages/marupay/src/handlers/edahab/edahab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const createEdahabHandler = defineHandler({
transactionId: TransactionId,
paymentStatus: InvoiceStatus,
referenceId,
raw: response.data,
};
};
const { links } = ctx;
Expand Down Expand Up @@ -89,6 +90,7 @@ export const createEdahabHandler = defineHandler({
transactionId: TransactionId,
paymentStatus: TransactionStatus,
referenceId: generateUuid(),
raw: response.data,
};
};
const { links } = ctx;
Expand Down
2 changes: 2 additions & 0 deletions packages/marupay/src/handlers/waafi/waafi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const createWaafiHandler = defineHandler({
transactionId: params.transactionId,
paymentStatus: params.state,
referenceId: params.referenceId,
raw: response.data,
};
};

Expand All @@ -74,6 +75,7 @@ export const createWaafiHandler = defineHandler({
transactionId: params.transactionId,
paymentStatus: params.state,
referenceId: referenceId.toString(),
raw: response.data,
};
};

Expand Down

0 comments on commit f721f75

Please sign in to comment.