Adds POST /customer/orders/:id/pay-with-points (docs/prd-point-coin.md F9, PC-306) for the customer app and self-order. It uses the same payment path as the cashier, approved by the customer's PIN instead of a code: the session alone is not enough (K8), and a wrong PIN takes nothing and counts toward the lock. A customer can pay only their own order; any other order, and one that does not exist, answer 404 alike, so the endpoint does not reveal other customers' orders. The method is the organization's EnakPoint method, no cashier is recorded, and settling the order triggers earning through the same onOrderPaid hook as every other payment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package contract
|
|
|
|
// Requests of /customer/pin and /marketing/customers/:id/pin (docs/prd-point-coin.md
|
|
// F11). PINs are strings so a leading zero is kept.
|
|
|
|
type RequestPinOtpRequest struct {
|
|
// pin_setup or pin_reset.
|
|
Purpose string `json:"purpose" binding:"required"`
|
|
}
|
|
|
|
type CreateCustomerPinRequest struct {
|
|
OtpToken string `json:"otp_token" binding:"required"`
|
|
OtpCode string `json:"otp_code" binding:"required"`
|
|
Pin string `json:"pin" binding:"required"`
|
|
ConfirmPin string `json:"confirm_pin" binding:"required"`
|
|
}
|
|
|
|
type ChangeCustomerPinRequest struct {
|
|
OldPin string `json:"old_pin" binding:"required"`
|
|
Pin string `json:"pin" binding:"required"`
|
|
ConfirmPin string `json:"confirm_pin" binding:"required"`
|
|
}
|
|
|
|
type ResetCustomerPinRequest = CreateCustomerPinRequest
|
|
|
|
type RemoveCustomerPinRequest struct {
|
|
Reason string `json:"reason" binding:"required"`
|
|
}
|
|
|
|
// IssuePaymentCodeRequest is POST /customer/wallet/payment-code.
|
|
type IssuePaymentCodeRequest struct {
|
|
Pin string `json:"pin" binding:"required"`
|
|
}
|
|
|
|
// PayWithPointsRequest is POST /customer/orders/:id/pay-with-points.
|
|
type PayWithPointsRequest struct {
|
|
Points int64 `json:"points" binding:"required,min=1"`
|
|
Pin string `json:"pin" binding:"required"`
|
|
}
|