Skip to content

Commit d0fc69b

Browse files
committed
review fix
1 parent f24d5ae commit d0fc69b

File tree

6 files changed

+31
-27
lines changed

6 files changed

+31
-27
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ function Pay(){
150150
| | - **`card_brands`**: Supported card brands, e.g., `'verve'`, `'visa'`, `'mastercard'`. | | |
151151
| | - **`supported_mobile_money_providers`**: Supported mobile money providers, e.g., `'mtn'`, `'atl'`, `'vod'`. | | |
152152

153+
---
154+
#### Refs
155+
156+
| Name | use/description | extra |
157+
| :---------------- | :----------------------------------------------------------: | --------: |
158+
| `startTransaction`| Function triggered to start a transaction . Example usage: `paystackWebViewRef.current.startTransaction()` | default: `nill` |
159+
| `endTransaction` | Function triggered to ends a transaction . Example usage: `paystackWebViewRef.current.endTransaction()` | default: `nill` |
160+
153161
---
154162

155163
#### Dynamic Multi-Split Payment Object structure

__tests__/utils.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable prefer-const */
21
import {
32
toAmountInKobo,
43
isValidDecimalMonetaryValue,
@@ -10,7 +9,7 @@ import {
109
buildKeyValueString,
1110
dynamicSplitObjectIsValid,
1211
paystackHtmlContent,
13-
} from '../development//utils/helper';
12+
} from '../development/utils/helper';
1413
import { DynamicMultiSplitProps, PaymentChannels } from '../development/types';
1514

1615
describe('Utility functions work properly', () => {

development/paystack.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import {
2222
} from "./utils/helper";
2323
import { PayStackProps, PayStackRef } from "./types";
2424
import { styles } from "./style";
25-
26-
const CLOSE_URL = "https://standard.paystack.co/close";
25+
import { CLOSE_URL, DEFAULT_ACTIVITY_INDICATOR_COLOR, DEFAULT_AMOUNT, DEFAULT_CURRENCY } from "./utils/constants";
2726

2827
const Paystack = forwardRef<PayStackRef, PayStackProps>(
2928
(
@@ -33,8 +32,8 @@ const Paystack = forwardRef<PayStackRef, PayStackProps>(
3332
phone,
3433
lastName,
3534
firstName,
36-
amount = "0.00",
37-
currency = "NGN",
35+
amount = DEFAULT_AMOUNT,
36+
currency = DEFAULT_CURRENCY,
3837
channels = ["card"],
3938
refNumber,
4039
billingName,
@@ -47,7 +46,7 @@ const Paystack = forwardRef<PayStackRef, PayStackProps>(
4746
onCancel,
4847
autoStart = false,
4948
onSuccess,
50-
activityIndicatorColor = "green",
49+
activityIndicatorColor = DEFAULT_ACTIVITY_INDICATOR_COLOR,
5150
modalProps,
5251
metadata,
5352
},

development/utils/constants.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const CLOSE_URL = 'https://standard.paystack.co/close';
2+
export const DEFAULT_AMOUNT = '0.00';
3+
export const DEFAULT_CURRENCY = 'NGN';
4+
export const DEFAULT_ACTIVITY_INDICATOR_COLOR = 'green';

development/utils/helper.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,10 @@ export const paystackHtmlContent = (Params: string) => `
119119
</script>
120120
</body>
121121
</html>
122-
`;
122+
`;
123+
124+
export const generateMetaDataString = (firstName: string, lastName: string, billingName: string, metadata: any) => {
125+
return metadata
126+
? `metadata: ${metadata},`
127+
: `metadata: { custom_fields: [{ display_name: '${firstName + " " + lastName}', variable_name: '${billingName}', value:'' }]},`;
128+
};

development/utils/index.ts

+7-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
export const buildKeyValueString = (key: string, value: string | undefined) =>
2-
value ? `${key}: '${value}',` : '';
3-
4-
export const dynamicSplitObjectIsValid = (split: any): boolean => {
5-
return (
6-
split !== null &&
7-
typeof split === 'object' &&
8-
split.type &&
9-
split.bearer_type &&
10-
Array.isArray(split.subaccounts)
11-
);
12-
};
13-
14-
export const generateMetaDataString = (firstName: string, lastName: string, billingName: string, metadata: any) => {
15-
return metadata
16-
? `metadata: ${metadata},`
17-
: `metadata: { custom_fields: [{ display_name: '${firstName + " " + lastName}', variable_name: '${billingName}', value:'' }]},`;
18-
};
19-
1+
import * as Constants from './constants'
2+
import * as Utils from './helper'
3+
4+
export default {
5+
Constants,
6+
Utils
7+
}

0 commit comments

Comments
 (0)