File tree 7 files changed +12
-20
lines changed
pay-theory-checkout-button
7 files changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ const processContainer = <
60
60
elements : T ,
61
61
type : keyof T ,
62
62
) : processedElement < T , F > | string => {
63
- const contained = document . getElementById ( `${ elements [ type ] } -tag-frame` ) ;
63
+ const contained = document . getElementById ( `${ elements [ type ] as string } -tag-frame` ) ;
64
64
if ( contained === null ) {
65
65
const frameType = webComponentMap [ type as ElementTypes ] ;
66
66
const frame = addFrame ( frameType , elements [ type ] as string ) as F ;
Original file line number Diff line number Diff line change @@ -60,12 +60,12 @@ export const parseInputParams = (
60
60
const inputCopy = JSON . parse ( JSON . stringify ( inputParams ) ) as ModifiedTransactProps ;
61
61
inputCopy . payTheoryData = {
62
62
account_code : inputParams . accountCode ?? ( metadata [ 'pay-theory-account-code' ] as string ) ,
63
- billing_info : ( inputParams as TransactProps ) . billingInfo as BillingInfo | undefined ,
64
- fee : ( inputParams as TransactProps ) . fee as number | undefined ,
65
- invoice_id : invoiceId as string | undefined ,
63
+ billing_info : ( inputParams as TransactProps ) . billingInfo ,
64
+ fee : ( inputParams as TransactProps ) . fee ,
65
+ invoice_id : invoiceId ,
66
66
payment_parameters :
67
67
inputParams . paymentParameters ?? ( metadata [ 'payment-parameters-name' ] as string ) ,
68
- payor_id : payorId as string | undefined ,
68
+ payor_id : payorId ,
69
69
receipt_description :
70
70
( inputParams as TransactProps ) . receiptDescription ??
71
71
( metadata [ 'pay-theory-receipt-description' ] as string ) ,
Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ export interface ErrorResponse {
142
142
export interface TokenizeProps {
143
143
payorInfo ?: PayorInfo ;
144
144
payorId ?: string ;
145
- metadata ?: { [ keys : string | number ] : string | number | boolean } ;
145
+ metadata ?: Record < string | number , string | number | boolean > ;
146
146
billingInfo ?: BillingInfo ;
147
147
}
148
148
@@ -151,7 +151,7 @@ export interface TransactProps {
151
151
payorInfo ?: PayorInfo ;
152
152
billingInfo ?: BillingInfo ;
153
153
payorId ?: string ;
154
- metadata ?: { [ keys : string | number ] : string | number | boolean } ;
154
+ metadata ?: Record < string | number , string | number | boolean > ;
155
155
feeMode ?: typeof MERCHANT_FEE | typeof SERVICE_FEE ;
156
156
fee ?: number ;
157
157
confirmation ?: boolean ;
Original file line number Diff line number Diff line change @@ -20,10 +20,6 @@ class PayTheoryCheckoutButton extends HTMLElement {
20
20
protected _buttonBarcode : string | undefined ;
21
21
protected _session : string | undefined ;
22
22
23
- constructor ( ) {
24
- super ( ) ;
25
- }
26
-
27
23
defineButton ( ) {
28
24
// Creating the iFrame for the Button
29
25
const buttonFrame = document . createElement ( 'iframe' ) ;
Original file line number Diff line number Diff line change @@ -14,10 +14,6 @@ class PayTheoryCheckoutQR extends HTMLElement {
14
14
protected _clearSuccessListener : ( ( ) => void ) | undefined ;
15
15
protected _clearErrorListener : ( ( ) => void ) | undefined ;
16
16
17
- constructor ( ) {
18
- super ( ) ;
19
- }
20
-
21
17
defineQR ( ) {
22
18
// Creating the iFrame for the Button
23
19
const qrFrame = document . createElement ( 'iframe' ) ;
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ const payTheoryFields = async (inputParams: PayTheoryPaymentFieldsInput) =>
235
235
const result = initializeFields ( inputParams , channel . port2 ) ;
236
236
if ( result ) resolve ( result ) ;
237
237
} else {
238
- document . addEventListener ( 'DOMContentLoaded' , async ( ) => {
238
+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
239
239
const result = initializeFields ( inputParams , channel . port2 ) ;
240
240
if ( result ) resolve ( result ) ;
241
241
} ) ;
Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ export default async (inputParams: PayTheoryQRInput) => {
18
18
? modifiedCheckoutDetails . feeMode
19
19
: common . defaultFeeMode ;
20
20
const { paymentName, callToAction, acceptedPaymentMethods } = modifiedCheckoutDetails ;
21
- let removeErrorListener = ( ) => { } ;
22
- let removeHostedErrorListener = ( ) => { } ;
21
+ let removeErrorListener : ( ( ) => void ) | null = null ;
22
+ let removeHostedErrorListener : ( ( ) => void ) | null = null ;
23
23
// Putting error listener on the window and hosted button so that it can catch errors while it readies the session
24
24
if ( onError ) {
25
25
removeErrorListener = common . errorObserver ( onError ) ;
@@ -47,8 +47,8 @@ export default async (inputParams: PayTheoryQRInput) => {
47
47
// Adding logic to onReady to receive the session data for redirecting to the hosted checkout page
48
48
const onReadyWrapper = ( ) => {
49
49
// Remove the error listener because we added it to the button iFrame and do not want it to be called twice
50
- removeErrorListener ( ) ;
51
- removeHostedErrorListener ( ) ;
50
+ if ( removeErrorListener ) removeErrorListener ( ) ;
51
+ if ( removeHostedErrorListener ) removeHostedErrorListener ( ) ;
52
52
if ( onReady ) {
53
53
onReady ( true ) ;
54
54
}
You can’t perform that action at this time.
0 commit comments