Skip to content

Commit

Permalink
feat: [DEV-1405] Implementation of CVV Field for Saved Cards
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hernandez committed Jan 15, 2025
1 parent cdfe1d1 commit 5b107d8
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonder.io/ionic-lite-sdk",
"version": "0.0.42-beta.9",
"version": "0.0.50",
"description": "Tonder ionic lite SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Binary file added src/.DS_Store
Binary file not shown.
19 changes: 12 additions & 7 deletions src/classes/BaseInlineCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export class BaseInlineCheckout {
}

configureCheckout(data: IConfigureCheckout) {
if ("customer" in data) this.#handleCustomer(data["customer"]);
if ("secureToken" in data) this.#setSecureToken(data["secureToken"]);
this.#setCheckoutData(data)
}

async verify3dsTransaction(): Promise<ITransaction | IStartCheckoutResponse | void> {
Expand All @@ -119,12 +119,7 @@ export class BaseInlineCheckout {
payment(data: IProcessPaymentRequest): Promise<IStartCheckoutResponse> {
return new Promise(async (resolve, reject) => {
try {
this.#handleCustomer(data.customer);
this._setCartTotal(data.cart?.total);
this.#setCartItems(data.cart?.items);
this.#handleMetadata(data);
this.#handleCurrency(data);
this.#handleCard(data);
this.#setCheckoutData(data)
const response = await this._checkout(data);
this.process3ds.setPayload(response);
const payload = await this._handle3dsRedirect(response);
Expand Down Expand Up @@ -307,6 +302,16 @@ export class BaseInlineCheckout {
}
}

#setCheckoutData(data: IConfigureCheckout | IProcessPaymentRequest){
if(!data || (data && Object.keys(data).length === 0)) return;
this.#handleCustomer(data.customer);
this._setCartTotal(data.cart?.total);
this.#setCartItems(data.cart?.items);
this.#handleMetadata(data);
this.#handleCurrency(data);
this.#handleCard(data);
}

async _fetchMerchantData() {
try {
if (!this.merchantData) {
Expand Down
2 changes: 1 addition & 1 deletion src/types/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export interface IItem {
}

export interface IProcessPaymentRequest {
customer: ICustomer;
customer: ICustomer | { email: string };
cart: {
total: string | number;
items: IItem[];
Expand Down
4 changes: 2 additions & 2 deletions src/types/commons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ICustomer } from "./customer";
import {IStartCheckoutResponse} from "./checkout";
import {IProcessPaymentRequest, IStartCheckoutResponse} from "./checkout";

export type Business = {
business: {
Expand Down Expand Up @@ -85,7 +85,7 @@ export type APM = {
label: string;
};

export interface IConfigureCheckout {
export interface IConfigureCheckout extends IProcessPaymentRequest{
customer: ICustomer | { email: string };
secureToken: string
}
Expand Down

0 comments on commit 5b107d8

Please sign in to comment.