File tree Expand file tree Collapse file tree 1 file changed +26
-10
lines changed
apps/dashboard/src/app/checkout/components/client Expand file tree Collapse file tree 1 file changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -85,17 +85,33 @@ export function CheckoutEmbed({
85
85
onPurchaseSuccess : ( result ) => {
86
86
if ( ! redirectUri ) return ;
87
87
const url = new URL ( redirectUri ) ;
88
- if ( result . type === "transaction" ) {
89
- url . searchParams . set ( "txHash" , result . transactionHash ) ;
90
- return window . open ( url . toString ( ) ) ;
91
- }
92
- if ( result . status . status === "NOT_FOUND" ) {
93
- throw new Error ( "Transaction not found" ) ;
94
- }
95
- const txHash = result . status . source ?. transactionHash ;
96
- if ( typeof txHash === "string" ) {
97
- url . searchParams . set ( "txHash" , txHash ) ;
88
+ switch ( result . type ) {
89
+ case "crypto" : {
90
+ url . searchParams . set ( "status" , result . status . status ) ;
91
+ if (
92
+ "source" in result . status &&
93
+ result . status . source ?. transactionHash
94
+ ) {
95
+ url . searchParams . set (
96
+ "txHash" ,
97
+ result . status . source ?. transactionHash ,
98
+ ) ;
99
+ }
100
+ break ;
101
+ }
102
+ case "fiat" : {
103
+ url . searchParams . set ( "status" , result . status . status ) ;
104
+ if ( "intentId" in result . status ) {
105
+ url . searchParams . set ( "intentId" , result . status . intentId ) ;
106
+ }
107
+ break ;
108
+ }
109
+ case "transaction" : {
110
+ url . searchParams . set ( "txHash" , result . transactionHash ) ;
111
+ break ;
112
+ }
98
113
}
114
+ return window . open ( url . toString ( ) ) ;
99
115
} ,
100
116
} }
101
117
/>
You can’t perform that action at this time.
0 commit comments