diff --git a/src/app/productConfig/productConfigForm/productConfigForm.component.js b/src/app/productConfig/productConfigForm/productConfigForm.component.js index 8cdc0d186..2742cb0f7 100644 --- a/src/app/productConfig/productConfigForm/productConfigForm.component.js +++ b/src/app/productConfig/productConfigForm/productConfigForm.component.js @@ -315,14 +315,7 @@ class ProductConfigFormController { const data = this.omitIrrelevantData(this.itemConfig) const comment = data.DONATION_SERVICES_COMMENTS const isTestingTransaction = comment ? comment.toLowerCase().includes('test') : false - const transformedAmount = this.transformAmountIfNecessary(data.AMOUNT) - if (transformedAmount === 'error') { - this.submittingGift = false - this.errorSavingGeneric = true - this.onStateChange({ state: 'errorSubmitting' }) - return - } - data.AMOUNT = transformedAmount + data.AMOUNT = this.transformAmountIfNecessary(data.AMOUNT) this.brandedAnalyticsFactory.saveTestingTransaction(isTestingTransaction) this.analyticsFactory.saveTestingTransaction(this.productData, isTestingTransaction) @@ -373,10 +366,9 @@ class ProductConfigFormController { let transformedAmount = amount if (!angular.isNumber(amount)) { transformedAmount = amount.replace('$', '') - transformedAmount = transformedAmount.replace(',', '') transformedAmount = parseFloat(transformedAmount) if (isNaN(transformedAmount)) { - return 'error' + return amount } } return transformedAmount diff --git a/src/app/productConfig/productConfigForm/productConfigForm.component.spec.js b/src/app/productConfig/productConfigForm/productConfigForm.component.spec.js index 2819578a0..ac9647f37 100644 --- a/src/app/productConfig/productConfigForm/productConfigForm.component.spec.js +++ b/src/app/productConfig/productConfigForm/productConfigForm.component.spec.js @@ -728,17 +728,6 @@ describe('product config form component', function () { expect($ctrl.errorAlreadyInCart).toEqual(false) expect($ctrl.errorSavingGeneric).toEqual(false) }) - - it('should fail if the amount is invalid', () => { - $ctrl.itemConfig.AMOUNT = 'test' - $ctrl.itemConfigForm.$dirty = true - $ctrl.saveGiftToCart() - - expect($ctrl.submittingGift).toEqual(false) - expect($ctrl.onStateChange).toHaveBeenCalledWith({ state: 'errorSubmitting' }) - expect($ctrl.errorAlreadyInCart).toEqual(false) - expect($ctrl.errorSavingGeneric).toEqual(true) - }) } }) @@ -803,14 +792,9 @@ describe('product config form component', function () { expect($ctrl.transformAmountIfNecessary(amount)).toEqual(50) }) - it('should remove the comma', () => { - const amount = '1,000' - expect($ctrl.transformAmountIfNecessary(amount)).toEqual(1000) - }) - - it('should return an error', () => { + it('should pass through the original amount', () => { const amount = 'test' - expect($ctrl.transformAmountIfNecessary(amount)).toEqual('error') + expect($ctrl.transformAmountIfNecessary(amount)).toEqual('test') }) }) })