Open extra topbar

IBAN validation on fiat coin adapter

I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

IBAN validation on fiat coin adapter

dashed-slug.net Forums Fiat Coin Adapter extension support IBAN validation on fiat coin adapter

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #11314
    Plug
    Participant

    Sir please how do I disable the long validation of Iban in the fiat withdrawal form? I just need numbers only from 9 digits and above. I want anything from 0-9 and it must not be lesser than 9 numbers. Eg. 012345678 should validate.

    The Iban minified Js script is not giving me the freedom to achieve that.

    #11316
    alexg
    Keymaster

    Hello,

    Currently it is not possible to disable validation. I have added this option in the upcoming major release.

    As a temporary measure, for now, you can do the following:

    1. Delete the minified javascript file: wallets-fiat-0.6.3-beta.min.js. This will cause the plugin to fall back to using the unminified version, wallets-fiat.js

    2. Edit the wallets-fiat.js file as needed to conform to your validation requirements, if any.

    If you change line 116 from:

    return val && IBAN.isValid( val ); // check not empty, and valid iban format

    to
    return val.match( /^\d{9,}$/ );

    then this will disable IBAN validation, and will check if the value has at least 9 digits

    That’s it! (You can optionally minify the file if you want, but it’s not necessary.)

    As a sidenote, if you need to modify the error message for this field, use the wallets_fiat_ui_text_iban_invalid filter, like so:

    add_filter( 'wallets_fiat_ui_text_iban_invalid', function( $text ) {
    	return 'The number must be at least 9 digits long';
    } );

    And if you need to modify the name of the field (IBAN), you can do so with the wallets_fiat_ui_text_iban filter:

    add_filter( 'wallets_fiat_ui_text_iban', function( $text ) {
    	return 'Foo';
    } );

    Finally, if you need to modify the name of the option:

    add_filter( 'wallets_ui_text_swiftbiciban', function( $text ) {
    	return 'Other option';
    } );

    Please let me know if you have any questions.

    with regards

    #11318
    Plug
    Participant

    I love the way you take time to construct an understandable replies. Thanks a lot. This is what I need most because regex confuses me though I don’t know js much /^\d{9,}$/
    Thanks for all the other instructions because they mattered too. And it’s now fixed. Thanks.

    #11321
    alexg
    Keymaster

    Thanks, good to hear that this helped.

    Normally I don’t recommend that users edit the code, because any changes are overwritten by subsequent updates to the plugin.

    But this is a special case, as the fiat coin adapter will be merged to the parent plugin, as a fiat wallet adapter.

    You can rely on the fact that the WordPress text filters will be preserved.

    However, the JavaScript validation code will have to be different. Ask me again about this when the time comes to upgrade. It will be very easy to override frontend JS code in the next major version, using the new templates format.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.