repo stringclasses 4
values | file_path stringlengths 6 193 | extension stringclasses 23
values | content stringlengths 0 1.73M | token_count int64 0 724k | __index_level_0__ int64 0 10.8k |
|---|---|---|---|---|---|
hyperswitch-web | src/Utilities/PaymentHelpers.res | .res | open Utils
open Identity
open PaymentHelpersTypes
open LoggerUtils
open URLModule
let getPaymentType = paymentMethodType =>
switch paymentMethodType {
| "apple_pay" => Applepay
| "samsung_pay" => Samsungpay
| "google_pay" => Gpay
| "paze" => Paze
| "debit"
| "credit"
| "" =>
Card
| _ => Other
}... | 16,397 | 10,530 |
hyperswitch-web | src/Utilities/RecoilAtoms.res | .res | open RecoilAtomTypes
let keys = Recoil.atom("keys", CommonHooks.defaultkeys)
let configAtom = Recoil.atom("defaultRecoilConfig", CardTheme.defaultRecoilConfig)
let portalNodes = Recoil.atom("portalNodes", PortalState.defaultDict)
let elementOptions = Recoil.atom("elementOptions", ElementType.defaultOptions)
let option... | 1,243 | 10,531 |
hyperswitch-web | src/Utilities/PmAuthConnectorUtils.res | .res | type pmAuthConnector = PLAID | NONE
type isPmAuthConnectorReady = {plaid: bool}
let pmAuthNameToTypeMapper = authConnectorName => {
switch authConnectorName {
| "plaid" => PLAID
| _ => NONE
}
}
let pmAuthConnectorToScriptUrlMapper = authConnector => {
switch authConnector {
| PLAID => "https://cdn.plaid.co... | 631 | 10,532 |
hyperswitch-web | src/Utilities/Phone_number.json | .json | {
"countries": [
{
"country_code": "AF",
"country_name": "Afghanistan",
"country_flag": "🇦🇫",
"phone_number_code": "+93",
"validation_regex": "^(\\+?93)?\\d{9}$",
"format_example": "0701234567",
"format_regex": "^\\d{10}$"
},
{
"country_code": "AL",
... | 22,179 | 10,533 |
hyperswitch-web | src/Utilities/SamsungPayHelpers.res | .res | open SamsungPayType
open Utils
let getTransactionDetail = dict => {
let amountDict = dict->getDictFromDict("amount")
let merchantDict = dict->getDictFromDict("merchant")
{
orderNumber: dict->getString("order_number", ""),
amount: {
option: amountDict->getString("option", ""),
currency: amount... | 884 | 10,534 |
hyperswitch-web | src/Utilities/Identity.res | .res | external anyTypeToJson: 'a => JSON.t = "%identity"
external unsafeToJsExn: exn => Exn.t = "%identity"
external jsonToNullableJson: JSON.t => Nullable.t<JSON.t> = "%identity"
| 50 | 10,535 |
hyperswitch-web | src/Utilities/ApiEndpoint.res | .res | let switchToInteg = false
let isLocal = false
let sdkDomainUrl = `${GlobalVars.sdkUrl}${GlobalVars.repoPublicPath}`
let apiEndPoint: ref<option<string>> = ref(None)
let setApiEndPoint = str => {
apiEndPoint := Some(str)
}
let getApiEndPoint = (~publishableKey="", ~isConfirmCall=false) => {
let testMode = publish... | 226 | 10,536 |
hyperswitch-web | src/Utilities/ErrorUtils.res | .res | type type_ = Error | Warning
type stringType = Dynamic(string => string) | Static(string)
type error = array<(HyperLogger.eventName, type_, string)>
open HyperLogger
let errorWarning = [
(
INVALID_PK,
Error,
Static(
"INTEGRATION ERROR: Invalid Publishable key, starts with pk_dev_(development), pk... | 1,023 | 10,537 |
hyperswitch-web | src/Utilities/PaymentUtils.res | .res | let paymentMethodListValue = Recoil.atom("paymentMethodListValue", PaymentMethodsRecord.defaultList)
let paymentListLookupNew = (
list: PaymentMethodsRecord.paymentMethodList,
~order,
~isShowPaypal,
~isShowKlarnaOneClick,
~isKlarnaSDKFlow,
~paymentMethodListValue: PaymentMethodsRecord.paymentMethodList,
... | 4,903 | 10,538 |
hyperswitch-web | src/Utilities/PaymentHelpersTypes.res | .res | type payment =
| Card
| BankTransfer
| BankDebits
| KlarnaRedirect
| Gpay
| Applepay
| Paypal
| Samsungpay
| Paze
| Other
type paymentIntent = (
~handleUserError: bool=?,
~bodyArr: array<(string, JSON.t)>,
~confirmParam: ConfirmType.confirmParams,
~iframeId: string=?,
~isThirdPartyFlow: b... | 181 | 10,539 |
hyperswitch-web | src/Utilities/EventListenerManager.res | .res | type sessionStorage
@val external sessionStorage: sessionStorage = "sessionStorage"
@send external setItem: (sessionStorage, string, 'a => unit) => unit = "setItem"
let eventListenerMap: Dict.t<Types.event => unit> = Dict.make()
let addSmartEventListener = (type_, handlerMethod: Types.event => unit, activity) => {
... | 125 | 10,540 |
hyperswitch-web | src/Utilities/Utils.res | .res | @val external document: 'a = "document"
@val external window: Dom.element = "window"
@val @scope("window") external iframeParent: Dom.element = "parent"
@send external body: ('a, Dom.element) => Dom.element = "body"
@val @scope("window") external topParent: Dom.element = "top"
type event = {data: string}
external dict... | 11,031 | 10,541 |
hyperswitch-web | src/Utilities/DynamicFieldsUtils.res | .res | open RecoilAtoms
let dynamicFieldsEnabledPaymentMethods = [
"crypto_currency",
"debit",
"credit",
"blik",
"google_pay",
"apple_pay",
"bancontact_card",
"open_banking_uk",
"eps",
"ideal",
"sofort",
"pix_transfer",
"giropay",
"local_bank_transfer_transfer",
"afterpay_clearpay",
"mifinity"... | 9,811 | 10,542 |
hyperswitch-web | src/Utilities/GooglePayHelpers.res | .res | open Utils
let getGooglePayBodyFromResponse = (
~gPayResponse,
~isGuestCustomer,
~paymentMethodListValue=PaymentMethodsRecord.defaultList,
~connectors,
~requiredFields=[],
~stateJson,
~isPaymentSession=false,
~isSavedMethodsFlow=false,
) => {
let obj = gPayResponse->getDictFromJson->GooglePayType.ite... | 1,487 | 10,543 |
hyperswitch-web | src/Utilities/LoggerUtils.res | .res | let logApi = (
~eventName,
~statusCode="",
~data: JSON.t=Dict.make()->JSON.Encode.object,
~apiLogType: HyperLogger.apiLogType,
~url="",
~paymentMethod="",
~result: JSON.t=Dict.make()->JSON.Encode.object,
~optLogger: option<HyperLogger.loggerMake>,
~logType: HyperLogger.logType=INFO,
~logCategory: Hy... | 483 | 10,544 |
hyperswitch-web | src/Utilities/TaxCalculation.res | .res | open Utils
type calculateTaxResponse = {
payment_id: string,
net_amount: int,
order_tax_amount: int,
shipping_cost: int,
}
let taxResponseToObjMapper = resp => {
resp
->JSON.Decode.object
->Option.map(dict => {
payment_id: dict->getString("payment_id", ""),
net_amount: dict->getInt("net_amount",... | 226 | 10,545 |
hyperswitch-web | src/Utilities/URLModule.res | .res | type match
type pathname = {match: match}
type searchParams = {set: (string, string) => unit}
type url = {searchParams: searchParams, href: string, pathname: pathname}
@new external makeUrl: string => url = "URL"
| 57 | 10,546 |
hyperswitch-web | src/Utilities/PaymentBody.res | .res | let billingDetailsTuple = (
~fullName,
~email,
~line1,
~line2,
~city,
~state,
~postalCode,
~country,
) => {
let (firstName, lastName) = fullName->Utils.getFirstAndLastNameFromFullName
(
"billing",
[
("email", email->JSON.Encode.string),
(
"address",
[
(... | 7,473 | 10,547 |
hyperswitch-web | src/Utilities/ApplePayHelpers.res | .res | open ApplePayTypes
open Utils
open TaxCalculation
let processPayment = (
~bodyArr,
~isThirdPartyFlow=false,
~isGuestCustomer,
~paymentMethodListValue=PaymentMethodsRecord.defaultList,
~intent: PaymentHelpersTypes.paymentIntent,
~options: PaymentType.options,
~publishableKey,
~isManualRetryEnabled,
) =>... | 2,603 | 10,548 |
hyperswitch-web | src/Utilities/TestUtils.res | .res | let paymentMethodListTestId = "paymentList"
let paymentMethodDropDownTestId = "paymentMethodsSelect"
let cardNoInputTestId = "cardNoInput"
let expiryInputTestId = "expiryInput"
let cardCVVInputTestId = "cvvInput"
let cardHolderNameInputTestId = "BillingName"
let fullNameInputTestId = "FullName"
let emailInputTestId = "... | 434 | 10,549 |
hyperswitch-web | src/Utilities/PaymentMethodCollectUtils.res | .res | open CardUtils
open ErrorUtils
open PaymentMethodCollectTypes
open Utils
type t = Dict.t<JSON.t>
// Function to get a nested value
let getNestedValue = (dict: t, key: string): option<JSON.t> => {
let keys = String.split(key, ".")
let length = Array.length(keys)
let rec traverse = (currentDict, index): option<J... | 8,482 | 10,550 |
hyperswitch-client-core | metro.config.js | .js | const {getDefaultConfig} = require('@react-native/metro-config');
// const exclusionList = require('metro-config/src/defaults/exclusionList');
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('@react-native/metro-config').MetroConfig}
*/
const defaultConfig = getD... | 113 | 10,551 |
hyperswitch-client-core | tsconfig.json | .json | {
"extends": "@react-native/typescript-config/tsconfig.json",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "b... | 172 | 10,552 |
hyperswitch-client-core | package.json | .json | {
"name": "hyperswitch",
"version": "1.1.3",
"private": true,
"scripts": {
"start": "react-native start --reset-cache",
"server": "node server.js",
"re:start": "rescript build -w",
"re:format": "rescript format -all",
"web": "NODE_ENV=development webpack serve --mode=development --config rea... | 2,497 | 10,553 |
hyperswitch-client-core | lefthook.yml | .yml | # EXAMPLE USAGE:
#
# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#
# pre-push:
# commands:
# packages-audit:
# tags: frontend security
# run: yarn audit
# gems-audit:
# tags: backend security
# run: bundle au... | 241 | 10,554 |
hyperswitch-client-core | CHANGELOG.md | .md | ## [1.1.3](https://github.com/juspay/hyperswitch-client-core/compare/v1.1.2...v1.1.3) (2025-04-29)
### Bug Fixes
* state field error msg fix ([#269](https://github.com/juspay/hyperswitch-client-core/issues/269)) ([d8f8bd7](https://github.com/juspay/hyperswitch-client-core/commit/d8f8bd70736a159daa42f9fc4a3dc37db4f7c... | 11,400 | 10,555 |
hyperswitch-client-core | SECURITY.md | .md | # Security Policy
## Reporting a security issue
The hyperswitch project team welcomes security reports and is committed to
providing prompt attention to security issues.
Security issues should be reported privately via the
[advisories page on GitHub][report-vulnerability] or by email at
[hyperswitch@juspay.in](mailto... | 117 | 10,556 |
hyperswitch-client-core | LICENSE | none | Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and d... | 2,252 | 10,557 |
hyperswitch-client-core | server.js | .js | const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors());
app.use(express.static('./dist'));
app.use(express.json());
require('dotenv').config({path: './.env'});
const PORT = 5252;
async function createPaymentIntent(request) {
try {
const url =
process.env.... | 1,092 | 10,558 |
hyperswitch-client-core | rescript.json | .json | {
"name": "hyperswitch",
"jsx": {"version": 4},
"package-specs": {
"module": "esmodule",
"in-source": true
},
"bsc-flags": ["-bs-super-errors","-open RescriptCore"],
"suffix": ".bs.js",
"sources": [
{
"dir": "src",
"subdirs": true
},
{
"dir": "reactNativeWeb",
"... | 167 | 10,559 |
hyperswitch-client-core | react-native.config.js | .js | module.exports = {
assets: ['./assets/fonts/'],
project: {
android: {
appName: 'demo-app',
},
},
};
| 32 | 10,560 |
hyperswitch-client-core | Gemfile | none | source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'... | 186 | 10,561 |
hyperswitch-client-core | app.json | .json | {
"name": "hyperSwitch",
"displayName": "hyperswitch",
"headless": "HyperHeadless"
}
| 29 | 10,562 |
hyperswitch-client-core | README.md | .md | # Hyperswitch Client Core
This repository hosts the essential components of the Hyperswitch SDK, which supports various platforms. Directly cloning this repository allows immediate access to a web-compatible version of the SDK.
> **Important:** The official Hyperswitch Web SDK is maintained separately. Visit [this li... | 745 | 10,563 |
hyperswitch-client-core | index.js | .js | import {AppRegistry} from 'react-native';
import NewApp from './src/routes/Update';
import {name as appName, headless} from './app.json';
import {registerHeadless} from './src/headless/Headless.bs';
AppRegistry.registerComponent(appName, () => NewApp);
registerHeadless(headless);
| 68 | 10,564 |
hyperswitch-client-core | App.js | .js | export {make as default} from './src/routes/App.bs.js';
// import {ActivityIndicator, View} from 'react-native';
// export default App = props => {
// return (
// <View
// style={{
// backgroundColor:
// props.props.type == 'card' ? 'transparent' : '#00000070',
// flex: 1,
// ... | 111 | 10,565 |
hyperswitch-client-core | babel.config.js | .js | module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: ['module:react-native-dotenv'],
};
| 29 | 10,566 |
hyperswitch-client-core | __tests__/App-test.tsx | .tsx | /**
* @format
*/
import 'react-native';
import React from 'react';
import App from '../App';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
renderer.create(<App />);
});
| 59 | 10,567 |
hyperswitch-client-core | ota/ios.config.json | .json | {
"config": {
"target_platform": "ios",
"target_version": "0.2.4",
"release_tag_version": "v1.0.6",
"release_env": "prod"
}
} | 51 | 10,568 |
hyperswitch-client-core | ota/Readme.md | .md | # OTA Configuration Guide
Explanation of Configuration Keys
- `enable_ota_updates` → Enables or disables OTA updates. When `false`, only Release Config (RC) is updated. `(Optional)` `(default - true)`
- `target_platform` → Specifies the platform for the update (`android` or `ios`).
- `target_version` → Defines the ... | 238 | 10,569 |
hyperswitch-client-core | ota/android.config.json | .json | {
"config": {
"target_platform": "android",
"target_version": "1.1.2",
"release_tag_version": "v1.0.6",
"release_env": "prod"
}
} | 51 | 10,570 |
hyperswitch-client-core | ota/config.json | .json | {
"config": {
"version": "v1",
"release_config_timeout": 10000,
"package_timeout": 10000,
"properties": {}
},
"package": {
"name": "sdk",
"version": "v1.0.0",
"properties": {
"manifest": {},
"manifest_hash": {}
},
"index": "",
"splits": []
},
"resources": {}... | 107 | 10,571 |
hyperswitch-client-core | scripts/pushToS3.js | .js | const { run } = require("./prepareS3.js");
const { version } = require("../reactNativeWeb/version.json");
const path = require("path");
const BASE_PATH = "mobile";
let params = {
s3Bucket: process.env.BUCKET_NAME,
distributionId: process.env.DIST_ID,
urlPrefix: `v${version.split(".")[0]}`,
version: `${BASE_PAT... | 116 | 10,573 |
hyperswitch-client-core | scripts/prepareS3.js | .js | const { PutObjectCommand } = require("@aws-sdk/client-s3");
const {
CreateInvalidationCommand,
GetDistributionConfigCommand,
UpdateDistributionCommand,
GetInvalidationCommand,
CloudFrontClient,
} = require("@aws-sdk/client-cloudfront");
const FileSystem = require("fs");
const { globSync } = require("fast-glob... | 1,516 | 10,574 |
hyperswitch-client-core | detox-tests/tsconfig.json | .json | {
"compilerOptions": {
"target": "ES2022",
"module": "commonjs",
},
"include": ["**/*.ts"]
}
| 42 | 10,575 |
hyperswitch-client-core | detox-tests/package.json | .json | {
"name": "detox-tests",
"version": "1.0.0",
"main": "e2e/jest.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.10.2",
"ts-jest": "^29... | 139 | 10,576 |
hyperswitch-client-core | detox-tests/babel.config.js | .js | module.exports = {
presets: [
'@babel/preset-env', // Handles modern JavaScript features like `export`
],
plugins: [
'@babel/plugin-transform-modules-commonjs', // Transforms ES modules to CommonJS for Jest compatibility
],
};
| 54 | 10,577 |
hyperswitch-client-core | detox-tests/e2e/card-flow-e2e.test.ts | .ts | import * as testIds from "../../src/utility/test/TestUtils.bs.js";
import { device } from "detox"
import { visaSandboxCard, LAUNCH_PAYMENT_SHEET_BTN_TEXT } from "../fixtures/Constants"
import { waitForVisibility, typeTextInInput } from "../utils/DetoxHelpers"
describe('card-flow-e2e-test', () => {
jest.retryTimes(6);... | 476 | 10,578 |
hyperswitch-client-core | detox-tests/e2e/jest.config.js | .js | /** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
preset: 'ts-jest',
rootDir: '..',
testMatch: ['<rootDir>/e2e/**/*.test.ts'],
testTimeout: 1200000,
maxWorkers: 1,
globalSetup: 'detox/runners/jest/globalSetup',
globalTeardown: 'detox/runners/jest/globalTeardown',
reporters: [... | 171 | 10,579 |
hyperswitch-client-core | detox-tests/fixtures/Constants.ts | .ts | type card = {
cardNumber: string,
expiryDate: string,
cvc: string,
}
export const visaSandboxCard = { cardNumber: "4242424242424242", expiryDate: "04/44", cvc: "123" }
export const LAUNCH_PAYMENT_SHEET_BTN_TEXT = "Launch Payment Sheet"
| 86 | 10,580 |
hyperswitch-client-core | detox-tests/utils/DetoxHelpers.ts | .ts | const DEFAULT_TIMEOUT = 10000;
export async function waitForVisibility(element: Detox.IndexableNativeElement, timeout = DEFAULT_TIMEOUT) {
await waitFor(element)
.toBeVisible()
.withTimeout(timeout);
}
export async function typeTextInInput(element: Detox.IndexableNativeElement, text: string) {
... | 94 | 10,581 |
hyperswitch-client-core | src/routes/App.res | .res | open ReactNative
open Style
module ContextWrapper = {
@react.component
let make = (~props, ~rootTag, ~children) => {
<NativePropContext nativeProp={SdkTypes.nativeJsonToRecord(props, rootTag)}>
<LocaleStringDataContext>
<CountryStateDataContext>
<ViewportContext>
<LoadingCon... | 288 | 10,582 |
hyperswitch-client-core | src/routes/NavigatorRouter.res | .res | @react.component
let make = () => {
let (nativeProp, _) = React.useContext(NativePropContext.nativePropContext)
let retrievePayment = AllPaymentHooks.useRetrieveHook()
let getSessionToken = AllPaymentHooks.useSessionToken()
let savedPaymentMethods = AllPaymentHooks.useGetSavedPMHook()
let (allApiData, setAll... | 1,004 | 10,583 |
hyperswitch-client-core | src/routes/AppExports.js | .js | export {make as default} from './App.bs.js';
// import {ActivityIndicator, View} from 'react-native';
// export default App = props => {
// return (
// <View
// style={{
// backgroundColor:
// props.props.type == 'card' ? 'transparent' : '#00000070',
// flex: 1,
// justif... | 109 | 10,584 |
hyperswitch-client-core | src/routes/NavigatorRouterParent.res | .res | @react.component
let make = () => {
let (nativeProp, _) = React.useContext(NativePropContext.nativePropContext)
switch nativeProp.sdkState {
| PaymentMethodsManagement => <PMMangementNavigatorRouter />
| _ => <NavigatorRouter />
}
}
| 60 | 10,585 |
hyperswitch-client-core | src/routes/PMMangementNavigatorRouter.res | .res | @react.component
let make = () => {
let (nativeProp, _) = React.useContext(NativePropContext.nativePropContext)
let (allApiData, setAllApiData) = React.useContext(AllApiDataContext.allApiDataContext)
let showErrorOrWarning = ErrorHooks.useShowErrorOrWarning()
let savedPaymentMethods = AllPaymentHooks.useGetSave... | 381 | 10,586 |
hyperswitch-client-core | src/routes/GlobalConfirmButton.res | .res | open ReactNative
@react.component
let make = (~confirmButtonDataRef) => {
<View> {confirmButtonDataRef} </View>
}
| 33 | 10,587 |
hyperswitch-client-core | src/routes/ParentPaymentSheet.res | .res | open SDKLoadCheckHook
module SdkLoadingScreen = {
@react.component
let make = () => {
<>
<Space height=20. />
<CustomLoader height="38" />
<Space height=8. />
<CustomLoader height="38" />
<Space height=50. />
<CustomLoader height="38" />
</>
}
}
@react.component
let ma... | 457 | 10,588 |
hyperswitch-client-core | src/routes/Update.js | .js | import React from 'react';
import App from './AppExports.js';
import {
sentryReactNative,
initiateSentry,
} from '../components/modules/Sentry.bs.js';
const NewApp = props => {
return (
<App
props={props.props}
rootTag={props.rootTag}
/>
);
};
const SentryApp = React.memo(props => {
init... | 117 | 10,589 |
hyperswitch-client-core | src/routes/FullScreenSheetWrapper.res | .res | open ReactNative
open Style
@react.component
let make = (~children) => {
let (loading, setLoading) = React.useContext(LoadingContext.loadingContext)
let handleSuccessFailure = AllPaymentHooks.useHandleSuccessFailure()
let onModalClose = React.useCallback0(() => {
setLoading(PaymentCancelled)
setTimeout(... | 495 | 10,590 |
hyperswitch-client-core | src/types/PaymentConfirmTypes.res | .res | // type redirectToUrl = {
// returnUrl: string,
// url: string,
// }
type pollConfig = {
pollId: string,
delayInSecs: int,
frequency: int,
}
type threeDsData = {
threeDsAuthenticationUrl: string,
threeDsAuthorizeUrl: string,
messageVersion: string,
directoryServerId: string,
pollConfig: pollConfig,... | 968 | 10,591 |
hyperswitch-client-core | src/types/Types.res | .res | type redirectTypeJson = {
name: string,
text: string,
header: string,
fields: array<string>,
}
type retrieve = Payment | List
let defaultRedirectType = {
name: "",
text: "",
header: "",
fields: [],
}
type config = {
priorityArr: array<string>,
redirectionList: array<redirectTypeJson>,
}
let defau... | 582 | 10,592 |
hyperswitch-client-core | src/types/ConfirmButtonType.res | .res | type setChildRef = (
~isAllValuesValid: bool,
~handlePress: ReactNative.Event.pressEvent => unit,
~hasSomeFields: bool=?,
~paymentMethod: string,
~paymentExperience: PaymentMethodListType.payment_experience_type=?,
unit,
) => unit
| 65 | 10,593 |
hyperswitch-client-core | src/types/RequiredFieldsTypes.res | .res | @val
external importStatesAndCountries: string => promise<JSON.t> = "import"
type addressCountry = UseContextData | UseBackEndData(array<string>)
type payment_method_types_in_bank_debit = BECS | Other
type paymentMethodsFields =
| Email
| FullName
| InfoElement
| Country
| Bank
| SpecialField(React.elemen... | 4,910 | 10,594 |
hyperswitch-client-core | src/types/NativeSdkPropsKeys.res | .res | type keys = {
locale: string,
colors: string,
light: string,
dark: string,
primary: string,
background: string,
componentBackground: string,
componentBorder: string,
componentDivider: string,
componentText: string,
primaryText: string,
secondaryText: string,
placeholderText: string,
icon: st... | 1,785 | 10,595 |
hyperswitch-client-core | src/types/SessionsType.res | .res | open SdkTypes
type samsungPaySession = {
wallet_name: string,
version: string,
service_id: string,
order_number: string,
merchant: JSON.t,
amount: JSON.t,
protocol: string,
allowed_brands: array<JSON.t>,
}
type sessions = {
wallet_name: payment_method_type_wallet,
session_token: string,
session_... | 922 | 10,596 |
hyperswitch-client-core | src/types/SamsungPayType.res | .res | open Utils
type payment3DS = {
\"type": string,
version: string,
data: string,
}
type addressType = BILLING_ADDRESS | SHIPPING_ADDRESS
type addressCollectedFromSpay = {billingDetails?: string, shippingDetails?: string}
type paymentCredential = {
\"3_d_s": payment3DS,
card_brand: string,
card_last4digits:... | 764 | 10,597 |
hyperswitch-client-core | src/types/LocaleDataType.res | .res | type localeStrings = {
locale: string,
cardDetailsLabel: string,
cardNumberLabel: string,
localeDirection: string,
inValidCardErrorText: string,
unsupportedCardErrorText: string,
inCompleteCVCErrorText: string,
inValidCVCErrorText: string,
inCompleteExpiryErrorText: string,
inValidExpiryErrorText: s... | 1,676 | 10,598 |
hyperswitch-client-core | src/types/GooglePayTypeNew.res | .res | open SdkTypes
open Utils
type merchantInfo = {
merchantId: string,
merchantName: string,
}
type allowedPaymentMethodsParameters = {
allowedAuthMethods: array<string>,
allowedCardNetworks: array<string>,
billingAddressRequired: bool,
}
type tokenizationSpecificationParameters = {
gateway: string,
gatewa... | 2,772 | 10,599 |
hyperswitch-client-core | src/types/ExternalThreeDsTypes.res | .res | type statusType = {
status: string,
message: string,
}
type sdkEphemeralKey = {
kty: string,
crv: string,
x: string,
y: string,
}
type sdkInformation = {
sdk_app_id: string,
sdk_enc_data: string,
sdk_ephem_pub_key: sdkEphemeralKey,
sdk_trans_id: string,
sdk_reference_number: string,
sdk_max_ti... | 560 | 10,600 |
hyperswitch-client-core | src/types/SdkTypes.res | .res | open Utils
type localeTypes =
| En
| He
| Fr
| En_GB
| Ar
| Ja
| De
| Fr_BE
| Es
| Ca
| Pt
| It
| Pl
| Nl
| NI_BE
| Sv
| Ru
| Lt
| Cs
| Sk
| Ls
| Cy
| El
| Et
| Fi
| Nb
| Bs
| Da
| Ms
| Tr_CY
type fontFamilyTypes = DefaultIOS | DefaultAndroid | CustomFont(st... | 7,441 | 10,601 |
hyperswitch-client-core | src/types/TabViewType.res | .res | type route = {
key: int,
icon?: string,
title: string,
accessible?: bool,
accessibilityLabel?: string,
testID?: string,
componentHoc: (
~isScreenFocus: bool,
~setConfirmButtonDataRef: React.element => unit,
) => React.element,
}
type scene = {route: route}
type navigationState = {
index: int... | 505 | 10,602 |
hyperswitch-client-core | src/types/PaymentMethodListType.res | .res | open Utils
type payment_experience_type = INVOKE_SDK_CLIENT | REDIRECT_TO_URL | NONE
type mandatePaymentType = {
amount: int,
currency: string,
confirm: bool,
customer_id: string,
authentication_type: string,
mandate_id: string,
off_session: bool,
business_country: string,
business_label: string,
}
t... | 3,687 | 10,603 |
hyperswitch-client-core | src/types/LoggerTypes.res | .res | type logType = DEBUG | INFO | ERROR | WARNING
type logCategory = API | USER_ERROR | USER_EVENT | MERCHANT_EVENT
type logComponent = MOBILE
type apiLogType = Request | Response | NoResponse | Err
type sdkVersionFetched =
| PACKAGE_JSON_NOT_STARTED
| PACKAGE_JSON_LOADING
| PACKAGE_JSON_REFERENCE_ERROR
| PACKAGE_J... | 550 | 10,604 |
hyperswitch-client-core | src/types/PlaidTypes.res | .res | type linkLogLevel = DEBUG | INFO | WARN | ERROR
type commonPlaidLinkOptions = {
logLevel?: linkLogLevel,
extras?: Js.Dict.t<Js.Json.t>,
}
type linkTokenConfiguration = {
token: string,
noLoadingState?: bool,
...commonPlaidLinkOptions,
}
type linkInstitution = {
id: string,
name: string,
}
type linkErr... | 226 | 10,605 |
hyperswitch-client-core | src/utility/libraries/ReactNativeSvg.res | .res | module Svg = {
@module("react-native-svg/src") @react.component
external make: (
~uri: string=?,
~width: float=?,
~viewBox: string=?,
~height: float=?,
~fill: string=?,
~onError: unit => unit=?,
~onLoad: unit => unit=?,
~children: React.element=?,
) => React.element = "Svg"
}
modu... | 832 | 10,606 |
hyperswitch-client-core | src/utility/libraries/RescriptCoreFuture.res | .res | module Dict = {
type key = string
let map = (mapper, dict) => {
dict
->Dict.toArray
->Array.map(entry => {
let (key, val) = entry
(key, mapper(val))
})
->Dict.fromArray
}
let fromList = list => {
Dict.fromArray(list->List.toArray)
}
}
module Nullable = {
external isNul... | 149 | 10,607 |
hyperswitch-client-core | src/utility/libraries/portal/PortalManager.res | .res | type portalItem = {
key: int,
children: React.element,
}
type portals = {
mount: (int, React.element) => unit,
update: (int, React.element) => unit,
unmount: int => unit,
}
@react.component
let make = React.forwardRef((ref: Js.Nullable.t<React.ref<Nullable.t<portals>>>) => {
let (portals, setPortals) = Re... | 319 | 10,608 |
hyperswitch-client-core | src/utility/libraries/portal/Portal.res | .res | @react.component
let make = (~children) => {
let portalManager = React.useContext(PortalContext.portalContext)
let currentPortalKey = React.useRef(null)
React.useEffect1(() => {
switch currentPortalKey.current->Nullable.toOption {
| Some(key) => portalManager.update(key, children)
| None => currentPo... | 147 | 10,609 |
hyperswitch-client-core | src/utility/libraries/portal/PortalHost.res | .res | open ReactNative
open PortalContext
@react.component
let make = (~children) => {
let managerRef = React.useRef(null)
let nextKey = React.useRef(0)
let queue = React.useRef([])
React.useEffect1(() => {
switch managerRef.current->Nullable.toOption {
| Some(manager: PortalManager.portals) =>
while ... | 480 | 10,610 |
hyperswitch-client-core | src/utility/libraries/portal/PortalContext.res | .res | type operation =
| Mount({key: int, children: React.element})
| Unmount({key: int})
| Update({key: int, children: React.element})
type portalMethods = {
mount: React.element => int,
update: (int, React.element) => unit,
unmount: int => unit,
}
let defaultVal = {
mount: _ => 0,
unmount: _ => (),
upda... | 151 | 10,611 |
hyperswitch-client-core | src/utility/libraries/bsfetch/Fetch__Iterator.ml | .ml | module Next = struct
type 'a t
external done_ : _ t -> bool option = "done" [@@bs.get]
external value : 'a t -> 'a option = "value" [@@bs.get] [@@bs.return nullable]
end
type 'a t
external next : 'a t -> 'a Next.t = "next" [@@bs.send]
let rec forEach ~f t =
let item = next t in
match Next.(done_ item, val... | 170 | 10,612 |
hyperswitch-client-core | src/utility/libraries/bsfetch/Fetch__Iterator.mli | .mli | (** We need to bind to JavaScript Iterators for FormData functionality.
But ideally this binding should be moved into BuckleScript itself.
@see {{: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols}} *)
module Next : sig
type 'a t
external done_ : _ t -> bool option = ... | 190 | 10,613 |
hyperswitch-client-core | src/utility/libraries/bsfetch/Fetch.res | .res | type body
type bodyInit
type headers
type headersInit
type response
type request
type requestInit
type abortController
type signal
/* external */
type arrayBuffer /* TypedArray */
type bufferSource /* Web IDL, either an arrayBuffer or arrayBufferView */
type formData /* XMLHttpRequest */
type readableStream /* Streams... | 3,653 | 10,614 |
hyperswitch-client-core | src/utility/logics/PMLUtils.res | .res | let handleCustomerPMLResponse = (
~customerSavedPMData,
~sessions: AllApiDataContext.sessions,
~isPaymentMethodManagement,
~nativeProp: SdkTypes.nativeProp,
) => {
switch customerSavedPMData {
| Some(obj) => {
let spmData = obj->PaymentMethodListType.jsonToSavedPMObj
let isSamsungDevice = native... | 647 | 10,615 |
hyperswitch-client-core | src/utility/logics/ThreeDsUtils.res | .res | open ExternalThreeDsTypes
let getThreeDsNextActionObj = (
nextActionObj: option<PaymentConfirmTypes.nextAction>,
): PaymentConfirmTypes.nextAction => {
nextActionObj->Option.getOr({
redirectToUrl: "",
type_: "",
threeDsData: {
threeDsAuthenticationUrl: "",
threeDsAuthorizeUrl: "",
mess... | 683 | 10,616 |
hyperswitch-client-core | src/utility/logics/GZipUtils.res | .res | type options = {to: string}
@module("pako")
external inflate: (Fetch.arrayBuffer, options) => string = "inflate"
let extractZipFromResp = resp => {
resp
->Promise.then(response => response->Fetch.Response.arrayBuffer)
->Promise.then(async arrayBuffer =>
arrayBuffer->inflate({
to: "string",
})
)
... | 210 | 10,617 |
hyperswitch-client-core | src/utility/logics/PaymentUtils.res | .res | let checkIfMandate = (paymentType: PaymentMethodListType.mandateType) => {
paymentType == NEW_MANDATE || paymentType == SETUP_MANDATE
}
let showUseExisitingSavedCardsBtn = (
~isGuestCustomer,
~pmList,
~mandateType,
~displaySavedPaymentMethods,
) => {
!isGuestCustomer &&
pmList->Option.getOr([])->Array.le... | 1,547 | 10,618 |
hyperswitch-client-core | src/utility/logics/Utils.res | .res | let getProp = (str, dict) => {
dict->Dict.get(str)
}
let retOptionalStr = x => {
switch x {
| Some(c) => c->JSON.Decode.string
| None => None
}
}
let retOptionalFloat = x => {
switch x {
| Some(c) => c->JSON.Decode.float
| None => None
}
}
let getOptionString = (dict, key) => {
dict->Dict.get(key)... | 2,550 | 10,619 |
hyperswitch-client-core | src/utility/logics/Window.res | .res | type listener<'ev> = 'ev => unit
@val @scope("window") @val
external postMessage: (string, string) => unit = "postMessage"
@val @scope(("window", "parent")) @val
external postMessageToParent: (string, string) => unit = "postMessage"
@val @scope("window")
external addEventListener: (string, listener<'ev>) => unit = "... | 1,941 | 10,620 |
hyperswitch-client-core | src/utility/logics/LoggerUtils.res | .res | open LoggerTypes
let eventToStrMapper = (eventName: eventName) => {
(eventName :> string)
}
let sdkVersionRef = ref(PACKAGE_JSON_NOT_STARTED)
let logFileToObj = logFile => {
[
("timestamp", logFile.timestamp->JSON.Encode.string),
(
"log_type",
switch logFile.logType {
| DEBUG => "DEBUG"
... | 877 | 10,621 |
hyperswitch-client-core | src/utility/logics/UIUtils.res | .res | module RenderIf = {
@react.component
let make = (~condition, ~children) => {
if condition {
children
} else {
React.null
}
}
}
| 42 | 10,622 |
hyperswitch-client-core | src/utility/reusableCodeFromWeb/PostalCodes.res | .res | type postalCodes = {
@dead note: string,
@dead country: string,
iso: string,
@dead format: string,
regex: string,
}
let defaultPostalCode = {
note: "",
country: "",
iso: "",
format: "",
regex: "",
}
let postalCode = [
{
note: "The first two digits (ranging from 10–43) correspond to the provinc... | 14,693 | 10,623 |
hyperswitch-client-core | src/utility/reusableCodeFromWeb/ErrorUtils.res | .res | type errorType = Error | Warning
type errorStringType = Dynamic(string => string) | Static(string)
type errorTupple = (errorType, errorStringType)
type errorKey =
| INVALID_PK(errorTupple)
| INVALID_EK(errorTupple)
| DEPRECATED_LOADSTRIPE(errorTupple)
| REQUIRED_PARAMETER(errorTupple)
| UNKNOWN_KEY(errorTuppl... | 878 | 10,624 |
hyperswitch-client-core | src/utility/reusableCodeFromWeb/StatesAndCountry.json | .json | {"country":[{"isoAlpha2":"AF","value":"Afghanistan","timeZones":["Asia/Kabul"]},{"isoAlpha2":"AX","value":"Aland Islands","timeZones":["Europe/Mariehamn"]},{"isoAlpha2":"AL","value":"Albania","timeZones":["Europe/Tirane"]},{"isoAlpha2":"DZ","value":"Algeria","timeZones":["Africa/Algiers"]},{"isoAlpha2":"AS","value":"Am... | 68,064 | 10,625 |
hyperswitch-client-core | src/utility/reusableCodeFromWeb/Validation.res | .res | type cardIssuer =
| VISA
| MASTERCARD
| AMEX
| MAESTRO
| DINERSCLUB
| DISCOVER
| BAJAJ
| SODEXO
| RUPAY
| JCB
| CARTESBANCAIRES
| NOTFOUND
let toInt = val => val->Int.fromString->Option.getOr(0)
let cardType = val => {
switch val->String.toUpperCase {
| "VISA" => VISA
| "MASTERCARD" => M... | 5,183 | 10,626 |
hyperswitch-client-core | src/utility/reusableCodeFromWeb/Bank.res | .res | type bank = {
displayName: string,
hyperSwitch: string,
}
let bankNameConverter = (var: array<string>) => {
let final = var->Array.map(item => {
let x =
item
->String.split("_")
->Array.map(w => {
w->String.charAt(0)->String.toUpperCase ++ w->String.sliceToEnd(~start=1)
})
... | 120 | 10,627 |
hyperswitch-client-core | src/utility/reusableCodeFromWeb/ErrorHooks.res | .res | let useShowErrorOrWarning = () => {
let customAlert = AlertHook.useAlerts()
(inputKey: ErrorUtils.errorKey, ~dynamicStr="", ()) => {
let (type_, str) = switch inputKey {
| INVALID_PK(var) => var
| INVALID_EK(var) => var
| DEPRECATED_LOADSTRIPE(var) => var
| REQUIRED_PARAMETER(var) => var
| U... | 671 | 10,628 |
hyperswitch-client-core | src/utility/constants/GlobalVars.res | .res | type envType = INTEG | SANDBOX | PROD
let checkEnv = publishableKey => {
if publishableKey != "" && publishableKey->String.startsWith("pk_prd_") {
PROD
} else {
SANDBOX
}
}
let isValidPK = (env: envType, publishableKey) => {
switch (env, publishableKey) {
| (_, "") => false
| (PROD, pk) => pk->Str... | 154 | 10,629 |
hyperswitch-client-core | src/utility/constants/GlobalHooks.res | .res | let useGetBaseUrl = () => {
let (nativeProp, _) = React.useContext(NativePropContext.nativePropContext)
() => {
switch nativeProp.customBackendUrl {
| Some(url) => url
| None =>
switch nativeProp.env {
| PROD => "https://api.hyperswitch.io"
| SANDBOX => "https://sandbox.hyperswitch.io"... | 415 | 10,630 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.