feat(payment): implement change payment method (PATCH /payment-method)
- ChangePaymentMethodPayload + ChangePaymentMethodResult models - ApiService.changePaymentMethod() - PixPaymentContext gains storeId + order data for payment switch - PaymentPixView: Trocar button opens ChangePaymentSheet with 3 options - ChangePaymentSheet: Novo PIX (new QR), Cartão (saved or new), Pagar na Entrega - ChangePaymentCardSheet + ChangePaymentNewCardView with same card masks/validation - OrdersView/OrderEntryDestinationView: threaded appState binding
This commit is contained in:
@@ -397,9 +397,24 @@ extension CheckoutView {
|
||||
? pixFromPayment?.expirationDate : pixFromPayload?.expirationDate
|
||||
|
||||
if let copyPaste, copyPaste.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false {
|
||||
let itemsData = (try? JSONEncoder().encode(appState.cart.toOrderItemsPayload())).flatMap { String(data: $0, encoding: .utf8) } ?? "[]"
|
||||
let storeId = appState.cart.storeId ?? ""
|
||||
pixPaymentContext = PixPaymentContext(
|
||||
id: orderId, orderId: orderId, shortId: result.shortId,
|
||||
copyPaste: copyPaste, qrCodeImageBase64: qrCodeImage, expirationDate: expirationDate
|
||||
id: orderId,
|
||||
orderId: orderId,
|
||||
shortId: result.shortId,
|
||||
storeId: storeId,
|
||||
copyPaste: copyPaste,
|
||||
qrCodeImageBase64: qrCodeImage,
|
||||
expirationDate: expirationDate,
|
||||
total: totalValue,
|
||||
profileName: appState.profile.name,
|
||||
profileEmail: appState.profile.email,
|
||||
profilePhone: appState.profile.phone,
|
||||
addressZip: selectedCustomerAddress?.zipCode,
|
||||
addressNumber: selectedCustomerAddress?.number,
|
||||
deliveryType: deliveryType.rawValue,
|
||||
itemsJSON: itemsData
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user