Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,43 @@ The Credit Card Validator transform will help you check the following:

== Options

=== Fields tab

* transform name: the transform name, unique in a pipeline
* Credit card field: the name of the input field that will contain the credit card number during execution
* Get only digits?
: Enable this option if you want to strip all non-numeric characters from the (String) input field
* Output Fields
** Result fieldname: the name of the (Boolean) output field indicating the validity of the number
** Credit card type field: the name of the output field that will hold the credit card type (vendor)
** Not valid message: the name of the output field that will hold the error message.
** Not valid message: the name of the output field that will hold the error message. When the BIN database recognizes a card type but the number fails validation, the message is `Not a valid number for {card type}.`

=== BIN Files tab

The BIN Files tab enables an optional lookup against an external Bank Identification Number (BIN) CSV database. When disabled, the built-in card type detection is used.

* Use BIN database: enable to validate the card against an external CSV BIN database
* BIN database file: the CSV file containing the BIN database (browsable)
* Delimiter: the delimiter character used in the CSV file (default `,`)
* Enclosure: the enclosure (quote) character used in the CSV file (default `"`)
* Encoding: the character encoding of the CSV file (default UTF-8)
* Header row present: when enabled, the first row of the CSV is treated as a header. When disabled, columns are mapped by fixed position (`BIN, card type, issuer, country`).
* BIN CSV Column: the CSV header column that contains the BIN values. When empty, the transform tries to auto-detect a `bin` column.
* Get columns: reads the CSV header and populates the BIN CSV Column dropdown and the extra output fields.
* Extra output fields: a table mapping CSV columns to output fields.
** Field name: the name of the output field
** CSV column: the CSV column to map from
** Type: the Hop data type of the output field
** Format: the conversion mask
** Length: the field length
** Precision: the field precision
** Currency, Decimal, Group: the numeric/currency symbols
** Trim: the trim type

The card number length is validated against a built-in card scheme table (Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay, Maestro, Verve), independent of the CSV file.

NOTE: Only the BIN column is required in the CSV. The card type, issuer and country columns are optional and are detected by common column names such as `cardtype`, `issuer`, `country` when not explicitly mapped.

NOTE: BIN values are limited to 8 digits. Rows whose BIN is empty, longer than 8 digits, or non-numeric are skipped, and the number of skipped rows is logged when the transform initializes.

NOTE: When you uncheck *Header row present* while header-based column mappings (the *BIN CSV Column* or any extra output *CSV column*) are still configured, you are prompted to confirm. Confirming clears those mappings and switches to fixed-position mapping; cancelling keeps the header mode and its mappings.
43 changes: 43 additions & 0 deletions plugins/transforms/creditcardvalidator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,47 @@
<packaging>jar</packaging>
<name>Hop Plugins Transforms Credit Card Validator</name>

<properties>
<opencsv.version>5.12.0</opencsv.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-libs</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>${opencsv.version}</version>
<exclusions>
<exclusion>
<groupId>commons-beanutils</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.15</version>
</dependency>
</dependencies>

</project>
Loading
Loading