Date: Thu, 13 Jun 2024 15:58:40 +0530
Subject: [PATCH 07/11] feat: added prop for displayDefaultSavedPaymentIcon
(#434)
Co-authored-by: Praful Koppalkar <126236898+prafulkoppalkar@users.noreply.github.com>
---
src/Components/SavedCardItem.res | 8 ++++++--
src/Types/PaymentType.res | 4 ++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/Components/SavedCardItem.res b/src/Components/SavedCardItem.res
index 12bb74ca1..940b31aa9 100644
--- a/src/Components/SavedCardItem.res
+++ b/src/Components/SavedCardItem.res
@@ -11,7 +11,9 @@ let make = (
~setRequiredFieldsBody,
) => {
let {themeObj, config, localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom)
- let {hideExpiredPaymentMethods} = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom)
+ let {hideExpiredPaymentMethods, displayDefaultSavedPaymentIcon} = Recoil.useRecoilValueFromAtom(
+ RecoilAtoms.optionAtom,
+ )
let (cardBrand, setCardBrand) = Recoil.useRecoilState(RecoilAtoms.cardBrand)
let (
isCVCValid,
@@ -116,7 +118,9 @@ let make = (
: {React.string(paymentMethodType->Utils.snakeToTitleCase)}
}
-
+
diff --git a/src/Types/PaymentType.res b/src/Types/PaymentType.res
index a9b3c807c..adf21f04c 100644
--- a/src/Types/PaymentType.res
+++ b/src/Types/PaymentType.res
@@ -164,6 +164,7 @@ type options = {
paymentMethodsHeaderText?: string,
savedPaymentMethodsHeaderText?: string,
hideExpiredPaymentMethods: bool,
+ displayDefaultSavedPaymentIcon: bool,
}
let defaultCardDetails = {
scheme: None,
@@ -295,6 +296,7 @@ let defaultOptions = {
billingAddress: defaultBillingAddress,
sdkHandleConfirmPayment: defaultSdkHandleConfirmPayment,
hideExpiredPaymentMethods: false,
+ displayDefaultSavedPaymentIcon: true,
}
let getLayout = (str, logger) => {
switch str {
@@ -978,6 +980,7 @@ let itemToObjMapper = (dict, logger) => {
"paymentMethodsHeaderText",
"savedPaymentMethodsHeaderText",
"hideExpiredPaymentMethods",
+ "displayDefaultSavedPaymentIcon",
],
dict,
"options",
@@ -1019,6 +1022,7 @@ let itemToObjMapper = (dict, logger) => {
paymentMethodsHeaderText: ?getOptionString(dict, "paymentMethodsHeaderText"),
savedPaymentMethodsHeaderText: ?getOptionString(dict, "savedPaymentMethodsHeaderText"),
hideExpiredPaymentMethods: getBool(dict, "hideExpiredPaymentMethods", false),
+ displayDefaultSavedPaymentIcon: getBool(dict, "displayDefaultSavedPaymentIcon", true),
}
}
From 4897ed7551b15d6e1da7dce4fdb7efe1bb3e6a58 Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Thu, 13 Jun 2024 10:30:12 +0000
Subject: [PATCH 08/11] chore(release): 0.65.0 [skip ci]
# [0.65.0](https://github.com/juspay/hyperswitch-web/compare/v0.64.0...v0.65.0) (2024-06-13)
### Features
* added prop for displayDefaultSavedPaymentIcon ([#434](https://github.com/juspay/hyperswitch-web/issues/434)) ([b141aed](https://github.com/juspay/hyperswitch-web/commit/b141aedf07e8eff9d6653440631aa193e72db712))
---
CHANGELOG.md | 7 +++++++
package-lock.json | 4 ++--
package.json | 2 +-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d2405aee5..b6dc1925b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+# [0.65.0](https://github.com/juspay/hyperswitch-web/compare/v0.64.0...v0.65.0) (2024-06-13)
+
+
+### Features
+
+* added prop for displayDefaultSavedPaymentIcon ([#434](https://github.com/juspay/hyperswitch-web/issues/434)) ([b141aed](https://github.com/juspay/hyperswitch-web/commit/b141aedf07e8eff9d6653440631aa193e72db712))
+
# [0.64.0](https://github.com/juspay/hyperswitch-web/compare/v0.63.0...v0.64.0) (2024-06-13)
diff --git a/package-lock.json b/package-lock.json
index 3542fd75e..0f02a990a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "orca-payment-page",
- "version": "0.64.0",
+ "version": "0.65.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "orca-payment-page",
- "version": "0.64.0",
+ "version": "0.65.0",
"hasInstallScript": true,
"dependencies": {
"@aws-sdk/client-cloudfront": "^3.414.0",
diff --git a/package.json b/package.json
index 39e78d75b..b90d8c067 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "orca-payment-page",
- "version": "0.64.0",
+ "version": "0.65.0",
"main": "index.js",
"private": true,
"dependencies": {
From 4745fa259ef3398fd0c9a39b12fe622b29a824ca Mon Sep 17 00:00:00 2001
From: ArushKapoorJuspay <121166031+ArushKapoorJuspay@users.noreply.github.com>
Date: Thu, 13 Jun 2024 16:30:00 +0530
Subject: [PATCH 09/11] fix: transforming billing and shipping country code to
touppercase for applepay (#441)
---
src/Utilities/DynamicFieldsUtils.res | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/Utilities/DynamicFieldsUtils.res b/src/Utilities/DynamicFieldsUtils.res
index 13b62e520..976d62f7f 100644
--- a/src/Utilities/DynamicFieldsUtils.res
+++ b/src/Utilities/DynamicFieldsUtils.res
@@ -818,6 +818,9 @@ let getApplePayRequiredFields = (
addressLines->Array.get(index)->Option.getOr("")
}
+ let billingCountryCode = billingContact.countryCode->String.toUpperCase
+ let shippingCountryCode = shippingContact.countryCode->String.toUpperCase
+
let fieldVal = switch item.field_type {
| FullName
| BillingName =>
@@ -833,11 +836,10 @@ let getApplePayRequiredFields = (
Utils.getStateNameFromStateCodeAndCountry(
statesList,
billingContact.administrativeArea,
- billingContact.countryCode,
+ billingCountryCode,
)
| Country
- | AddressCountry(_) =>
- billingContact.countryCode
+ | AddressCountry(_) => billingCountryCode
| AddressPincode => billingContact.postalCode
| Email => shippingContact.emailAddress
| PhoneNumber => shippingContact.phoneNumber
@@ -849,9 +851,9 @@ let getApplePayRequiredFields = (
Utils.getStateNameFromStateCodeAndCountry(
statesList,
shippingContact.administrativeArea,
- shippingContact.countryCode,
+ shippingCountryCode,
)
- | ShippingAddressCountry(_) => shippingContact.countryCode
+ | ShippingAddressCountry(_) => shippingCountryCode
| ShippingAddressPincode => shippingContact.postalCode
| _ => ""
}
From d923d7f058bc3b4037007cdc20cc4f7b7a44c2a9 Mon Sep 17 00:00:00 2001
From: Pritish Budhiraja
Date: Thu, 13 Jun 2024 16:30:33 +0530
Subject: [PATCH 10/11] refactor: sort saved customer methods (#427)
---
src/PaymentElement.res | 4 ++++
src/Types/PaymentType.res | 4 ++++
src/Utilities/Utils.res | 10 ++++++++++
3 files changed, 18 insertions(+)
diff --git a/src/PaymentElement.res b/src/PaymentElement.res
index 2d6803821..3546bee9e 100644
--- a/src/PaymentElement.res
+++ b/src/PaymentElement.res
@@ -66,6 +66,10 @@ let make = (~cardProps, ~expiryProps, ~cvcProps, ~paymentType: CardThemeType.mod
| None => savedCardsWithoutDefaultPaymentMethod
}
+ finalSavedPaymentMethods->Array.sort((a, b) =>
+ compareLogic(Date.fromString(a.lastUsedAt), Date.fromString(b.lastUsedAt))
+ )
+
setSavedMethods(_ => finalSavedPaymentMethods)
setLoadSavedCards(_ =>
finalSavedPaymentMethods->Array.length == 0
diff --git a/src/Types/PaymentType.res b/src/Types/PaymentType.res
index adf21f04c..7fa528e48 100644
--- a/src/Types/PaymentType.res
+++ b/src/Types/PaymentType.res
@@ -128,6 +128,7 @@ type customerMethods = {
paymentMethodType: option,
defaultPaymentMethodSet: bool,
requiresCvv: bool,
+ lastUsedAt: string,
}
type savedCardsLoadState =
LoadingSavedCards | LoadedSavedCards(array, bool) | NoResult(bool)
@@ -184,6 +185,7 @@ let defaultCustomerMethods = {
paymentMethodType: None,
defaultPaymentMethodSet: false,
requiresCvv: true,
+ lastUsedAt: "",
}
let defaultLayout = {
defaultCollapsed: false,
@@ -877,6 +879,7 @@ let createCustomerObjArr = dict => {
paymentMethodType: getPaymentMethodType(dict),
defaultPaymentMethodSet: getBool(dict, "default_payment_method_set", false),
requiresCvv: getBool(dict, "requires_cvv", true),
+ lastUsedAt: getString(dict, "last_used_at", ""),
}
})
LoadedSavedCards(customerPaymentMethods, isGuestCustomer)
@@ -899,6 +902,7 @@ let getCustomerMethods = (dict, str) => {
paymentMethodType: getPaymentMethodType(dict),
defaultPaymentMethodSet: getBool(dict, "default_payment_method_set", false),
requiresCvv: getBool(dict, "requires_cvv", true),
+ lastUsedAt: getString(dict, "last_used_at", ""),
}
})
LoadedSavedCards(customerPaymentMethods, false)
diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res
index dd475b9f4..8336197e7 100644
--- a/src/Utilities/Utils.res
+++ b/src/Utilities/Utils.res
@@ -1283,6 +1283,16 @@ let getStateNameFromStateCodeAndCountry = (list: JSON.t, stateCode: string, coun
let removeHyphen = str => str->String.replaceRegExp(%re("/-/g"), "")
+let compareLogic = (a, b) => {
+ if a == b {
+ 0.
+ } else if a > b {
+ -1.
+ } else {
+ 1.
+ }
+}
+
let currencyNetworksDict =
[
("BTC", ["bitcoin", "bnb_smart_chain"]),
From ebe60f5e29f507cb47e73b7da451e3f7e71b98af Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Thu, 13 Jun 2024 11:02:05 +0000
Subject: [PATCH 11/11] chore(release): 0.65.1 [skip ci]
## [0.65.1](https://github.com/juspay/hyperswitch-web/compare/v0.65.0...v0.65.1) (2024-06-13)
### Bug Fixes
* transforming billing and shipping country code to touppercase for applepay ([#441](https://github.com/juspay/hyperswitch-web/issues/441)) ([4745fa2](https://github.com/juspay/hyperswitch-web/commit/4745fa259ef3398fd0c9a39b12fe622b29a824ca))
---
CHANGELOG.md | 7 +++++++
package-lock.json | 4 ++--
package.json | 2 +-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b6dc1925b..277aa2771 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## [0.65.1](https://github.com/juspay/hyperswitch-web/compare/v0.65.0...v0.65.1) (2024-06-13)
+
+
+### Bug Fixes
+
+* transforming billing and shipping country code to touppercase for applepay ([#441](https://github.com/juspay/hyperswitch-web/issues/441)) ([4745fa2](https://github.com/juspay/hyperswitch-web/commit/4745fa259ef3398fd0c9a39b12fe622b29a824ca))
+
# [0.65.0](https://github.com/juspay/hyperswitch-web/compare/v0.64.0...v0.65.0) (2024-06-13)
diff --git a/package-lock.json b/package-lock.json
index 0f02a990a..60c2c1ce4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "orca-payment-page",
- "version": "0.65.0",
+ "version": "0.65.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "orca-payment-page",
- "version": "0.65.0",
+ "version": "0.65.1",
"hasInstallScript": true,
"dependencies": {
"@aws-sdk/client-cloudfront": "^3.414.0",
diff --git a/package.json b/package.json
index b90d8c067..feb42c94d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "orca-payment-page",
- "version": "0.65.0",
+ "version": "0.65.1",
"main": "index.js",
"private": true,
"dependencies": {