@@ -25,6 +25,26 @@ export class CFSession {
25
25
this . environment = CFEnvironment [ environment ] ;
26
26
}
27
27
}
28
+ export class CFSubscriptionSession {
29
+ subscription_session_id : string ;
30
+ subscription_id : string ;
31
+ environment : string ;
32
+
33
+ constructor ( subscription_session_id : string , subscription_id : string , environment : CFEnvironment ) {
34
+ if ( subscription_session_id === null || subscription_session_id . trim ( ) === '' ) {
35
+ throw new Error ( 'subscription_session_id cannot be empty' ) ;
36
+ }
37
+ if ( subscription_id === null || subscription_id . trim ( ) === '' ) {
38
+ throw new Error ( 'subscription_id cannot be empty' ) ;
39
+ }
40
+ if ( environment === null || environment . trim ( ) === '' ) {
41
+ throw new Error ( 'environment cannot be empty' ) ;
42
+ }
43
+ this . subscription_session_id = subscription_session_id ;
44
+ this . subscription_id = subscription_id ;
45
+ this . environment = CFEnvironment [ environment ] ;
46
+ }
47
+ }
28
48
29
49
export enum CFPaymentModes {
30
50
CARD = 'CARD' ,
@@ -198,6 +218,19 @@ export class CFDropCheckoutPayment implements CheckoutPayment {
198
218
}
199
219
}
200
220
221
+ export class CFSubscriptionPayment implements CheckoutPayment {
222
+ private readonly session : CFSubscriptionSession ;
223
+ version : string ;
224
+
225
+ constructor ( session : CFSubscriptionSession ) {
226
+ this . session = session ;
227
+ }
228
+
229
+ getSession ( ) {
230
+ return this . session ;
231
+ }
232
+ }
233
+
201
234
export class CFWebCheckoutPayment implements CheckoutPayment {
202
235
private readonly session : CFSession ;
203
236
private readonly theme : CFWebTheme = new CFWebThemeBuilder ( ) . build ( ) ;
@@ -224,10 +257,7 @@ export class CFUPIIntentCheckoutPayment implements CheckoutPayment {
224
257
private readonly theme : CFTheme = new CFThemeBuilder ( ) . build ( ) ;
225
258
version : string ;
226
259
227
- constructor (
228
- session : CFSession ,
229
- theme : CFTheme | null
230
- ) {
260
+ constructor ( session : CFSession , theme : CFTheme | null ) {
231
261
this . session = session ;
232
262
if ( theme !== null ) {
233
263
this . theme = theme ;
@@ -280,6 +310,15 @@ export class CFPaymentGateway extends AwesomeCordovaNativePlugin {
280
310
return ;
281
311
}
282
312
313
+ /**
314
+ * Initiate Subscription Checkout Payment.
315
+ * @param {CFSubscriptionPayment } [subscriptionPayment] subscriptionPaymentObject information
316
+ */
317
+ @Cordova ( )
318
+ doSubscriptionPayment ( subscriptionPayment : CFSubscriptionPayment ) {
319
+ return ;
320
+ }
321
+
283
322
/**
284
323
* Initiate Web Checkout Payment.
285
324
* @param {CFWebCheckoutPayment } [webCheckoutPayment] webCheckoutPaymentObject information
0 commit comments