Skip to content

Commit a2a80d1

Browse files
feat(cashfree-pg): support cordova-plugin-cashfree-pg 1.0.11 (#5057)
Co-authored-by: Kishan_maurya <[email protected]>
1 parent f16d67a commit a2a80d1

File tree

1 file changed

+43
-4
lines changed
  • src/@awesome-cordova-plugins/plugins/cashfree-pg

1 file changed

+43
-4
lines changed

src/@awesome-cordova-plugins/plugins/cashfree-pg/index.ts

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,26 @@ export class CFSession {
2525
this.environment = CFEnvironment[environment];
2626
}
2727
}
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+
}
2848

2949
export enum CFPaymentModes {
3050
CARD = 'CARD',
@@ -198,6 +218,19 @@ export class CFDropCheckoutPayment implements CheckoutPayment {
198218
}
199219
}
200220

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+
201234
export class CFWebCheckoutPayment implements CheckoutPayment {
202235
private readonly session: CFSession;
203236
private readonly theme: CFWebTheme = new CFWebThemeBuilder().build();
@@ -224,10 +257,7 @@ export class CFUPIIntentCheckoutPayment implements CheckoutPayment {
224257
private readonly theme: CFTheme = new CFThemeBuilder().build();
225258
version: string;
226259

227-
constructor(
228-
session: CFSession,
229-
theme: CFTheme | null
230-
) {
260+
constructor(session: CFSession, theme: CFTheme | null) {
231261
this.session = session;
232262
if (theme !== null) {
233263
this.theme = theme;
@@ -280,6 +310,15 @@ export class CFPaymentGateway extends AwesomeCordovaNativePlugin {
280310
return;
281311
}
282312

313+
/**
314+
* Initiate Subscription Checkout Payment.
315+
* @param {CFSubscriptionPayment} [subscriptionPayment] subscriptionPaymentObject information
316+
*/
317+
@Cordova()
318+
doSubscriptionPayment(subscriptionPayment: CFSubscriptionPayment) {
319+
return;
320+
}
321+
283322
/**
284323
* Initiate Web Checkout Payment.
285324
* @param {CFWebCheckoutPayment} [webCheckoutPayment] webCheckoutPaymentObject information

0 commit comments

Comments
 (0)