Skip to content

Commit 3031e6e

Browse files
add payment disputes and disputes list to ga react sdk (#160)
* add payment disputes and disputes list to ga react sdk * update version
1 parent fc4a1ca commit 3031e6e

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@babel/preset-react": "7.18.6",
5252
"@rollup/plugin-json": "^6.0.0",
5353
"@rollup/plugin-replace": "^2.3.1",
54-
"@stripe/connect-js": "3.3.20",
54+
"@stripe/connect-js": "3.3.24",
5555
"@types/jest": "^24.0.25",
5656
"@types/react": "^16.8.0",
5757
"@types/react-dom": "^16.8.0",

src/Components.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,52 @@ export const ConnectPaymentDetails = ({
8282
return wrapper;
8383
};
8484

85+
export const ConnectPaymentDisputes = ({
86+
payment,
87+
onDisputesLoaded,
88+
onLoadError,
89+
onLoaderStart,
90+
}: {
91+
/**
92+
* @param payment the ID of `payment`, `charge`, or `paymentIntent` to be displayed.
93+
*/
94+
payment: string;
95+
onDisputesLoaded?: ({total}: {total: number}) => void;
96+
} & CommonComponentProps): JSX.Element | null => {
97+
const {wrapper, component} =
98+
useCreateComponent('payment-disputes');
99+
100+
useUpdateWithSetter(component, payment, (comp, val) =>
101+
comp.setPayment(val)
102+
);
103+
useUpdateWithSetter(component, onDisputesLoaded, (comp, val) =>
104+
comp.setOnDisputesLoaded(val)
105+
);
106+
useUpdateWithSetter(component, onLoaderStart, (comp, val) => {
107+
comp.setOnLoaderStart(val);
108+
});
109+
useUpdateWithSetter(component, onLoadError, (comp, val) => {
110+
comp.setOnLoadError(val);
111+
});
112+
return wrapper;
113+
};
114+
115+
export const ConnectDisputesList = ({
116+
onLoadError,
117+
onLoaderStart,
118+
}: CommonComponentProps): JSX.Element | null => {
119+
const {wrapper, component} =
120+
useCreateComponent('disputes-list');
121+
122+
useUpdateWithSetter(component, onLoaderStart, (comp, val) => {
123+
comp.setOnLoaderStart(val);
124+
});
125+
useUpdateWithSetter(component, onLoadError, (comp, val) => {
126+
comp.setOnLoadError(val);
127+
});
128+
return wrapper;
129+
};
130+
85131
export type CollectionOptions = {
86132
fields: 'currently_due' | 'eventually_due';
87133
futureRequirements?: 'omit' | 'include';

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,10 +1577,10 @@
15771577
dependencies:
15781578
"@sinonjs/commons" "^3.0.0"
15791579

1580-
"@stripe/connect-js@3.3.20":
1581-
version "3.3.20"
1582-
resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.20.tgz#ffa508f62effcadf7e0774ca222dbc9d60704141"
1583-
integrity sha512-4GingsjdQDJomIMAmTWFJSBifLygc5xWCcYzdcL5nYiePBuHEfYwFKKq7tOO1SIR2jsuHpn6R18xKVijToblWQ==
1580+
"@stripe/connect-js@3.3.24":
1581+
version "3.3.24"
1582+
resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.24.tgz#94993ce7003834bfa303f1f86bda30ab19b7c9cb"
1583+
integrity sha512-riqfW58xATZkffnPHXYuRL6gfvSNt1aW2J9iHID2mmOEapDdm9ECdWvbBss2B4bSfqWGu5Kx7tUHkNYlf1u8hQ==
15841584

15851585
"@tootallnate/once@2":
15861586
version "2.0.0"

0 commit comments

Comments
 (0)