react-native-cashfree-pg-sdk 2.0.0-dev.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,7 @@ dependencies {
68
68
  implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
69
69
  implementation 'androidx.gridlayout:gridlayout:1.0.0'
70
70
 
71
- implementation 'com.cashfree.pg:api:2.0.1-rc1'
71
+ implementation 'com.cashfree.pg:api:2.0.1'
72
72
 
73
73
  implementation "com.facebook.react:react-native:+" // From node_modules
74
74
  }
@@ -41,22 +41,26 @@ class CFPaymentGateway {
41
41
  }
42
42
 
43
43
  setEventSubscriber(cfEventCallback) {
44
- let eventFunction = event => {
45
- let data = JSON.parse(event);
46
- cfEventCallback.onReceivedEvent(data.eventName, data.meta);
47
- };
48
-
49
- this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);
50
- CashfreePgApi.setEventSubscriber();
44
+ if (_reactNative.Platform.OS === 'android') {
45
+ let eventFunction = event => {
46
+ let data = JSON.parse(event);
47
+ cfEventCallback.onReceivedEvent(data.eventName, data.meta);
48
+ };
49
+
50
+ this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);
51
+ CashfreePgApi.setEventSubscriber();
52
+ }
51
53
  }
52
54
 
53
55
  removeEventSubscriber() {
54
- if (this.eventSubscription !== undefined && this.eventSubscription !== null) {
55
- this.eventSubscription.remove();
56
- this.eventSubscription = null;
57
- }
56
+ if (_reactNative.Platform.OS === 'android') {
57
+ if (this.eventSubscription !== undefined && this.eventSubscription !== null) {
58
+ this.eventSubscription.remove();
59
+ this.eventSubscription = null;
60
+ }
58
61
 
59
- CashfreePgApi.removeEventSubscriber();
62
+ CashfreePgApi.removeEventSubscriber();
63
+ }
60
64
  }
61
65
 
62
66
  setCallback(cfCallback) {
@@ -137,6 +141,4 @@ class CFErrorResponse {
137
141
  exports.CFErrorResponse = CFErrorResponse;
138
142
  const CFPaymentGatewayService = new CFPaymentGateway();
139
143
  exports.CFPaymentGatewayService = CFPaymentGatewayService;
140
- //# sourceMappingURL=index.js.maptGatewayService = new CFPaymentGateway();
141
- exports.CFPaymentGatewayService = CFPaymentGatewayService;
142
144
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","CashfreePgApi","NativeModules","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","NativeEventEmitter","CashfreeEventEmitter","NativeAppEventEmitter","doPayment","checkoutPayment","version","JSON","stringify","setEventSubscriber","cfEventCallback","eventFunction","event","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","undefined","remove","setCallback","cfCallback","successFunction","orderID","console","log","onVerify","failureFunction","error","response","CFErrorResponse","message","fromJSON","onError","successSubscription","failureSubscription","removeCallback","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.js"],"sourcesContent":["import { NativeAppEventEmitter, NativeEventEmitter, NativeModules, Platform, } from 'react-native';\nimport { version } from '../package.json';\nconst LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: '- You have run \\'pod install\\'\\n', default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\nconst CashfreePgApi = NativeModules.CashfreePgApi\n ? NativeModules.CashfreePgApi\n : new Proxy({}, {\n get() {\n throw new Error(LINKING_ERROR);\n },\n });\nclass CFPaymentGateway {\n emitter;\n successSubscription = null;\n failureSubscription = null;\n eventSubscription = null;\n constructor() {\n this.emitter =\n Platform.OS === 'ios'\n ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter)\n : NativeAppEventEmitter;\n }\n doPayment(checkoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));\n }\n setEventSubscriber(cfEventCallback) {\n let eventFunction = (event) => {\n let data = JSON.parse(event);\n cfEventCallback.onReceivedEvent(data.eventName, data.meta);\n };\n this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);\n CashfreePgApi.setEventSubscriber();\n }\n removeEventSubscriber() {\n if (this.eventSubscription !== undefined &&\n this.eventSubscription !== null) {\n this.eventSubscription.remove();\n this.eventSubscription = null;\n }\n CashfreePgApi.removeEventSubscriber();\n }\n setCallback(cfCallback) {\n // this.cfCallback = cfCallback;\n let successFunction = (orderID) => {\n console.log('response is : ' + JSON.stringify(orderID));\n cfCallback.onVerify(orderID);\n };\n let failureFunction = (error) => {\n console.log('reason: ' + JSON.stringify(error));\n const response = new CFErrorResponse();\n // @ts-ignore\n const message = JSON.parse(error);\n response.fromJSON(message.error);\n // @ts-ignore\n cfCallback.onError(response, message.orderID);\n };\n this.successSubscription = this.emitter.addListener('cfSuccess', successFunction);\n this.failureSubscription = this.emitter.addListener('cfFailure', failureFunction);\n CashfreePgApi.setCallback();\n }\n removeCallback() {\n if (this.successSubscription !== undefined &&\n this.successSubscription !== null) {\n this.successSubscription.remove();\n this.successSubscription = null;\n }\n if (this.failureSubscription !== undefined &&\n this.failureSubscription !== null) {\n this.failureSubscription.remove();\n this.failureSubscription = null;\n }\n }\n}\nexport class CFErrorResponse {\n status = 'FAILED';\n message = 'payment has failed';\n code = 'payment_failed';\n type = 'request_failed';\n fromJSON(errorString) {\n console.log('errorString :' + errorString);\n const object = JSON.parse(errorString);\n console.log('errorStringObject :' + object);\n this.status = object.status;\n this.message = object.message;\n this.code = object.code;\n this.type = object.type;\n }\n getStatus() {\n return this.status;\n }\n getMessage() {\n return this.message;\n }\n getCode() {\n return this.code;\n }\n getType() {\n return this.type;\n }\n}\nexport const CFPaymentGatewayService = new CFPaymentGateway();\n"],"mappings":";;;;;;;AAAA;;AACA;;;;AACA,MAAMA,aAAa,GAAI,uFAAD,GAClBC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,kCAAP;EAA2CC,OAAO,EAAE;AAApD,CAAhB,CADkB,GAElB,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;IAAA,8BAIlB,gBAJkB;EAAA;;EAKzBE,QAAQ,CAACK,WAAD,EAAc;IAClBb,OAAO,CAACC,GAAR,CAAY,kBAAkBY,WAA9B;IACA,MAAMC,MAAM,GAAGlC,IAAI,CAACO,KAAL,CAAW0B,WAAX,CAAf;IACAb,OAAO,CAACC,GAAR,CAAY,wBAAwBa,MAApC;IACA,KAAKC,MAAL,GAAcD,MAAM,CAACC,MAArB;IACA,KAAKR,OAAL,GAAeO,MAAM,CAACP,OAAtB;IACA,KAAKS,IAAL,GAAYF,MAAM,CAACE,IAAnB;IACA,KAAKC,IAAL,GAAYH,MAAM,CAACG,IAAnB;EACH;;EACDC,SAAS,GAAG;IACR,OAAO,KAAKH,MAAZ;EACH;;EACDI,UAAU,GAAG;IACT,OAAO,KAAKZ,OAAZ;EACH;;EACDa,OAAO,GAAG;IACN,OAAO,KAAKJ,IAAZ;EACH;;EACDK,OAAO,GAAG;IACN,OAAO,KAAKJ,IAAZ;EACH;;AAzBwB;;;AA2BtB,MAAMK,uBAAuB,GAAG,IAAIpD,gBAAJ,EAAhC"}
1
+ {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","CashfreePgApi","NativeModules","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","NativeEventEmitter","CashfreeEventEmitter","NativeAppEventEmitter","doPayment","checkoutPayment","version","JSON","stringify","setEventSubscriber","cfEventCallback","eventFunction","event","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","undefined","remove","setCallback","cfCallback","successFunction","orderID","console","log","onVerify","failureFunction","error","response","CFErrorResponse","message","fromJSON","onError","successSubscription","failureSubscription","removeCallback","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.js"],"sourcesContent":["import { NativeAppEventEmitter, NativeEventEmitter, NativeModules, Platform, } from 'react-native';\nimport { version } from '../package.json';\nconst LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: '- You have run \\'pod install\\'\\n', default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\nconst CashfreePgApi = NativeModules.CashfreePgApi\n ? NativeModules.CashfreePgApi\n : new Proxy({}, {\n get() {\n throw new Error(LINKING_ERROR);\n },\n });\nclass CFPaymentGateway {\n emitter;\n successSubscription = null;\n failureSubscription = null;\n eventSubscription = null;\n constructor() {\n this.emitter =\n Platform.OS === 'ios'\n ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter)\n : NativeAppEventEmitter;\n }\n doPayment(checkoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));\n }\n setEventSubscriber(cfEventCallback) {\n if (Platform.OS === 'android') {\n let eventFunction = (event) => {\n let data = JSON.parse(event);\n cfEventCallback.onReceivedEvent(data.eventName, data.meta);\n };\n this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);\n CashfreePgApi.setEventSubscriber();\n }\n }\n removeEventSubscriber() {\n if (Platform.OS === 'android') {\n if (this.eventSubscription !== undefined &&\n this.eventSubscription !== null) {\n this.eventSubscription.remove();\n this.eventSubscription = null;\n }\n CashfreePgApi.removeEventSubscriber();\n }\n }\n setCallback(cfCallback) {\n // this.cfCallback = cfCallback;\n let successFunction = (orderID) => {\n console.log('response is : ' + JSON.stringify(orderID));\n cfCallback.onVerify(orderID);\n };\n let failureFunction = (error) => {\n console.log('reason: ' + JSON.stringify(error));\n const response = new CFErrorResponse();\n // @ts-ignore\n const message = JSON.parse(error);\n response.fromJSON(message.error);\n // @ts-ignore\n cfCallback.onError(response, message.orderID);\n };\n this.successSubscription = this.emitter.addListener('cfSuccess', successFunction);\n this.failureSubscription = this.emitter.addListener('cfFailure', failureFunction);\n CashfreePgApi.setCallback();\n }\n removeCallback() {\n if (this.successSubscription !== undefined &&\n this.successSubscription !== null) {\n this.successSubscription.remove();\n this.successSubscription = null;\n }\n if (this.failureSubscription !== undefined &&\n this.failureSubscription !== null) {\n this.failureSubscription.remove();\n this.failureSubscription = null;\n }\n }\n}\nexport class CFErrorResponse {\n status = 'FAILED';\n message = 'payment has failed';\n code = 'payment_failed';\n type = 'request_failed';\n fromJSON(errorString) {\n console.log('errorString :' + errorString);\n const object = JSON.parse(errorString);\n console.log('errorStringObject :' + object);\n this.status = object.status;\n this.message = object.message;\n this.code = object.code;\n this.type = object.type;\n }\n getStatus() {\n return this.status;\n }\n getMessage() {\n return this.message;\n }\n getCode() {\n return this.code;\n }\n getType() {\n return this.type;\n }\n}\nexport const CFPaymentGatewayService = new CFPaymentGateway();\n"],"mappings":";;;;;;;AAAA;;AACA;;;;AACA,MAAMA,aAAa,GAAI,uFAAD,GAClBC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,kCAAP;EAA2CC,OAAO,EAAE;AAApD,CAAhB,CADkB,GAElB,sDAFkB,GAGlB,6CAHJ;AAIA,MAAMC,aAAa,GAAGC,0BAAA,CAAcD,aAAd,GAChBC,0BAAA,CAAcD,aADE,GAEhB,IAAIE,KAAJ,CAAU,EAAV,EAAc;EACZC,GAAG,GAAG;IACF,MAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;EACH;;AAHW,CAAd,CAFN;;AAOA,MAAMU,gBAAN,CAAuB;EAKnBC,WAAW,GAAG;IAAA;;IAAA,6CAHQ,IAGR;;IAAA,6CAFQ,IAER;;IAAA,2CADM,IACN;;IACV,KAAKC,OAAL,GACIX,qBAAA,CAASY,EAAT,KAAgB,KAAhB,GACM,IAAIC,+BAAJ,CAAuBR,0BAAA,CAAcS,oBAArC,CADN,GAEMC,kCAHV;EAIH;;EACDC,SAAS,CAACC,eAAD,EAAkB;IACvBA,eAAe,CAACC,OAAhB,GAA0BA,gBAA1B;IACAd,aAAa,CAACY,SAAd,CAAwBG,IAAI,CAACC,SAAL,CAAeH,eAAf,CAAxB;EACH;;EACDI,kBAAkB,CAACC,eAAD,EAAkB;IAChC,IAAItB,qBAAA,C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DK,OAAO,GAAG;IACN,OAAO,KAAKJ,IAAZ;EACH;;AAzBwB;;;AA2BtB,MAAMK,uBAAuB,GAAG,IAAIpD,gBAAJ,EAAhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-cashfree-pg-sdk",
3
- "version": "2.0.0-dev.3",
3
+ "version": "2.0.0",
4
4
  "description": "Cashfree PG Plugin for React Native",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -145,6 +145,6 @@
145
145
  ]
146
146
  },
147
147
  "dependencies": {
148
- "cashfree-pg-api-contract": "2.0.0-dev.1"
148
+ "cashfree-pg-api-contract": "2.0.0"
149
149
  }
150
150
  }
package/src/index.js CHANGED
@@ -27,20 +27,24 @@ class CFPaymentGateway {
27
27
  CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));
28
28
  }
29
29
  setEventSubscriber(cfEventCallback) {
30
- let eventFunction = (event) => {
31
- let data = JSON.parse(event);
32
- cfEventCallback.onReceivedEvent(data.eventName, data.meta);
33
- };
34
- this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);
35
- CashfreePgApi.setEventSubscriber();
30
+ if (Platform.OS === 'android') {
31
+ let eventFunction = (event) => {
32
+ let data = JSON.parse(event);
33
+ cfEventCallback.onReceivedEvent(data.eventName, data.meta);
34
+ };
35
+ this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);
36
+ CashfreePgApi.setEventSubscriber();
37
+ }
36
38
  }
37
39
  removeEventSubscriber() {
38
- if (this.eventSubscription !== undefined &&
39
- this.eventSubscription !== null) {
40
- this.eventSubscription.remove();
41
- this.eventSubscription = null;
40
+ if (Platform.OS === 'android') {
41
+ if (this.eventSubscription !== undefined &&
42
+ this.eventSubscription !== null) {
43
+ this.eventSubscription.remove();
44
+ this.eventSubscription = null;
45
+ }
46
+ CashfreePgApi.removeEventSubscriber();
42
47
  }
43
- CashfreePgApi.removeEventSubscriber();
44
48
  }
45
49
  setCallback(cfCallback) {
46
50
  // this.cfCallback = cfCallback;