ifsc v1.5.6 Razorpay.IFSC View Source

Razorpay IFSC Validation Module

Online validation (fetches details from ifsc.razorpay.com)

iex> IFSC.get("KKBK0000261")
{:ok,
 %Razorpay.IFSC{
   address: "JMD REGENT SQUARE,MEHRAULI GURGAON ROAD,OPPOSITE BRISTOL HOTEL,",
   bank: "Kotak Mahindra Bank",
   bank_code: "KKBK",
   branch: "GURGAON",
   city: "GURGAON",
   contact: "4131000",
   district: "GURGAON",
   ifsc: "KKBK0000261",
   rtgs: true,
   state: "HARYANA"
 }}

iex> IFSC.get("foobar")
{:error, :invalid_ifsc}

Offline validation using the dataset in the package - please keep ifsc up to date if using this

(Note that only the :bank, :bank_code and :ifsc fields are populated if using offline validation)

iex> IFSC.validate("KKBK0000261")
{:ok,
 %Razorpay.IFSC{
   address: nil,
   bank: "Kotak Mahindra Bank",
   bank_code: "KKBK",
   branch: nil,
   city: nil,
   contact: nil,
   district: nil,
   ifsc: "KKBK0000261",
   rtgs: nil,
   state: nil
 }}

 iex> IFSC.validate("foobar")
 {:error, :invalid_format}

 iex> IFSC.validate("AAAA0000000")
 {:error, :invalid_bank_code}

 iex(> IFSC.validate("HDFC0000000")
 {:error, :invalid_branch_code}

Link to this section Summary

Functions

Fetch details about an IFSC code from the Razorpay IFSC API

Perform offline validation and return the bank and bank codes

Link to this section Types

Link to this type

t()

View Source
t() :: %Razorpay.IFSC{
  address: String.t() | nil,
  bank: String.t() | nil,
  bank_code: String.t() | nil,
  branch: String.t() | nil,
  city: String.t() | nil,
  contact: String.t() | nil,
  district: String.t() | nil,
  ifsc: String.t(),
  rtgs: boolean() | nil,
  state: String.t() | nil
}

Link to this section Functions

Link to this function

get(ifsc)

View Source
get(ifsc :: String.t()) ::
  {:ok, ifsc :: t()} | {:error, reason :: :invalid_ifsc | any()}

Fetch details about an IFSC code from the Razorpay IFSC API

Link to this function

validate(ifsc)

View Source
validate(ifsc :: String.t()) ::
  {:ok, ifsc :: t()}
  | {:error,
     reason ::
       :invalid_format | :invalid_bank_code | :invalid_branch_code | any()}

Perform offline validation and return the bank and bank codes