payment-history: GET /payments/{id}/gateway - one payment with its HALKBANK JSON
Returns a payment the way the per-order payment table shows it (paid, cardholder name, masked card, time, payment year/month, USD/TMT amounts, reference) plus the last stored GBÜS response, for the storage icon. Card fields and gatewayResponse are null until GBÜS reports them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c209f338c2
commit
ae6bf0b7e3
6 files changed
+471
-6
No files matched your search
@@ -75,6 +75,50 @@ type PaymentHistoryDetailDTO struct {
|
||||
GatewayResponse json.RawMessage `json:"gatewayResponse,omitempty" swaggertype:"object"`
|
||||
}
|
||||
|
||||
// PaymentGatewayDTO is one payment the way the per-order payment table
|
||||
// shows it (paid or not, from which card, when, for which month) together
|
||||
// with the last GBÜS (HALKBANK) response stored for it. Card fields are
|
||||
// null until GBÜS reports cardAuthInfo; gatewayResponse is null if GBÜS
|
||||
// never answered.
|
||||
type PaymentGatewayDTO struct {
|
||||
Id int64 `json:"id"`
|
||||
OrderId int64 `json:"orderId"`
|
||||
CardholderName *string `json:"cardholderName"`
|
||||
MaskedPan *string `json:"maskedPan"`
|
||||
PaymentYear int `json:"paymentYear"`
|
||||
PaymentMonth int `json:"paymentMonth"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
AmountUsd float64 `json:"amountUsd"`
|
||||
AmountTmt float64 `json:"amountTmt"`
|
||||
OrderNumber string `json:"orderNumber"`
|
||||
Paid bool `json:"paid"`
|
||||
GatewayStatus string `json:"gatewayStatus"`
|
||||
GatewayResponse json.RawMessage `json:"gatewayResponse" swaggertype:"object"`
|
||||
}
|
||||
|
||||
// NewPaymentGatewayDTO trims a payment detail down to PaymentGatewayDTO.
|
||||
func NewPaymentGatewayDTO(detail PaymentHistoryDetailDTO) PaymentGatewayDTO {
|
||||
gatewayResponse := detail.GatewayResponse
|
||||
if len(gatewayResponse) == 0 {
|
||||
gatewayResponse = json.RawMessage("null")
|
||||
}
|
||||
return PaymentGatewayDTO{
|
||||
Id: detail.Id,
|
||||
OrderId: detail.OrderId,
|
||||
CardholderName: detail.CardholderName,
|
||||
MaskedPan: detail.MaskedPan,
|
||||
PaymentYear: detail.PaymentPeriod.Year(),
|
||||
PaymentMonth: int(detail.PaymentPeriod.Month()),
|
||||
CreatedAt: detail.CreatedAt,
|
||||
AmountUsd: detail.AmountUsd,
|
||||
AmountTmt: detail.AmountTmt,
|
||||
OrderNumber: detail.OrderNumber,
|
||||
Paid: detail.Paid,
|
||||
GatewayStatus: detail.GatewayStatus,
|
||||
GatewayResponse: gatewayResponse,
|
||||
}
|
||||
}
|
||||
|
||||
// ListFilter narrows the history list. BranchIds is populated by
|
||||
// rbac.BindBranchIDs and takes priority over BranchId when set (see
|
||||
// rbac.AppendBranchIDs), the same way visamaster.ListFilter works.
|
||||
|
||||
Reference in new issue
Block a user