refactor: update payment platform to support multiple image URLs

This commit is contained in:
imeepos 2025-09-28 17:50:22 +08:00
parent 399935d2ef
commit 5453c79197
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import { useServerSdk } from "../../hooks"; import { useServerSdk } from "../../hooks";
import { Payment } from "../types/payment"; import { Payment } from "../types/payment";
export class H5Payment extends Payment { export class H5Payment extends Payment {
async pay(templateCode: string, imageUrl: string) { async pay(templateCode: string, imageUrls: string[]) {
const sdk = useServerSdk() const sdk = useServerSdk()
const { hostname, protocol, port } = window.location; const { hostname, protocol, port } = window.location;
let baseUrl = `${protocol}//${hostname}` let baseUrl = `${protocol}//${hostname}`
@ -9,7 +9,7 @@ export class H5Payment extends Payment {
baseUrl = `${protocol}//${hostname}:${port}` baseUrl = `${protocol}//${hostname}:${port}`
} }
const cbUrl = `${baseUrl}` const cbUrl = `${baseUrl}`
const response = await sdk.payTemplateCode(templateCode, imageUrl, cbUrl) const response = await sdk.payTemplateCode(templateCode, imageUrls, cbUrl)
if (response.url) { if (response.url) {
window.location.href = response.url; window.location.href = response.url;
return; return;

View File

@ -2,5 +2,5 @@
export abstract class Payment{ export abstract class Payment{
abstract pay(templateCode: string, imageUrl: string): Promise<any>; abstract pay(templateCode: string, imageUrls: string[]): Promise<any>;
} }