feat: add payment
This commit is contained in:
12
src/platforms/h5/payment.ts
Normal file
12
src/platforms/h5/payment.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { useServerSdk } from "../../hooks";
|
||||
import { Payment } from "../types/payment";
|
||||
export class H5Payment extends Payment {
|
||||
async pay(templateCode: string, imageUrl: string) {
|
||||
const sdk = useServerSdk()
|
||||
const response = await sdk.payTemplateCode(templateCode, imageUrl)
|
||||
if (response.url) {
|
||||
window.location.href = response.url;
|
||||
}
|
||||
throw new Error(`payment error: ${response}`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user