Skip to content

Commit

Permalink
Merge branch 'main' into dob-log
Browse files Browse the repository at this point in the history
  • Loading branch information
PritishBudhiraja authored Sep 9, 2024
2 parents 9caae93 + bddeb86 commit 02ab7fc
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 15 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [0.84.17](https://github.com/juspay/hyperswitch-web/compare/v0.84.16...v0.84.17) (2024-09-09)

## [0.84.16](https://github.com/juspay/hyperswitch-web/compare/v0.84.15...v0.84.16) (2024-09-09)


### Bug Fixes

* added wild cards support ([#601](https://github.com/juspay/hyperswitch-web/issues/601)) ([54e613c](https://github.com/juspay/hyperswitch-web/commit/54e613cc4e992f760543c1be796cf7563c5c78cf))

## [0.84.15](https://github.com/juspay/hyperswitch-web/compare/v0.84.14...v0.84.15) (2024-09-09)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orca-payment-page",
"version": "0.84.15",
"version": "0.84.17",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
8 changes: 6 additions & 2 deletions src/CardUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,12 @@ let maxCardLength = cardBrand => {

let cardValid = (cardNumber, cardBrand) => {
let clearValueLength = cardNumber->clearSpaces->String.length
(clearValueLength == maxCardLength(cardBrand) ||
(cardBrand === "Visa" && clearValueLength == 16)) && calculateLuhn(cardNumber)
if cardBrand == "" && (GlobalVars.isInteg || GlobalVars.isSandbox) {
Utils.checkIsTestCardWildcard(cardNumber)
} else {
(clearValueLength == maxCardLength(cardBrand) ||
(cardBrand === "Visa" && clearValueLength == 16)) && calculateLuhn(cardNumber)
}
}
let blurRef = (ref: React.ref<Nullable.t<Dom.element>>) => {
ref.current->Nullable.toOption->Option.forEach(input => input->blur)->ignore
Expand Down
2 changes: 1 addition & 1 deletion src/GlobalVars.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
@val external maxLogsPushedPerEventName: int = "maxLogsPushedPerEventName"
let targetOrigin: string = "*"
let isInteg = sdkUrl === "https://dev.hyperswitch.io"
let isSandbox = sdkUrl === "https://beta.hyperswitch.io"
let isSandbox = sdkUrl === "https://beta.hyperswitch.io" || sdkUrl === "http://localhost:9050"
let isProd = sdkUrl === "https://checkout.hyperswitch.io"
3 changes: 2 additions & 1 deletion src/Payment.res
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ let make = (~paymentMode, ~integrateError, ~logger) => {
setCardValid(clearValue, setIsCardValid)
if (
cardValid(clearValue, cardBrand) &&
PaymentUtils.checkIsCardSupported(clearValue, supportedCardBrands)->Option.getOr(false)
(PaymentUtils.checkIsCardSupported(clearValue, supportedCardBrands)->Option.getOr(false) ||
Utils.checkIsTestCardWildcard(clearValue))
) {
handleInputFocus(~currentRef=cardRef, ~destinationRef=expiryRef)
}
Expand Down
4 changes: 3 additions & 1 deletion src/Utilities/PaymentUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,9 @@ let getSupportedCardBrands = (
let checkIsCardSupported = (cardNumber, supportedCardBrands) => {
let cardBrand = cardNumber->CardUtils.getCardBrand
let clearValue = cardNumber->CardUtils.clearSpaces
if CardUtils.cardValid(clearValue, cardBrand) {
if cardBrand == "" && (GlobalVars.isInteg || GlobalVars.isSandbox) {
Some(CardUtils.cardValid(clearValue, cardBrand))
} else if CardUtils.cardValid(clearValue, cardBrand) {
switch supportedCardBrands {
| Some(brands) => Some(brands->Array.includes(cardBrand->String.toLowerCase))
| None => Some(true)
Expand Down
2 changes: 2 additions & 0 deletions src/Utilities/Utils.res
Original file line number Diff line number Diff line change
Expand Up @@ -1375,3 +1375,5 @@ let getFirstAndLastNameFromFullName = fullName => {

(firstName, lastNameJson)
}

let checkIsTestCardWildcard = val => ["1111222233334444"]->Array.includes(val)
7 changes: 0 additions & 7 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ const confirmEndPoint =
const logEndpoint =
envLoggingUrl || `https://${logDomain}.hyperswitch.io/logs/sdk`;

console.log("Test SDK values ===>", {
sdkEnv,
sdkUrl,
backendEndPoint,
confirmEndPoint,
});

const enableLogging = true;
const loggingLevel = "DEBUG";
const maxLogsPushedPerEventName = 100;
Expand Down

0 comments on commit 02ab7fc

Please sign in to comment.