### Install bcbc CLI Tool using Go Source: https://github.com/hexindai/bcbc/blob/master/README.md Installs the bcbc command-line interface tool using the Go package manager. This command requires Go to be installed on your system. ```bash go install github.com/hexindai/bcbc@latest ``` -------------------------------- ### Start bcbc HTTP Server Source: https://github.com/hexindai/bcbc/blob/master/README.md Starts the bcbc HTTP server on a specified port. This allows you to query bank card BIN information via HTTP requests. ```bash bcbc serve -p :3232 ``` -------------------------------- ### Start and Query HTTP API Server Source: https://context7.com/hexindai/bcbc/llms.txt Shows how to launch the BCBC HTTP server and query the REST endpoint for card information. The server returns JSON responses containing bank details or error messages. ```bash bcbc serve -p :8080 curl "http://127.0.0.1:3232/cardInfo.json?cardNo=6222021234567890123" ``` -------------------------------- ### Add New BIN to bcbc Project Source: https://github.com/hexindai/bcbc/blob/master/README.md Command to add a new Bank Card BIN to the bcbc project's data. This requires 'gawk' to be installed and is typically used by contributors. ```bash make add len=16 bin=621245 ``` -------------------------------- ### GET /cardInfo.json Source: https://github.com/hexindai/bcbc/blob/master/README.md Retrieves detailed information about a bank card based on the provided card number. ```APIDOC ## GET /cardInfo.json ### Description Retrieves bank card metadata including the BIN, bank name, and card type for a given card number. ### Method GET ### Endpoint /cardInfo.json ### Parameters #### Query Parameters - **cardNo** (string) - Required - The full bank card number to query. ### Request Example GET http://127.0.0.1:3232/cardInfo.json?cardNo=6222021234567890123 ### Response #### Success Response (200) - **bin** (string) - The bank identification number. - **bank** (string) - The bank code. - **name** (string) - The full name of the bank. - **type** (string) - The card type (e.g., DC for Debit Card). - **length** (integer) - The length of the card number. #### Response Example { "bin": "622202", "bank": "ICBC", "name": "中国工商银行", "type": "DC", "length": 19 } ``` -------------------------------- ### Initialize Custom Bank Instance Source: https://context7.com/hexindai/bcbc/llms.txt Demonstrates creating a custom Bank instance with specific BIN definitions. This is useful for extending the tool with custom datasets or using a subset of existing BINs. ```go package main import ( "fmt" "github.com/hexindai/bcbc/bank" ) func main() { customBINs := []*bank.CardBIN{ {Bin: "622202", Bank: "ICBC", Type: "DC", Length: 19}, } myBank := bank.New(customBINs) cardBIN, _ := myBank.Get("6222021234567890123") fmt.Printf("Found: %s", cardBIN.Bank) } ``` -------------------------------- ### List Supported Bank Card BINs via CLI Source: https://context7.com/hexindai/bcbc/llms.txt The list command displays all supported bank card BINs in a paginated view. It defaults to the system pager (less) but can be customized via environment variables. ```bash bcbc list PAGER=more bcbc list ``` -------------------------------- ### Search Bank Card BIN using bcbc CLI Source: https://github.com/hexindai/bcbc/blob/master/README.md Demonstrates how to use the bcbc CLI tool to search for bank card BIN information. It takes a card number as input and outputs the BIN details in JSON format. ```bash bcbc search -c 6222021234567890123 -o json > {"bin":"622202","bank":"ICBC","name":"中国工商银行","type":"DC","length":19} ``` -------------------------------- ### Lookup Card Information via Go Package Source: https://context7.com/hexindai/bcbc/llms.txt Illustrates using the bank.Get function to programmatically retrieve card BIN details. It handles validation errors and provides access to bank code, name, and card type. ```go package main import ( "fmt" "log" "github.com/hexindai/bcbc/bank" ) func main() { cardBIN, err := bank.Get("6222021234567890123") if err != nil { log.Fatal(err) } fmt.Printf("Bank Name: %s\n", cardBIN.BankName()) } ``` -------------------------------- ### Handle Card Lookup Responses in Go Source: https://context7.com/hexindai/bcbc/llms.txt The response package provides structured output for card lookups. It supports both JSON and formatted text output, making it suitable for API integrations or CLI tools. ```go package main import ( "bytes" "fmt" "github.com/hexindai/bcbc/response" ) func main() { resp := response.New("6222021234567890123") var jsonBuf bytes.Buffer resp.WriteResponse(&jsonBuf, response.JSONContentType) fmt.Println("JSON:", jsonBuf.String()) var textBuf bytes.Buffer resp.WriteResponse(&textBuf, response.TextContentType) fmt.Println("Text:", textBuf.String()) errResp := response.New("invalid") var errBuf bytes.Buffer errResp.WriteResponse(&errBuf, response.JSONContentType) fmt.Println("Error:", errBuf.String()) } ``` -------------------------------- ### Build bcbc Project Source Files Source: https://github.com/hexindai/bcbc/blob/master/README.md Builds the source files for the bcbc project. This command is used during development or for generating release artifacts. ```bash make build ``` -------------------------------- ### Perform CLI Bank Card Lookup Source: https://context7.com/hexindai/bcbc/llms.txt Demonstrates how to use the bcbc CLI tool to validate bank cards and retrieve metadata. Supports both JSON output for automation and human-readable text output. ```bash bcbc search -c 6222021234567890123 -o json bcbc search -c 6222021234567890123 -o text bcbc search -c 1234567890 -o json ``` -------------------------------- ### Query Bank Card BIN via HTTP Request Source: https://github.com/hexindai/bcbc/blob/master/README.md Shows how to make an HTTP request to the running bcbc server to retrieve bank card BIN information. The card number is provided as a query parameter. ```bash curl http://127.0.0.1:3232/cardInfo.json?cardNo=6222021234567890123 > {"bin":"622202","bank":"ICBC","name":"中国工商银行","type":"DC","length":19} ``` -------------------------------- ### Generate Random Bank Card Numbers via CLI Source: https://context7.com/hexindai/bcbc/llms.txt The random command generates a valid-format bank card number for testing. It selects a random BIN and generates the remaining digits based on the required length for that specific card type. ```bash bcbc random ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.