From 5b107d8d9e6e3556eaa32df99d831c06a67f634d Mon Sep 17 00:00:00 2001 From: David Hernandez Date: Wed, 15 Jan 2025 18:56:32 -0500 Subject: [PATCH] feat: [DEV-1405] Implementation of CVV Field for Saved Cards --- .DS_Store | Bin 0 -> 6148 bytes package-lock.json | 4 ++-- package.json | 2 +- src/.DS_Store | Bin 0 -> 8196 bytes src/classes/BaseInlineCheckout.ts | 19 ++++++++++++------- src/types/checkout.ts | 2 +- src/types/commons.ts | 4 ++-- 7 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .DS_Store create mode 100644 src/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3960e9aacd98e793cf905525edd998964a41ef78 GIT binary patch literal 6148 zcmeHK&5qMB5FWQFo9>^w5=d}Bio~@Wx(g~GE~Ru29Jp)|8~~N3DJ8qvxatqps;bmG zJOi)5nHS+*IKelzi;}c^MF>2SJ^q=`GxNoXVW$k8Q^!7XQVtZu=+W{pcX+-@j zhQ8ucu%E*0|Hj1BrGO5p2eeO@bU|?zD{kkoCD=t2QlGk6OL~&CbYKM-kx8P6apc%l;V#mH^A#u1{; z;Xmc@MdUN0Ue1cWq?t5U!E8JNdxNqAZs9agL48s6=8ukRRqy`2`eIRbZ``^2__T8#UnG(fga{mOO7@Iisn2MbbUwC6 zNh}k7Y1q1iEv2{GCeqS$?D6KyZO4rpL;S$H=?Ba{F7cq&Hleai`v7oVOj7R7`jj29 z3|I#Ka|ZbP;GwW?7`@b5eL7I7D*&{EVI^p*Uw>$i2cR29FSW)9L})0qh6;1V5a#9} zG#v8{W53i|!$~O5SjTu4=7u87#Y1??oJ2!wTU!P!16c-&x?AD%|K#fXe->nWmI2Ga zKgED>TJ2U7DVei%Ejd1GJ(PDSENr*bT0u~m<5)HLD87lJ1alrYpc_UnwZ;g<{s<@< LY-JhvqYV54jb|4S literal 0 HcmV?d00001 diff --git a/package-lock.json b/package-lock.json index 3915995..6f18cdc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tonder.io/ionic-lite-sdk", - "version": "0.0.42-beta.9", + "version": "0.0.50", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tonder.io/ionic-lite-sdk", - "version": "0.0.42-beta.9", + "version": "0.0.50", "license": "ISC", "dependencies": { "lodash.get": "^4.4.2", diff --git a/package.json b/package.json index fabd01a..d75ccfb 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a27f881b5a957d42eb6327fc4ea2a626c2227e23 GIT binary patch literal 8196 zcmeI1&x_MQ6vy9m+il9C^q{cb0v<#tYj>5dB0{L^!K)EHsMKT=Y%nGzNv%=}z3bh- zMf^Yfcl0|y5^7@En`nIxX1ZFoFM)fP6pLC{i7x zYpv?lfl8$S&^AshLmPR3im{D4M%P+ZD8|&;gD|1Oq!>bnqu-Y9P{-(6s}3ij!%3Jc z3zMM;b#=tq%AJIxm1`!z1eye7?%t(yipfLvzLCGDK6>QC^Z@0?4`paIy!}N!^JC@x z)t|*tUJQrdMQg9!+3#9i>%e;DPSb^3c*Q&)d)W(l^fXOlzifN{vnX6l`d1#NN#R9F zn5lp$2;uVbd6Wd{Vw}#CAXl-j?y!1RZ_>ZETpr&YjRy9~>1Z{um-kMF1N+YH(Q4JR zu3o=&|H% XRmM0**IID~#v1_&16NGoj}rI^GGI?x literal 0 HcmV?d00001 diff --git a/src/classes/BaseInlineCheckout.ts b/src/classes/BaseInlineCheckout.ts index 407c3e6..b6616b0 100644 --- a/src/classes/BaseInlineCheckout.ts +++ b/src/classes/BaseInlineCheckout.ts @@ -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 { @@ -119,12 +119,7 @@ export class BaseInlineCheckout { payment(data: IProcessPaymentRequest): Promise { 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); @@ -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) { diff --git a/src/types/checkout.ts b/src/types/checkout.ts index 2cd02f2..7995fce 100644 --- a/src/types/checkout.ts +++ b/src/types/checkout.ts @@ -98,7 +98,7 @@ export interface IItem { } export interface IProcessPaymentRequest { - customer: ICustomer; + customer: ICustomer | { email: string }; cart: { total: string | number; items: IItem[]; diff --git a/src/types/commons.ts b/src/types/commons.ts index 6e30ccc..04cd16c 100644 --- a/src/types/commons.ts +++ b/src/types/commons.ts @@ -1,5 +1,5 @@ import { ICustomer } from "./customer"; -import {IStartCheckoutResponse} from "./checkout"; +import {IProcessPaymentRequest, IStartCheckoutResponse} from "./checkout"; export type Business = { business: { @@ -85,7 +85,7 @@ export type APM = { label: string; }; -export interface IConfigureCheckout { +export interface IConfigureCheckout extends IProcessPaymentRequest{ customer: ICustomer | { email: string }; secureToken: string }