react-native-cashfree-pg-sdk 2.1.4 → 2.1.5
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.
- package/README.md +4 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.idea/sonarlint/issuestore/4/4/44aaf172f11159c609e569cf1b49bcd49376a770 +12 -8
- package/android/src/main/java/com/reactnativecashfreepgsdk/CashfreePgApiModule.java +57 -0
- package/lib/commonjs/index.js +5 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/index.js +5 -0
- package/src/index.ts +6 -0
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# react-native-cashfree-pg-sdk
|
|
2
|
+
|
|
3
|
+
      
|
|
4
|
+
|
|
5
|
+
|
|
2
6
|
The Cashfree React Native SDK allows you to integrate Cashfree Payment Gateway into your application and start collecting payments from your customers. The React Native SDK has been designed to minimise the complexity of handling and integrating payments in your React Native project.
|
|
3
7
|
|
|
4
8
|
Click [here](https://docs.cashfree.com/docs/react-native-integration) for more Documentation.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
e
|
|
3
|
+
java:S1192\"HDefine a constant instead of duplicating this literal "orderID" 3 times.(Ѝ��8�����1
|
|
4
|
+
v
|
|
5
|
+
java:S11922"TDefine a constant instead of duplicating this literal "CashfreePgApiModule" 5 times.(���������8�����1
|
|
2
6
|
m
|
|
3
|
-
java:S1192
|
|
4
|
-
�
|
|
5
|
-
java:S1598"�This file "CashfreePgApiModule.java" should be located in "com/reactnativecashfreepgapi" directory, not in "/Users/kishankumarmaurya/Development/ReactNative/RN_PG_APP/react-native-cashfree-pg-sdk/android/src/main/java/com/reactnativecashfreepgsdk".(ٻ�������
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
java:S2864�"4Iterate over the "entrySet" instead of the "keySet".(�ֲ������
|
|
7
|
+
java:S1192;"QDefine a constant instead of duplicating this literal "activity is null" 4 times.(�ȮT8�����1
|
|
8
|
+
�
|
|
9
|
+
java:S1598"�This file "CashfreePgApiModule.java" should be located in "com/reactnativecashfreepgapi" directory, not in "/Users/kishankumarmaurya/Development/ReactNative/RN_PG_APP/react-native-cashfree-pg-sdk/android/src/main/java/com/reactnativecashfreepgsdk".(ٻ�������8�����1
|
|
10
|
+
F java:S108�")Either remove or fill this block of code.(����8�����1
|
|
11
|
+
K java:S108�")Either remove or fill this block of code.(Ƹۂ�����8�����1
|
|
12
|
+
K java:S108�")Either remove or fill this block of code.(Ƹۂ�����8�����1
|
|
13
|
+
W
|
|
14
|
+
java:S2864�"4Iterate over the "entrySet" instead of the "keySet".(�ֲ������8�����1
|
|
@@ -12,6 +12,8 @@ import com.cashfree.pg.cf_analytics.CFEventsSubscriber;
|
|
|
12
12
|
import com.cashfree.pg.core.api.CFSession;
|
|
13
13
|
import com.cashfree.pg.core.api.base.CFPayment;
|
|
14
14
|
import com.cashfree.pg.core.api.callback.CFCheckoutResponseCallback;
|
|
15
|
+
import com.cashfree.pg.core.api.card.CFCard;
|
|
16
|
+
import com.cashfree.pg.core.api.card.CFCardPayment;
|
|
15
17
|
import com.cashfree.pg.core.api.exception.CFException;
|
|
16
18
|
import com.cashfree.pg.core.api.utils.CFErrorResponse;
|
|
17
19
|
import com.cashfree.pg.core.api.webcheckout.CFWebCheckoutPayment;
|
|
@@ -110,6 +112,61 @@ public class CashfreePgApiModule extends ReactContextBaseJavaModule implements C
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
@ReactMethod
|
|
116
|
+
public void doCardPayment(String data) {
|
|
117
|
+
Log.d("CashfreePgApiModule Card", data);
|
|
118
|
+
CFSession cfSession = null;
|
|
119
|
+
CFCard card = null;
|
|
120
|
+
boolean saveCard;
|
|
121
|
+
try {
|
|
122
|
+
JSONObject jsonObject = new JSONObject(data);
|
|
123
|
+
JSONObject session = jsonObject.getJSONObject("session");
|
|
124
|
+
JSONObject cardObject = jsonObject.getJSONObject("card");
|
|
125
|
+
saveCard = cardObject.optBoolean("saveCard", false);
|
|
126
|
+
cfSession = new CFSession.CFSessionBuilder()
|
|
127
|
+
.setEnvironment(CFSession.Environment.valueOf(session.getString("environment")))
|
|
128
|
+
.setOrderId(session.getString("orderID"))
|
|
129
|
+
.setPaymentSessionID(session.getString("payment_session_id"))
|
|
130
|
+
.build();
|
|
131
|
+
if (cardObject.has("instrumentId")) {
|
|
132
|
+
Log.d("CashfreePgApiModule", "Saved Card");
|
|
133
|
+
card = new CFCard.CFCardBuilder()
|
|
134
|
+
.setInstrumentId(cardObject.getString("instrumentId"))
|
|
135
|
+
.setCVV(cardObject.getString("cardCvv"))
|
|
136
|
+
.build();
|
|
137
|
+
} else {
|
|
138
|
+
Log.d("CashfreePgApiModule", "Normal Card");
|
|
139
|
+
Log.d("CashfreePgApiModule", "Save :: " + saveCard);
|
|
140
|
+
card = new CFCard.CFCardBuilder()
|
|
141
|
+
.setCardNumber(cardObject.getString("cardNumber"))
|
|
142
|
+
.setCardHolderName(cardObject.getString("cardHolderName"))
|
|
143
|
+
.setCardExpiryMonth(cardObject.getString("cardExpiryMM"))
|
|
144
|
+
.setCardExpiryYear(cardObject.getString("cardExpiryYY"))
|
|
145
|
+
.setCVV(cardObject.getString("cardCvv"))
|
|
146
|
+
.build();
|
|
147
|
+
}
|
|
148
|
+
} catch (Exception exception) {
|
|
149
|
+
throw new IllegalStateException(exception.getMessage());
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
Activity activity = getCurrentActivity();
|
|
153
|
+
CFCardPayment cardPayment = new CFCardPayment.CFCardPaymentBuilder()
|
|
154
|
+
.setSession(cfSession)
|
|
155
|
+
.setCard(card)
|
|
156
|
+
.setSaveCardDetail(saveCard)
|
|
157
|
+
.build();
|
|
158
|
+
cardPayment.setCfsdkFramework(CFPayment.CFSDKFramework.REACT_NATIVE);
|
|
159
|
+
cardPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.ELEMENT);
|
|
160
|
+
if (activity != null) {
|
|
161
|
+
CFPaymentGatewayService.getInstance().doPayment(activity, cardPayment);
|
|
162
|
+
} else {
|
|
163
|
+
throw new IllegalStateException("activity is null");
|
|
164
|
+
}
|
|
165
|
+
} catch (Exception e) {
|
|
166
|
+
e.printStackTrace();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
113
170
|
@ReactMethod
|
|
114
171
|
public void setCallback() {
|
|
115
172
|
try {
|
package/lib/commonjs/index.js
CHANGED
|
@@ -37,6 +37,11 @@ class CFPaymentGateway {
|
|
|
37
37
|
doWebPayment(cfSession) {
|
|
38
38
|
CashfreePgApi.doWebPayment(cfSession);
|
|
39
39
|
}
|
|
40
|
+
doCardPayment(cardPayment) {
|
|
41
|
+
cardPayment.version = _package.version;
|
|
42
|
+
console.log("SDK", JSON.stringify(cardPayment));
|
|
43
|
+
CashfreePgApi.doCardPayment(JSON.stringify(cardPayment));
|
|
44
|
+
}
|
|
40
45
|
setEventSubscriber(cfEventCallback) {
|
|
41
46
|
let eventFunction = event => {
|
|
42
47
|
console.log(JSON.stringify(event));
|
|
@@ -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","doUPIPayment","doWebPayment","cfSession","setEventSubscriber","cfEventCallback","eventFunction","event","console","log","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","undefined","remove","setCallback","cfCallback","successFunction","orderID","onVerify","failureFunction","error","response","CFErrorResponse","message","fromJSON","onError","successSubscription","failureSubscription","removeCallback","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.ts"],"sourcesContent":["import {\n EmitterSubscription,\n EventEmitter,\n NativeAppEventEmitter,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\nimport { version } from '../package.json';\nimport type { CheckoutPayment, CFSession } from 'cashfree-pg-api-contract';\n\nconst LINKING_ERROR =\n `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';\n\nconst CashfreePgApi = NativeModules.CashfreePgApi\n ? NativeModules.CashfreePgApi\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nclass CFPaymentGateway {\n private emitter: EventEmitter;\n private successSubscription: EmitterSubscription | null = null;\n private failureSubscription: EmitterSubscription | null = null;\n private eventSubscription: EmitterSubscription | null = null;\n\n constructor() {\n this.emitter =\n Platform.OS === 'ios'\n ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter)\n : NativeAppEventEmitter;\n }\n\n doPayment(checkoutPayment: CheckoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));\n }\n\n doUPIPayment(checkoutPayment: CheckoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doUPIPayment(JSON.stringify(checkoutPayment));\n }\n\n doWebPayment(cfSession: CFSession) {\n CashfreePgApi.doWebPayment(cfSession);\n }\n\n setEventSubscriber(cfEventCallback: CFEventCallback) {\n let eventFunction = (event: string) => {\n console.log(JSON.stringify(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 (\n this.eventSubscription !== undefined &&\n this.eventSubscription !== null\n ) {\n this.eventSubscription.remove();\n this.eventSubscription = null;\n }\n CashfreePgApi.removeEventSubscriber();\n }\n\n setCallback(cfCallback: CFCallback) {\n // this.cfCallback = cfCallback;\n let successFunction = (orderID: string) => {\n console.log('response is : ' + JSON.stringify(orderID));\n cfCallback.onVerify(orderID);\n };\n let failureFunction = (error: string) => {\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(\n 'cfSuccess',\n successFunction\n );\n this.failureSubscription = this.emitter.addListener(\n 'cfFailure',\n failureFunction\n );\n CashfreePgApi.setCallback();\n }\n\n removeCallback() {\n if (\n this.successSubscription !== undefined &&\n this.successSubscription !== null\n ) {\n this.successSubscription.remove();\n this.successSubscription = null;\n }\n if (\n this.failureSubscription !== undefined &&\n this.failureSubscription !== null\n ) {\n this.failureSubscription.remove();\n this.failureSubscription = null;\n }\n }\n}\n\nexport interface CFCallback {\n onVerify(orderID: string): void;\n\n onError(error: CFErrorResponse, orderID: string): void;\n}\n\nexport interface CFEventCallback {\n onReceivedEvent(eventName: string, map: Map<string, string>): void;\n}\n\nexport class CFErrorResponse {\n private status: string = 'FAILED';\n private message: string = 'payment has failed';\n private code: string = 'payment_failed';\n private type: string = 'request_failed';\n\n fromJSON(errorString: string) {\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\n getStatus(): string {\n return this.status;\n }\n\n getMessage(): string {\n return this.message;\n }\n\n getCode(): string {\n return this.code;\n }\n\n getType(): string {\n return this.type;\n }\n}\n\nexport const CFPaymentGatewayService = new CFPaymentGateway();\n"],"mappings":";;;;;;AAAA;AAQA;AAA0C;AAAA;AAAA;AAG1C,MAAMA,aAAa,GAChB,uFAAsF,GACvFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,aAAa,GAAGC,0BAAa,CAACD,aAAa,GAC7CC,0BAAa,CAACD,aAAa,GAC3B,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,MAAMU,gBAAgB,CAAC;EAMrBC,WAAW,GAAG;IAAA;IAAA,6CAJ4C,IAAI;IAAA,6CACJ,IAAI;IAAA,2CACN,IAAI;IAG1D,IAAI,CAACC,OAAO,GACVX,qBAAQ,CAACY,EAAE,KAAK,KAAK,GACjB,IAAIC,+BAAkB,CAACR,0BAAa,CAACS,oBAAoB,CAAC,GAC1DC,kCAAqB;EAC7B;EAEAC,SAAS,CAACC,eAAgC,EAAE;IAC1CA,eAAe,CAACC,OAAO,GAAGA,gBAAO;IACjCd,aAAa,CAACY,SAAS,CAACG,IAAI,CAACC,SAAS,CAACH,eAAe,CAAC,CAAC;EAC1D;EAEAI,YAAY,CAACJ,eAAgC,EAAE;IAC7CA,eAAe,CAACC,OAAO,GAAGA,gBAAO;IACjCd,aAAa,CAACiB,YAAY,CAACF,IAAI,CAACC,SAAS,CAACH,eAAe,CAAC,CAAC;EAC7D;EAEAK,YAAY,CAACC,SAAoB,EAAE;IACjCnB,aAAa,CAACkB,YAAY,CAACC,SAAS,CAAC;EACvC;EAEAC,kB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AW;IAClB,OAAO,IAAI,CAACH,MAAM;EACpB;EAEAI,UAAU,GAAW;IACnB,OAAO,IAAI,CAACZ,OAAO;EACrB;EAEAa,OAAO,GAAW;IAChB,OAAO,IAAI,CAACJ,IAAI;EAClB;EAEAK,OAAO,GAAW;IAChB,OAAO,IAAI,CAACJ,IAAI;EAClB;AACF;AAAC;AAEM,MAAMK,uBAAuB,GAAG,IAAIvD,gBAAgB,EAAE;AAAC"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_package","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","LINKING_ERROR","Platform","select","ios","default","CashfreePgApi","NativeModules","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","NativeEventEmitter","CashfreeEventEmitter","NativeAppEventEmitter","doPayment","checkoutPayment","version","JSON","stringify","doUPIPayment","doWebPayment","cfSession","doCardPayment","cardPayment","console","log","setEventSubscriber","cfEventCallback","eventFunction","event","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","remove","setCallback","cfCallback","successFunction","orderID","onVerify","failureFunction","error","response","CFErrorResponse","message","fromJSON","onError","successSubscription","failureSubscription","removeCallback","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","exports","CFPaymentGatewayService"],"sources":["index.ts"],"sourcesContent":["import {\n EmitterSubscription,\n EventEmitter,\n NativeAppEventEmitter,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\nimport { version } from '../package.json';\nimport type { CheckoutPayment, CFSession } from 'cashfree-pg-api-contract';\n\nconst LINKING_ERROR =\n `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';\n\nconst CashfreePgApi = NativeModules.CashfreePgApi\n ? NativeModules.CashfreePgApi\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nclass CFPaymentGateway {\n private emitter: EventEmitter;\n private successSubscription: EmitterSubscription | null = null;\n private failureSubscription: EmitterSubscription | null = null;\n private eventSubscription: EmitterSubscription | null = null;\n\n constructor() {\n this.emitter =\n Platform.OS === 'ios'\n ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter)\n : NativeAppEventEmitter;\n }\n\n doPayment(checkoutPayment: CheckoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));\n }\n\n doUPIPayment(checkoutPayment: CheckoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doUPIPayment(JSON.stringify(checkoutPayment));\n }\n\n doWebPayment(cfSession: CFSession) {\n CashfreePgApi.doWebPayment(cfSession);\n }\n\n doCardPayment(cardPayment: CheckoutPayment) {\n cardPayment.version = version;\n console.log(\"SDK\" ,JSON.stringify(cardPayment))\n CashfreePgApi.doCardPayment(JSON.stringify(cardPayment))\n }\n\n setEventSubscriber(cfEventCallback: CFEventCallback) {\n let eventFunction = (event: string) => {\n console.log(JSON.stringify(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 (\n this.eventSubscription !== undefined &&\n this.eventSubscription !== null\n ) {\n this.eventSubscription.remove();\n this.eventSubscription = null;\n }\n CashfreePgApi.removeEventSubscriber();\n }\n\n setCallback(cfCallback: CFCallback) {\n // this.cfCallback = cfCallback;\n let successFunction = (orderID: string) => {\n console.log('response is : ' + JSON.stringify(orderID));\n cfCallback.onVerify(orderID);\n };\n let failureFunction = (error: string) => {\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(\n 'cfSuccess',\n successFunction\n );\n this.failureSubscription = this.emitter.addListener(\n 'cfFailure',\n failureFunction\n );\n CashfreePgApi.setCallback();\n }\n\n removeCallback() {\n if (\n this.successSubscription !== undefined &&\n this.successSubscription !== null\n ) {\n this.successSubscription.remove();\n this.successSubscription = null;\n }\n if (\n this.failureSubscription !== undefined &&\n this.failureSubscription !== null\n ) {\n this.failureSubscription.remove();\n this.failureSubscription = null;\n }\n }\n}\n\nexport interface CFCallback {\n onVerify(orderID: string): void;\n\n onError(error: CFErrorResponse, orderID: string): void;\n}\n\nexport interface CFEventCallback {\n onReceivedEvent(eventName: string, map: Map<string, string>): void;\n}\n\nexport class CFErrorResponse {\n private status: string = 'FAILED';\n private message: string = 'payment has failed';\n private code: string = 'payment_failed';\n private type: string = 'request_failed';\n\n fromJSON(errorString: string) {\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\n getStatus(): string {\n return this.status;\n }\n\n getMessage(): string {\n return this.message;\n }\n\n getCode(): string {\n return this.code;\n }\n\n getType(): string {\n return this.type;\n }\n}\n\nexport const CFPaymentGatewayService = new CFPaymentGateway();\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,QAAA,GAAAD,OAAA;AAA0C,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,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;AAYO,MAAML,eAAe,CAAC;EAAAvC,YAAA;IAAAlC,eAAA,iBACF,QAAQ;IAAAA,eAAA,kBACP,oBAAoB;IAAAA,eAAA,eACvB,gBAAgB;IAAAA,eAAA,eAChB,gBAAgB;EAAA;EAEvC2E,QAAQA,CAACK,WAAmB,EAAE;IAC5B9B,OAAO,CAACC,GAAG,CAAC,eAAe,GAAG6B,WAAW,CAAC;IAC1C,MAAMC,MAAM,GAAGtC,IAAI,CAACc,KAAK,CAACuB,WAAW,CAAC;IACtC9B,OAAO,CAACC,GAAG,CAAC,qBAAqB,GAAG8B,MAAM,CAAC;IAC3C,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;IAC3B,IAAI,CAACR,OAAO,GAAGO,MAAM,CAACP,OAAO;IAC7B,IAAI,CAACS,IAAI,GAAGF,MAAM,CAACE,IAAI;IACvB,IAAI,CAACC,IAAI,GAAGH,MAAM,CAACG,IAAI;EACzB;EAEAC,SAASA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACH,MAAM;EACpB;EAEAI,UAAUA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACZ,OAAO;EACrB;EAEAa,OAAOA,CAAA,EAAW;IAChB,OAAO,IAAI,CAACJ,IAAI;EAClB;EAEAK,OAAOA,CAAA,EAAW;IAChB,OAAO,IAAI,CAACJ,IAAI;EAClB;AACF;AAACK,OAAA,CAAAhB,eAAA,GAAAA,eAAA;AAEM,MAAMiB,uBAAuB,GAAG,IAAIzD,gBAAgB,CAAC,CAAC;AAACwD,OAAA,CAAAC,uBAAA,GAAAA,uBAAA"}
|
package/lib/module/index.js
CHANGED
|
@@ -31,6 +31,11 @@ class CFPaymentGateway {
|
|
|
31
31
|
doWebPayment(cfSession) {
|
|
32
32
|
CashfreePgApi.doWebPayment(cfSession);
|
|
33
33
|
}
|
|
34
|
+
doCardPayment(cardPayment) {
|
|
35
|
+
cardPayment.version = version;
|
|
36
|
+
console.log("SDK", JSON.stringify(cardPayment));
|
|
37
|
+
CashfreePgApi.doCardPayment(JSON.stringify(cardPayment));
|
|
38
|
+
}
|
|
34
39
|
setEventSubscriber(cfEventCallback) {
|
|
35
40
|
let eventFunction = event => {
|
|
36
41
|
console.log(JSON.stringify(event));
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAppEventEmitter","NativeEventEmitter","NativeModules","Platform","version","LINKING_ERROR","select","ios","default","CashfreePgApi","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","CashfreeEventEmitter","doPayment","checkoutPayment","JSON","stringify","doUPIPayment","doWebPayment","cfSession","
|
|
1
|
+
{"version":3,"names":["NativeAppEventEmitter","NativeEventEmitter","NativeModules","Platform","version","LINKING_ERROR","select","ios","default","CashfreePgApi","Proxy","get","Error","CFPaymentGateway","constructor","_defineProperty","emitter","OS","CashfreeEventEmitter","doPayment","checkoutPayment","JSON","stringify","doUPIPayment","doWebPayment","cfSession","doCardPayment","cardPayment","console","log","setEventSubscriber","cfEventCallback","eventFunction","event","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","undefined","remove","setCallback","cfCallback","successFunction","orderID","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 doUPIPayment(checkoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doUPIPayment(JSON.stringify(checkoutPayment));\n }\n doWebPayment(cfSession) {\n CashfreePgApi.doWebPayment(cfSession);\n }\n doCardPayment(cardPayment) {\n cardPayment.version = version;\n console.log(\"SDK\", JSON.stringify(cardPayment));\n CashfreePgApi.doCardPayment(JSON.stringify(cardPayment));\n }\n setEventSubscriber(cfEventCallback) {\n let eventFunction = (event) => {\n console.log(JSON.stringify(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,SAASA,qBAAqB,EAAEC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAS,cAAc;AAClG,SAASC,OAAO,QAAQ,iBAAiB;AACzC,MAAMC,aAAa,GAAI,uFAAsF,GACzGF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AACjD,MAAMC,aAAa,GAAGP,aAAa,CAACO,aAAa,GAC3CP,aAAa,CAACO,aAAa,GAC3B,IAAIC,KAAK,CAAC,CAAC,CAAC,EAAE;EACZC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAClC;AACJ,CAAC,CAAC;AACN,MAAMQ,gBAAgB,CAAC;EAKnBC,WAAWA,CAAA,EAAG;IAAAC,eAAA;IAAAA,eAAA,8BAHQ,IAAI;IAAAA,eAAA,8BACJ,IAAI;IAAAA,eAAA,4BACN,IAAI;IAEpB,IAAI,CAACC,OAAO,GACRb,QAAQ,CAACc,EAAE,KAAK,KAAK,GACf,IAAIhB,kBAAkB,CAACC,aAAa,CAACgB,oBAAoB,CAAC,GAC1DlB,qBAAqB;EACnC;EACAmB,SAASA,CAACC,eAAe,EAAE;IACvBA,eAAe,CAAChB,OAAO,GAAGA,OAAO;IACjCK,aAAa,CAAC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AAI,CAACc,mBAAmB,GAAG,IAAI;IACnC;EACJ;AACJ;AACA,OAAO,MAAML,eAAe,CAAC;EAAAtC,YAAA;IAAAC,eAAA,iBAChB,QAAQ;IAAAA,eAAA,kBACP,oBAAoB;IAAAA,eAAA,eACvB,gBAAgB;IAAAA,eAAA,eAChB,gBAAgB;EAAA;EACvBuC,QAAQA,CAACK,WAAW,EAAE;IAClB/B,OAAO,CAACC,GAAG,CAAC,eAAe,GAAG8B,WAAW,CAAC;IAC1C,MAAMC,MAAM,GAAGvC,IAAI,CAACc,KAAK,CAACwB,WAAW,CAAC;IACtC/B,OAAO,CAACC,GAAG,CAAC,qBAAqB,GAAG+B,MAAM,CAAC;IAC3C,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;IAC3B,IAAI,CAACR,OAAO,GAAGO,MAAM,CAACP,OAAO;IAC7B,IAAI,CAACS,IAAI,GAAGF,MAAM,CAACE,IAAI;IACvB,IAAI,CAACC,IAAI,GAAGH,MAAM,CAACG,IAAI;EAC3B;EACAC,SAASA,CAAA,EAAG;IACR,OAAO,IAAI,CAACH,MAAM;EACtB;EACAI,UAAUA,CAAA,EAAG;IACT,OAAO,IAAI,CAACZ,OAAO;EACvB;EACAa,OAAOA,CAAA,EAAG;IACN,OAAO,IAAI,CAACJ,IAAI;EACpB;EACAK,OAAOA,CAAA,EAAG;IACN,OAAO,IAAI,CAACJ,IAAI;EACpB;AACJ;AACA,OAAO,MAAMK,uBAAuB,GAAG,IAAIvD,gBAAgB,CAAC,CAAC"}
|
|
@@ -8,6 +8,7 @@ declare class CFPaymentGateway {
|
|
|
8
8
|
doPayment(checkoutPayment: CheckoutPayment): void;
|
|
9
9
|
doUPIPayment(checkoutPayment: CheckoutPayment): void;
|
|
10
10
|
doWebPayment(cfSession: CFSession): void;
|
|
11
|
+
doCardPayment(cardPayment: CheckoutPayment): void;
|
|
11
12
|
setEventSubscriber(cfEventCallback: CFEventCallback): void;
|
|
12
13
|
removeEventSubscriber(): void;
|
|
13
14
|
setCallback(cfCallback: CFCallback): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-cashfree-pg-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
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.
|
|
148
|
+
"cashfree-pg-api-contract": "^2.0.5"
|
|
149
149
|
}
|
|
150
150
|
}
|
package/src/index.js
CHANGED
|
@@ -33,6 +33,11 @@ class CFPaymentGateway {
|
|
|
33
33
|
doWebPayment(cfSession) {
|
|
34
34
|
CashfreePgApi.doWebPayment(cfSession);
|
|
35
35
|
}
|
|
36
|
+
doCardPayment(cardPayment) {
|
|
37
|
+
cardPayment.version = version;
|
|
38
|
+
console.log("SDK", JSON.stringify(cardPayment));
|
|
39
|
+
CashfreePgApi.doCardPayment(JSON.stringify(cardPayment));
|
|
40
|
+
}
|
|
36
41
|
setEventSubscriber(cfEventCallback) {
|
|
37
42
|
let eventFunction = (event) => {
|
|
38
43
|
console.log(JSON.stringify(event));
|
package/src/index.ts
CHANGED
|
@@ -53,6 +53,12 @@ class CFPaymentGateway {
|
|
|
53
53
|
CashfreePgApi.doWebPayment(cfSession);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
doCardPayment(cardPayment: CheckoutPayment) {
|
|
57
|
+
cardPayment.version = version;
|
|
58
|
+
console.log("SDK" ,JSON.stringify(cardPayment))
|
|
59
|
+
CashfreePgApi.doCardPayment(JSON.stringify(cardPayment))
|
|
60
|
+
}
|
|
61
|
+
|
|
56
62
|
setEventSubscriber(cfEventCallback: CFEventCallback) {
|
|
57
63
|
let eventFunction = (event: string) => {
|
|
58
64
|
console.log(JSON.stringify(event));
|