Open seyyed-sina opened 4 years ago
Hi @spostad7,
If you check the code there is a function named recognize
that does the exact same thing.
Unfortunately it is not documented.
According to bank rules the first 6 digits makes the bank type.
Don't forget to give a Star.
I got 'false' when I use this syntax:
const value = e.target.value;
let bankName = Sheba.recognize(value)
console.log("bankName", bankName)
@spostad7 You can check the code yourself. Let me know if there was problem. Also Mellet card type exists in database (6104-33*).
sorry, but I get false for both recognize and isValid method. this is my code for isValid method that I getting false:
console.log("Sheba.isValid(6104337764492508)", Sheba.isValid('6104337764492508'))
@spostad7 Are you sure? I just tested it and this is my result:
console.log(Sheba.isValid('6104337764492508'));
true
console.log(Sheba.recognize('6104337764492508'));
{ nickname: 'mellat',
name: 'Mellat Bank',
persianName: 'بانک ملت',
code: '610433' }
I am using React ^16.8.6, here is the base code for iran-shetab package. I guess maybe there is a mistake between 'iran-shetab' and 'iran-sheba' in the document, but for this code I used 'iran-shetab' and it is pretty straightforward.
import Sheba from 'iran-shetab';
handleInput = e => {
const value = e.target.value;
console.log('value', value);
console.log('is valid sheba', Sheba.isValid(value));
};
<input
type="text"
id="account_num"
name="account_num"
pattern="\d+"
className="inputbox inputbox_ltr user-profile__box-input"
value={this.state.fields.account}
onChange={this.handleInput}
/>
is it possible to add bank type (e.g: melli, mellat, ...) from card number? for example: '6104-....' credit cards return mellat also it could be nice to add bank icon