File tree Expand file tree Collapse file tree 5 files changed +135
-0
lines changed
types/sabpaisa-react-lite Expand file tree Collapse file tree 5 files changed +135
-0
lines changed Original file line number Diff line number Diff line change 1+ *
2+ ! ** /* .d.ts
3+ ! ** /* .d.cts
4+ ! ** /* .d.mts
5+ ! ** /* .d. * .ts
Original file line number Diff line number Diff line change 1+ export interface SabpaisaSuccessResponse {
2+ razorpay_signature : string ;
3+ razorpay_order_id : string ;
4+ razorpay_payment_id : string ;
5+ }
6+
7+ export interface SabpaisaErrorResponse {
8+ code : number ;
9+ description : string ;
10+ error : {
11+ field ?: string ;
12+ source : string ;
13+ step : string ;
14+ reason : string ;
15+ metadata : {
16+ payment_id ?: string ;
17+ order_id : string ;
18+ } ;
19+ } ;
20+ }
21+
22+ export interface SabpaisaCheckoutOptions {
23+ first_name : string ;
24+ last_name : string ;
25+ currency : string ;
26+ mobile_number : string ;
27+ email_id : string ;
28+ client_code : string ;
29+ aes_iv : string ;
30+ aes_key : string ;
31+ user_name : string ;
32+ password : string ;
33+ env : string ;
34+ txn_id : string ;
35+ amount : string ;
36+ }
37+
38+ declare const SabPaisaCheckout : {
39+ open : (
40+ options : SabpaisaCheckoutOptions ,
41+ successCallback ?: ( data : SabpaisaSuccessResponse ) => void ,
42+ errorCallback ?: ( data : SabpaisaErrorResponse ) => void ,
43+ ) => Promise < SabpaisaSuccessResponse > ;
44+ onExternalWalletSelection : ( externalWalletCallback : ( data : unknown ) => void ) => void ;
45+ } ;
46+
47+ export default SabPaisaCheckout ;
Original file line number Diff line number Diff line change 1+ {
2+ "private" : true ,
3+ "name" : " @types/sabpaisa-react-lite" ,
4+ "version" : " 2.4.9999" ,
5+ "projects" : [
6+ " https://www.npmjs.com/package/sabpaisa-react-lite"
7+ ],
8+ "devDependencies" : {
9+ "@types/sabpaisa-react-lite" : " workspace:." ,
10+ "react-native" : " *"
11+ },
12+ "owners" : [
13+ {
14+ "name" : " Lokesh D" ,
15+ "githubUsername" : " lokesheywa"
16+ }
17+ ],
18+ "dependencies" : {
19+ "@types/react" : " *"
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ import * as React from "react" ;
2+ import { Button } from "react-native" ;
3+ import SabPaisaCheckout , { SabpaisaErrorResponse } from "sabpaisa-react-lite" ;
4+
5+
6+ const SabpaisaCheckoutOptions = {
7+ first_name : 'firstnamereact' ,
8+ last_name : 'lastnamereact' ,
9+ currency : 'INR' ,
10+ mobile_number : '9999999999' ,
11+ 12+ client_code : '<client_code>' ,
13+ aes_iv : '<aes_iv>' ,
14+ aes_key : '<aes_key>' ,
15+ user_name : '<user_name>' ,
16+ password : '<password>' ,
17+ env : 'staging' ,
18+ txn_id : '11223344343' ,
19+ amount : '100'
20+ } ;
21+
22+ const Test = ( ) => {
23+ return (
24+ < >
25+ < Button
26+ title = "Pay"
27+ onPress = { ( ) => {
28+ SabPaisaCheckout . open ( SabpaisaCheckoutOptions )
29+ . then ( data => {
30+ // type should match SuccessResponse definition
31+ console . log ( data ) ;
32+ } )
33+ . catch ( ( error : SabpaisaErrorResponse ) => {
34+ // type should match ErrorResponse definition
35+ // type valid for errors after successful API integration
36+ console . log ( error ) ;
37+ } ) ;
38+ } }
39+ />
40+ </ >
41+ ) ;
42+ } ;
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "module" : " commonjs" ,
4+ "lib" : [
5+ " es6"
6+ ],
7+ "noImplicitAny" : true ,
8+ "noImplicitThis" : true ,
9+ "strictNullChecks" : true ,
10+ "strictFunctionTypes" : true ,
11+ "types" : [],
12+ "noEmit" : true ,
13+ "forceConsistentCasingInFileNames" : true ,
14+ "jsx" : " react-native"
15+ },
16+ "files" : [
17+ " index.d.ts" ,
18+ " sabpaisa-reactlite-tests.tsx"
19+ ]
20+ }
You can’t perform that action at this time.
0 commit comments