Closed williamluke4 closed 5 years ago
Am I correct in saying that the integration test does not work in the master branch?
Tests should pass. EG: https://travis-ci.org/safaricom/mpesa-node-library/builds/461261949
Sometimes Daraja may need tests to be executed again due to unexpected HTTP500
responses.
Your build does not even contact Daraja.
Sadly your changes are also breaking which is not desirable at the moment.
mpesaApi.c2bRegister(URL + '/c2b/validation', URL + '/c2b/success')
is now
mpesaApi.c2bRegister(options)
I do understand the feeling to use an object, but there are reasons why we decided to go with arguments:
const { shortCode } = mpesaApi.configs
const testMSISDN = 254708374149
await mpesaApi.b2c(shortCode, testMSISDN, 100, URL + '/b2c/timeout', URL + '/b2c/success')
We dont need shortcode here. we only need 4 args here. I dont foresee us going towards the object direction.
Maybe in version 2 we can use Typescript but then the direction will be different as shown below:
export type B2BOptions = {
senderParty: number;
receiverParty: number;
amount: number;
queueUrl: string;
resultUrl: string;
senderType?: number;
receiverType?: number;
initiator?: string;
commandId?: string;
accountRef?: string;
remarks?: string;
};
// May be broken down
export type Sender = {
senderParty: number;
senderType?: number;
initiator?: string;
}
......
Closing because it's breaking the current API. Feel free to start an issue for version 2 and then we can first discuss the way forward.
Link to v0.2.0 https://github.com/safaricom/mpesa-node-library/milestone/1
This is a first pass at converting to typescript, tests have not been run yet