react-native-cashfree-pg-sdk 2.3.2 → 2.5.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.
- package/android/.project +6 -0
- package/android/build.gradle +1 -1
- package/ios/CashfreePgApi.swift +2 -1
- package/lib/commonjs/CFErrorResponse.js +43 -0
- package/lib/commonjs/CFErrorResponse.js.map +1 -0
- package/lib/commonjs/Card/CFCardComponent.js +6 -11
- package/lib/commonjs/Card/CFCardComponent.js.map +1 -1
- package/lib/commonjs/Card/index.js.map +1 -1
- package/lib/commonjs/PPIWallet/PPIWalletPayment.js +104 -0
- package/lib/commonjs/PPIWallet/PPIWalletPayment.js.map +1 -0
- package/lib/commonjs/index.js +19 -33
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/CFErrorResponse.js +36 -0
- package/lib/module/CFErrorResponse.js.map +1 -0
- package/lib/module/Card/CFCardComponent.js +0 -9
- package/lib/module/Card/index.js.map +1 -1
- package/lib/module/PPIWallet/PPIWalletPayment.js +98 -0
- package/lib/module/PPIWallet/PPIWalletPayment.js.map +1 -0
- package/lib/module/index.js +11 -29
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/CFErrorResponse.d.ts +16 -0
- package/lib/typescript/src/PPIWallet/PPIWalletPayment.d.ts +6 -0
- package/lib/typescript/src/index.d.ts +8 -13
- package/package.json +2 -2
- package/react-native-cashfree-pg-sdk.podspec +1 -1
- package/src/CFErrorResponse.js +35 -0
- package/src/CFErrorResponse.ts +38 -0
- package/src/PPIWallet/PPIWalletPayment.js +94 -0
- package/src/PPIWallet/PPIWalletPayment.ts +120 -0
- package/src/index.js +10 -27
- package/src/index.ts +12 -33
package/src/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import { version } from '../package.json';
|
|
|
3
3
|
import { CFUPIPayment, CFCardPayment, CFNBPayment, CFSubsUPIPayment, CFSubsCardPayment, CFSubsNBPayment, } from 'cashfree-pg-api-contract';
|
|
4
4
|
import CFCardComponent from './Card/CFCardComponent';
|
|
5
5
|
import CFSubsCardComponent from './Card/CFSubsCardComponent';
|
|
6
|
+
import { CFErrorResponse } from './CFErrorResponse';
|
|
7
|
+
import { doPPIWalletPayment } from './PPIWallet/PPIWalletPayment';
|
|
6
8
|
const LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \n\n` +
|
|
7
9
|
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
8
10
|
'- You rebuilt the app after installing the package\n' +
|
|
@@ -105,6 +107,13 @@ class CFPaymentGateway {
|
|
|
105
107
|
console.log('makePayment::==> Wrong payment object');
|
|
106
108
|
}
|
|
107
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates a PPI wallet order session via Cashfree's API.
|
|
112
|
+
* Resolves with the API response as-is; rejects with CFErrorResponse.
|
|
113
|
+
*/
|
|
114
|
+
doPPIWalletPayment(payment) {
|
|
115
|
+
return doPPIWalletPayment(payment);
|
|
116
|
+
}
|
|
108
117
|
setEventSubscriber(cfEventCallback) {
|
|
109
118
|
let eventFunction = (event) => {
|
|
110
119
|
console.log(JSON.stringify(event));
|
|
@@ -159,33 +168,7 @@ class CFPaymentGateway {
|
|
|
159
168
|
}
|
|
160
169
|
}
|
|
161
170
|
}
|
|
162
|
-
export
|
|
163
|
-
status = 'FAILED';
|
|
164
|
-
message = 'payment has failed';
|
|
165
|
-
code = 'payment_failed';
|
|
166
|
-
type = 'request_failed';
|
|
167
|
-
fromJSON(errorString) {
|
|
168
|
-
console.log('errorString :' + errorString);
|
|
169
|
-
const object = JSON.parse(errorString);
|
|
170
|
-
console.log('errorStringObject :' + object);
|
|
171
|
-
this.status = object.status;
|
|
172
|
-
this.message = object.message;
|
|
173
|
-
this.code = object.code;
|
|
174
|
-
this.type = object.type;
|
|
175
|
-
}
|
|
176
|
-
getStatus() {
|
|
177
|
-
return this.status;
|
|
178
|
-
}
|
|
179
|
-
getMessage() {
|
|
180
|
-
return this.message;
|
|
181
|
-
}
|
|
182
|
-
getCode() {
|
|
183
|
-
return this.code;
|
|
184
|
-
}
|
|
185
|
-
getType() {
|
|
186
|
-
return this.type;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
171
|
+
export { CFErrorResponse };
|
|
189
172
|
export const CFCard = CFCardComponent;
|
|
190
173
|
export const CFSubsCard = CFSubsCardComponent;
|
|
191
174
|
export const CFPaymentGatewayService = new CFPaymentGateway();
|
package/src/index.ts
CHANGED
|
@@ -16,9 +16,12 @@ import {
|
|
|
16
16
|
CFSubsUPIPayment,
|
|
17
17
|
CFSubsCardPayment,
|
|
18
18
|
CFSubsNBPayment,
|
|
19
|
+
type CFPPIWalletPayment,
|
|
19
20
|
} from 'cashfree-pg-api-contract';
|
|
20
21
|
import CFCardComponent from './Card/CFCardComponent';
|
|
21
22
|
import CFSubsCardComponent from './Card/CFSubsCardComponent';
|
|
23
|
+
import { CFErrorResponse } from './CFErrorResponse';
|
|
24
|
+
import { doPPIWalletPayment } from './PPIWallet/PPIWalletPayment';
|
|
22
25
|
|
|
23
26
|
const LINKING_ERROR =
|
|
24
27
|
`The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -132,6 +135,14 @@ class CFPaymentGateway {
|
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Creates a PPI wallet order session via Cashfree's API.
|
|
140
|
+
* Resolves with the API response as-is; rejects with CFErrorResponse.
|
|
141
|
+
*/
|
|
142
|
+
doPPIWalletPayment(payment: CFPPIWalletPayment): Promise<unknown> {
|
|
143
|
+
return doPPIWalletPayment(payment);
|
|
144
|
+
}
|
|
145
|
+
|
|
135
146
|
setEventSubscriber(cfEventCallback: CFEventCallback) {
|
|
136
147
|
let eventFunction = (event: string) => {
|
|
137
148
|
console.log(JSON.stringify(event));
|
|
@@ -214,39 +225,7 @@ export interface CFEventCallback {
|
|
|
214
225
|
onReceivedEvent(eventName: string, map: Map<string, string>): void;
|
|
215
226
|
}
|
|
216
227
|
|
|
217
|
-
export
|
|
218
|
-
private status: string = 'FAILED';
|
|
219
|
-
private message: string = 'payment has failed';
|
|
220
|
-
private code: string = 'payment_failed';
|
|
221
|
-
private type: string = 'request_failed';
|
|
222
|
-
|
|
223
|
-
fromJSON(errorString: string) {
|
|
224
|
-
console.log('errorString :' + errorString);
|
|
225
|
-
const object = JSON.parse(errorString);
|
|
226
|
-
console.log('errorStringObject :' + object);
|
|
227
|
-
this.status = object.status;
|
|
228
|
-
this.message = object.message;
|
|
229
|
-
this.code = object.code;
|
|
230
|
-
this.type = object.type;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
getStatus(): string {
|
|
234
|
-
return this.status;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
getMessage(): string {
|
|
238
|
-
return this.message;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
getCode(): string {
|
|
242
|
-
return this.code;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
getType(): string {
|
|
246
|
-
return this.type;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
228
|
+
export { CFErrorResponse };
|
|
250
229
|
export const CFCard = CFCardComponent;
|
|
251
230
|
export const CFSubsCard = CFSubsCardComponent;
|
|
252
231
|
export const CFPaymentGatewayService = new CFPaymentGateway();
|