Skip to content

Commit

Permalink
fix: add serviceCode to request object
Browse files Browse the repository at this point in the history
  • Loading branch information
ephrimlawrence committed Oct 28, 2024
1 parent c1137a7 commit 8406e8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/gateways/emergent_technology.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export class EmergentTechnologyGateway extends Gateway {

this.request.state = _state;
this.request.msisdn = _state.msisdn;
this.request.serviceCode = body.ServiceCode;

// The content of Message for session initiation is always the service short code value
// We don't really need it given that is start of a session
if (_state.mode == StateMode.start) {
// We don't really need it, given that it is start of a session
if (_state.mode === StateMode.start) {
this.request.input = "";
} else {
this.request.input = body.Message;
Expand Down
14 changes: 13 additions & 1 deletion src/types/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ export class Request {

url: string;

/**
* The msisdn of the user
*/
msisdn?: string;

/**
* USSD service short code. Set only for Emergent Technology USSD
*/
serviceCode?: string;

/**
* The input from the user
*/
Expand All @@ -33,9 +41,13 @@ export class Request {
query?: Record<string, string>;

/**
* Current USSD state. Is null until the request is processed by the middlewares
* Current USSD state. Null until the request is processed by the middlewares
*/
state: State;

/**
* Current session. Null until the request is processed by the middlewares
*/
session: Session;

constructor(_url: Url, req: IncomingMessage) {
Expand Down

0 comments on commit 8406e8d

Please sign in to comment.