From 2cc4bde25b0ef047ee7bc9debca3f78b5367aff5 Mon Sep 17 00:00:00 2001 From: Nathan Booker Date: Mon, 19 Jun 2017 10:20:37 -0500 Subject: [PATCH] STENCIL-3533 Remove gift certificate format validation Before we had a Gift Certificates API for the creation or import of gift certificates from another system, gift certificates in BC were all of a single format, alphanumeric with hyphens like this: AAA-AAA-AAA-AAA However, now we have the API and 3rd parties are welcome to import certificates of an arbitrary format. However, Cornerstone still validates the old format, which will cause these imported certificates to fail.Making this change to fix that and allow any format. --- CHANGELOG.md | 1 + assets/js/theme/common/gift-certificate-validator.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d42c126118..a96ac97980 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Swaps `writeReview` for `write_review` to fix email link issue [#1017](https://github.com/bigcommerce/cornerstone/pull/1017) - Maintenance page stylesheet fix [#1016](https://github.com/bigcommerce/cornerstone/pull/1016) - Restore four products per row on category pages when sidebar is empty. [#1018](https://github.com/bigcommerce/cornerstone/pull/1018) +- Remove gift certificate format validation [#1026](https://github.com/bigcommerce/cornerstone/pull/1026) ## 1.8.1 (2017-05-05) - Bug fix for category sidebar [#1006](https://github.com/bigcommerce/cornerstone/pull/1006) diff --git a/assets/js/theme/common/gift-certificate-validator.js b/assets/js/theme/common/gift-certificate-validator.js index 0d4b080fab..da49d7fdd7 100644 --- a/assets/js/theme/common/gift-certificate-validator.js +++ b/assets/js/theme/common/gift-certificate-validator.js @@ -3,5 +3,6 @@ export default function (cert) { return false; } - return /^[A-Z0-9]{3}\-[A-Z0-9]{3}\-[A-Z0-9]{3}\-[A-Z0-9]{3}$/.exec(cert); + // Add any custom gift certificate validation logic here + return true; }