-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Reading mpesa config data from config file instead of environme…
…nt variables. (#4) * fix: reading callback url from env * refacor: added fail option when evironment variables are missing * feat: reading environment vars from config file instead of .env * refactor: use hashmap instead of array of objects * fix: cors error for missing config requests * refactor: remove "mpesa" keyword from callback url --------- Co-authored-by: Amos Machora <81857018+AmosMachora@users.noreply.github.com>
- Loading branch information
1 parent
c95a580
commit 538bcf2
Showing
9 changed files
with
100 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
mpesa-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import configData from "../mpesa-config.json"; | ||
|
||
export type MPESA_CONFIG = { | ||
MPESA_BUSINESS_SHORT_CODE: string; | ||
MPESA_CONSUMER_KEY: string; | ||
MPESA_CONSUMER_SECRET: string; | ||
MPESA_API_PASS_KEY: string; | ||
}; | ||
|
||
// HASHMAP | ||
const mpesaConfigMap: { [key: string]: MPESA_CONFIG } = configData; | ||
|
||
export const getHealthFacilityMpesaConfig = ( | ||
mfl: string | ||
): MPESA_CONFIG | undefined => { | ||
const config = mpesaConfigMap[mfl]; | ||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters