Add instant payment collection flow aligned with Android.
Implement收款详情与收款记录 pages with pay-code API, QR generation, amount setting, and record grouping so merchants can collect payments from the home quick action. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
103
suixinkan/Features/Payment/Models/PaymentModels.swift
Normal file
103
suixinkan/Features/Payment/Models/PaymentModels.swift
Normal file
@ -0,0 +1,103 @@
|
||||
//
|
||||
// PaymentModels.swift
|
||||
// suixinkan
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// 摄影师收款码响应,包含静态与动态支付 URL。
|
||||
struct PayCodeResponse: Decodable, Sendable, Equatable {
|
||||
let staticPayURL: String
|
||||
let dynamicPayURL: String
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case staticPayURL = "static_pay_url"
|
||||
case dynamicPayURL = "dynamic_pay_url"
|
||||
}
|
||||
|
||||
init(staticPayURL: String, dynamicPayURL: String) {
|
||||
self.staticPayURL = staticPayURL
|
||||
self.dynamicPayURL = dynamicPayURL
|
||||
}
|
||||
}
|
||||
|
||||
/// 收款记录响应,含按日汇总与明细列表。
|
||||
struct RepaymentCollectionRecordResponse: Decodable, Sendable, Equatable {
|
||||
let analyse: [RepaymentCollectionRecordAnalyseItem]
|
||||
let list: [RepaymentCollectionRecordItem]
|
||||
|
||||
init(
|
||||
analyse: [RepaymentCollectionRecordAnalyseItem] = [],
|
||||
list: [RepaymentCollectionRecordItem] = []
|
||||
) {
|
||||
self.analyse = analyse
|
||||
self.list = list
|
||||
}
|
||||
}
|
||||
|
||||
/// 收款记录按日汇总项。
|
||||
struct RepaymentCollectionRecordAnalyseItem: Decodable, Sendable, Equatable, Hashable {
|
||||
let date: String
|
||||
let orderCount: Int
|
||||
let orderAmountSum: String
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case date
|
||||
case orderCount = "order_count"
|
||||
case orderAmountSum = "order_amount_sum"
|
||||
}
|
||||
|
||||
init(date: String, orderCount: Int, orderAmountSum: String) {
|
||||
self.date = date
|
||||
self.orderCount = orderCount
|
||||
self.orderAmountSum = orderAmountSum
|
||||
}
|
||||
}
|
||||
|
||||
/// 收款记录明细项。
|
||||
struct RepaymentCollectionRecordItem: Decodable, Sendable, Equatable, Hashable {
|
||||
let orderNumber: String
|
||||
let userPhone: String
|
||||
let orderAmount: String
|
||||
let createDate: String
|
||||
let createTime: String
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case orderNumber = "order_number"
|
||||
case userPhone = "user_phone"
|
||||
case orderAmount = "order_amount"
|
||||
case createDate = "create_date"
|
||||
case createTime = "create_time"
|
||||
}
|
||||
|
||||
init(
|
||||
orderNumber: String,
|
||||
userPhone: String,
|
||||
orderAmount: String,
|
||||
createDate: String,
|
||||
createTime: String
|
||||
) {
|
||||
self.orderNumber = orderNumber
|
||||
self.userPhone = userPhone
|
||||
self.orderAmount = orderAmount
|
||||
self.createDate = createDate
|
||||
self.createTime = createTime
|
||||
}
|
||||
}
|
||||
|
||||
/// 按日分组的收款记录,对齐 Android `RepaymentCollectionRecordGroup`。
|
||||
struct RepaymentCollectionRecordGroup: Sendable, Equatable, Hashable {
|
||||
let analyse: RepaymentCollectionRecordAnalyseItem
|
||||
let items: [RepaymentCollectionRecordItem]
|
||||
}
|
||||
|
||||
/// 收款商户展示信息。
|
||||
struct PaymentMerchantInfo: Sendable, Equatable {
|
||||
let name: String
|
||||
let company: String
|
||||
|
||||
static let defaultInfo = PaymentMerchantInfo(
|
||||
name: "元智享",
|
||||
company: "扬州元智享网络科技有限公司"
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user