diff --git a/src/Constraints/Bic.js b/src/Constraints/Bic.js index f4bb978..d8702c9 100644 --- a/src/Constraints/Bic.js +++ b/src/Constraints/Bic.js @@ -95,7 +95,7 @@ export default class Bic extends AbstractConstraint { if (this.options.iban_path !== null && isString(this.options.iban_path)) { // we assume that we have valid IBAN - const iban = options.form[this.options.iban_path]; + const iban = options.form.data[this.options.iban_path]; if (this.isEmptyValue(iban)) { return; diff --git a/tests/Constraints/Bic.spec.js b/tests/Constraints/Bic.spec.js index 51897bc..8ee7260 100644 --- a/tests/Constraints/Bic.spec.js +++ b/tests/Constraints/Bic.spec.js @@ -93,7 +93,7 @@ describe('Bic', function () { {bic:'BARCVGSA', iban: 'GB12 CPBK 0892 9965 0449 911'}, ] .forEach((pair) => { - const e = object.validate(pair.bic, {form: {my_awesome_iban: pair.iban}}); + const e = object.validate(pair.bic, {form: {data: {my_awesome_iban: pair.iban}}}); assert.ok(typeof e === 'undefined', e); }); @@ -102,7 +102,7 @@ describe('Bic', function () { it('is invalid: with IBAN', function () { let object = new Bic({iban_path: 'my_awesome_iban'}); - const options = {form: {my_awesome_iban: 'FR14 2004 1010 0505 0001 3M02 606'}}; + const options = {form: {data: {my_awesome_iban: 'FR14 2004 1010 0505 0001 3M02 606'}}}; const e = object.validate('UNCRIT2B912', options); assert.strictEqual(e.message, 'This Business Identifier Code (BIC) is not associated with IBAN FR14 2004 1010 0505 0001 3M02 606.');