npm package: @softheon/tokenizer
Description: This library provides a UI component that tokenizes credit cards and checking accounts.
Latest version: 21.0.0

# Tokenizer

This library provides a UI component that tokenizes credit cards and checking accounts.

## Set Up

To start using the tokenizer, import the `TokenizerModule` and embed the `<sof-tokenizer></sof-tokenizer>` element. Please provide the desired configurations in the format described below.
The tokenizer will emit a `TokenizerResponse` response that determines the outcome of attempting to tokenize a payment method and more details about that can be seen below.

## Verbiage

The UI component comes with default verbiage that can be overwritten by the consuming application on a pick and choose basis. The tokenizer will prioritize any verbiage coming from the parent `TranslateModule`. If there is no related key in the parent `TranslateModule` or that module is not imported, the tokenizer will use the internal default verbiage.

## Configurations

### Input

| Input Name                        | Description                                |
| --------------------------------- | ------------------------------------------ |
| tokenizerConfigs: TokenizerConfig | Configurations for the tokenizer component |

### TokenizerConfig

| Name                                       | Description                                  |
| ------------------------------------------ | -------------------------------------------- |
| authToken: string                          | The authorization token                      |
| paymentApiBaseUrl: string                  | The base URL for the Payment API             |
| id: string                                 | ID for the component                         |
| paymentTypeOptions: PaymentTypeSelection[] | Payment types to show (see enum below)       |
| languagePath: string                       | Path to language in verbiage file            |
| referenceId: string                        | The reference id to be used for tokenization |

## Functionality

### Output

| Name                                 | Description                                             |
| ------------------------------------ | ------------------------------------------------------- |
| tokenCreateOutput: TokenizerResponse | Emitter that returns the result of tokenization         |
| cancelOutput: void                   | Emitter that triggers on the click of the cancel button |

### TokenizerResponse

| Name                              | Description                                    |
| --------------------------------- | ---------------------------------------------- |
| status: TokenizerResponseStatus   | Indicates if tokenization was successful       |
| token: string                     | The generated token, if applicable             |
| paymentType: PaymentTypeSelection | The payment type that was selected             |
| accountHolderName: string         | The account holder name                        |
| billingAddress: PaymentAddress    | The billing address                            |
| paymentName: string               | The name of the payment method                 |
| lastDigits: string                | The last few digits of the payment account     |
| email: string                     | Email populated in tokenizer form              |
| isDefault: boolean                | Determines if chosen as default payment method |

### PaymentTypeSelection

The payment type selection is an enumeration which contains the following options:

- CheckingOrSavings
- CheckingAccount
- SavingsAccount
- CardPayment
- DebitCardPayment
- CreditCardPayment
- NotChosen