Skip to content

Commit

Permalink
fix: 🐛 convert partyIdType to lowercase to avoid 404 from momo
Browse files Browse the repository at this point in the history
Sending uppercase representation of partyIdType in disbursements
isPayerActive api returns 404 but works in transfer request body. Hence,
partyIdType is converted to lowercase before including in the uri
  • Loading branch information
iyiolapeter authored and ernest-okot committed Mar 31, 2021
1 parent ec47e01 commit 5bd3dd2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/disbursements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class Disbursements {
type: PartyIdType = PartyIdType.MSISDN
): Promise<string> {
return this.client
.get<string>(`/disbursement/v1_0/accountholder/${type}/${id}/active`)
.get<string>(`/disbursement/v1_0/accountholder/${String(type).toLowerCase()}/${id}/active`)
.then(response => response.data);
}
}
2 changes: 1 addition & 1 deletion test/disbursements.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe("Disbursements", function() {
).to.be.fulfilled.then(() => {
expect(mockAdapter.history.get).to.have.lengthOf(1);
expect(mockAdapter.history.get[0].url).to.eq(
"/disbursement/v1_0/accountholder/MSISDN/0772000000/active"
"/disbursement/v1_0/accountholder/msisdn/0772000000/active"
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function createMock(): [AxiosInstance, MockAdapter] {

mock
.onGet(
/\/disbursement\/v1_0\/accountholder\/(MSISDN|EMAIL|PARTY_CODE)\/\w+/
/\/disbursement\/v1_0\/accountholder\/(msisdn|email|party_code)\/\w+/
)
.reply(200, "true");

Expand Down

0 comments on commit 5bd3dd2

Please sign in to comment.