Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: correct data type on confirmation and validation #12

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/api/confirmation/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { NextRequest, NextResponse } from "next/server";

export const POST = async (req: NextRequest) => {
//When this API is hit it does nothing for now. The use case of this API is not currently yet defined but some facilities may register this URL.
return NextResponse.json({ message: "confirmed" }, { status: 200 });
// When this API is hit it does nothing for now.
// The use case of this API is not currently yet defined but some facilities may register this URL.
return NextResponse.json({
ResultCode: 0,
ResultDesc: "Success",
});
};
2 changes: 1 addition & 1 deletion app/api/register-url/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const POST = async (req: NextRequest) => {
const res: RegisterUrlResponse = await axios.post(
`${BASE_URL}/mpesa/c2b/v1/registerurl`,
{
ShortCode: facilityMpesaConfig.MPESA_BUSINESS_SHORT_CODE,
ShortCode: parseInt(facilityMpesaConfig.MPESA_BUSINESS_SHORT_CODE),
ResponseType: "Completed",
ConfirmationURL: `${BASE_URL}/api/confirmation`,
ValidationURL: `${BASE_URL}/api/validation`,
Expand Down
2 changes: 1 addition & 1 deletion app/api/validation/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const POST = async (req: NextRequest) => {
//When this API is hit it automatically completes the transaction.
return NextResponse.json({
ResultCode: "0",
ResultDesc: "Validation request received successfully",
ResultDesc: "Accepted",
});
};