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

fix: 3ds code refactor and bugfixes #61

Merged
merged 17 commits into from
Dec 6, 2023
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
12 changes: 2 additions & 10 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ commit_msg=$(cat "$commit_msg_file")
echo
echo "*****~~~~~ Formatting - Check for unformatted files ~~~~~~*****"

# Check for unformatted JavaScript, TypeScript, and JSON files using Prettier
unformatted_js_files=$(git ls-files | grep '\.js\|\.jsx\|\.ts\|\.tsx\|\.json' | xargs npx prettier --list-different)
# Check for unformatted JavaScript and JSON files using Prettier
unformatted_js_files=$(git ls-files | grep '\.js\|\.json' | xargs npx prettier --list-different)

# If there are unformatted JavaScript, TypeScript, or JSON files, print an error message and exit with a non-zero status code
if [ -n "$unformatted_js_files" ]; then
Expand All @@ -26,14 +26,6 @@ echo
echo "*****~~~~~ All files are formatted. ~~~~~~*****"
echo

# JS Code Check
echo "*****~~~~~ Checking ReScript Code ~~~~~~*****"
if (! npm run re:build)
then
echo "*****~~~~~ ReScript Code Compilation Failed! ~~~~~*****"
exit 1
fi

echo
echo "*****~~~~~ Commit message validation! ~~~~~*****"
echo
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CHANGELOG.md
CHANGELOG.md
*euclid*
40 changes: 40 additions & 0 deletions public/hyperswitch/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,43 @@ function getParsedJson(str) {
throw e;
}
}

function getThreeDsKeys() {
if (wasm) {
return wasm.getThreeDsKeys();
} else {
return [];
}
}

function getAllKeys() {
if (wasm) {
return wasm.getAllKeys();
} else {
return [];
}
}

function getKeyType(str) {
if (wasm) {
return wasm.getKeyType(str);
} else {
return "";
}
}

function getAllConnectors() {
if (wasm) {
return wasm.getAllConnectors();
} else {
return [];
}
}

function getVariantValues(str) {
if (wasm) {
return wasm.getVariantValues(str);
} else {
return [];
}
}
213 changes: 96 additions & 117 deletions public/hyperswitch/wasm/euclid.d.ts
Original file line number Diff line number Diff line change
@@ -1,142 +1,128 @@
/* tslint:disable */
/* eslint-disable */
/**
* This function can be used by the frontend to educate wasm about the forex rates data.
* The input argument is a struct fields base_currency and conversion where later is all the conversions associated with the base_currency
* to all different currencies present.
* @param {any} forex
* @returns {any}
*/
* This function can be used by the frontend to educate wasm about the forex rates data.
* The input argument is a struct fields base_currency and conversion where later is all the conversions associated with the base_currency
* to all different currencies present.
* @param {any} forex
* @returns {any}
*/
export function setForexData(forex: any): any;
/**
* This function can be used to perform currency_conversion on the input amount, from_currency,
* to_currency which are all expected to be one of currencies we already have in our Currency
* enum.
* @param {bigint} amount
* @param {any} from_currency
* @param {any} to_currency
* @returns {any}
*/
export function convertCurrency(
amount: bigint,
from_currency: any,
to_currency: any,
): any;
/**
* This function can be used by the frontend to provide the WASM with information about
* all the merchant's connector accounts. The input argument is a vector of all the merchant's
* connector accounts from the API.
* @param {any} mcas
* @returns {any}
*/
* This function can be used to perform currency_conversion on the input amount, from_currency,
* to_currency which are all expected to be one of currencies we already have in our Currency
* enum.
* @param {bigint} amount
* @param {any} from_currency
* @param {any} to_currency
* @returns {any}
*/
export function convertCurrency(amount: bigint, from_currency: any, to_currency: any): any;
/**
* This function can be used by the frontend to provide the WASM with information about
* all the merchant's connector accounts. The input argument is a vector of all the merchant's
* connector accounts from the API.
* @param {any} mcas
* @returns {any}
*/
export function seedKnowledgeGraph(mcas: any): any;
/**
* This function allows the frontend to get all the merchant's configured
* connectors that are valid for a rule based on the conditions specified in
* the rule
* @param {any} rule
* @returns {any}
*/
* This function allows the frontend to get all the merchant's configured
* connectors that are valid for a rule based on the conditions specified in
* the rule
* @param {any} rule
* @returns {any}
*/
export function getValidConnectorsForRule(rule: any): any;
/**
* @param {any} js_program
* @returns {any}
*/
* @param {any} js_program
* @returns {any}
*/
export function analyzeProgram(js_program: any): any;
/**
* @param {any} program
* @param {any} input
* @returns {any}
*/
* @param {any} program
* @param {any} input
* @returns {any}
*/
export function runProgram(program: any, input: any): any;
/**
* @returns {any}
*/
* @returns {any}
*/
export function getAllConnectors(): any;
/**
* @returns {any}
*/
* @returns {any}
*/
export function getAllKeys(): any;
/**
* @param {string} key
* @returns {string}
*/
* @param {string} key
* @returns {string}
*/
export function getKeyType(key: string): string;
/**
* @returns {any}
*/
* @returns {any}
*/
export function getThreeDsKeys(): any;
/**
* @returns {any}
*/
* @returns {any}
*/
export function getSurchargeKeys(): any;
/**
* @param {string} val
* @returns {string}
*/
* @param {string} val
* @returns {string}
*/
export function parseToString(val: string): string;
/**
* @param {string} key
* @returns {any}
*/
* @param {string} key
* @returns {any}
*/
export function getVariantValues(key: string): any;
/**
* @param {bigint} n1
* @param {bigint} n2
* @returns {bigint}
*/
* @param {bigint} n1
* @param {bigint} n2
* @returns {bigint}
*/
export function addTwo(n1: bigint, n2: bigint): bigint;
/**
* @param {string} key
* @returns {any}
*/
* @param {string} key
* @returns {any}
*/
export function getConnectorConfig(key: string): any;
/**
* @param {string} key
* @returns {any}
*/
* @param {string} key
* @returns {any}
*/
export function getPayoutConnectorConfig(key: string): any;
/**
* @param {any} input
* @param {any} response
* @returns {any}
*/
* @param {any} input
* @param {any} response
* @returns {any}
*/
export function getRequestPayload(input: any, response: any): any;
/**
* @param {any} input
* @returns {any}
*/
* @param {any} input
* @returns {any}
*/
export function getResponsePayload(input: any): any;
/**
* @param {string} key
* @returns {any}
*/
* @param {string} key
* @returns {any}
*/
export function getDescriptionCategory(key: string): any;
/**
*
* Function exposed as `wasm` function in js `parse`. Allowing use to extend the functionality and
* usage for web
* @param {string} val
* @returns {string}
*/
*
* Function exposed as `wasm` function in js `parse`. Allowing use to extend the functionality and
* usage for web
* @param {string} val
* @returns {string}
*/
export function parse(val: string): string;

export type InitInput =
| RequestInfo
| URL
| Response
| BufferSource
| WebAssembly.Module;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly setForexData: (a: number, b: number) => void;
readonly convertCurrency: (
a: number,
b: number,
c: number,
d: number,
) => void;
readonly convertCurrency: (a: number, b: number, c: number, d: number) => void;
readonly seedKnowledgeGraph: (a: number, b: number) => void;
readonly getValidConnectorsForRule: (a: number, b: number) => void;
readonly analyzeProgram: (a: number, b: number) => void;
Expand All @@ -156,36 +142,29 @@ export interface InitOutput {
readonly parse: (a: number, b: number, c: number) => void;
readonly parseToString: (a: number, b: number, c: number) => void;
readonly __wbindgen_export_0: (a: number, b: number) => number;
readonly __wbindgen_export_1: (
a: number,
b: number,
c: number,
d: number,
) => number;
readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_export_2: (a: number, b: number, c: number) => void;
readonly __wbindgen_export_3: (a: number) => void;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
*
* @returns {InitOutput}
*/
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
*
* @returns {InitOutput}
*/
export function initSync(module: SyncInitInput): InitOutput;

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init(
module_or_path?: InitInput | Promise<InitInput>,
): Promise<InitOutput>;
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
Loading