diff --git a/constants/invoice_html.go b/constants/invoice_html.go index 6e4417a8..6fddf30c 100644 --- a/constants/invoice_html.go +++ b/constants/invoice_html.go @@ -196,7 +196,7 @@ const INVOICE_TEMPLATE_01 = ` const INVOICE_TEMPLATE_02 = ` - +
@@ -221,7 +221,7 @@ const INVOICE_TEMPLATE_02 = ` ` const INVOICE_TEMPLATE_03 = ` -
Bill To: Invoice No. #%v
+
@@ -242,7 +242,7 @@ const INVOICE_TEMPLATE_0301 = ` ` const INVOICE_TEMPLATE_04 = ` -
Product Name Price
+
@@ -271,7 +271,7 @@ const INVOICE_TEMPLATE_04 = ` ` const INVOICE_TEMPLATE_05 = ` -
Subtotal %v
+
@@ -287,7 +287,14 @@ const INVOICE_TEMPLATE_05 = ` ` const INVOICE_TEMPLATE_06 = ` - + diff --git a/service/repositories/order.go b/service/repositories/order.go index bdf5f037..bd0ca6c7 100644 --- a/service/repositories/order.go +++ b/service/repositories/order.go @@ -365,11 +365,15 @@ func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *Invoic var city string var street string var state string + var suite string + var zipCode string if ress.OrderDetail.DeliveryAddress != nil { name = fmt.Sprintf("%s %s", ress.OrderDetail.DeliveryAddress.FirstName, ress.OrderDetail.DeliveryAddress.LastName) street = ress.OrderDetail.DeliveryAddress.Street city = ress.OrderDetail.DeliveryAddress.City state = ress.OrderDetail.DeliveryAddress.State + suite = ress.OrderDetail.DeliveryAddress.Suite + zipCode = ress.OrderDetail.DeliveryAddress.ZipCode } var products string @@ -380,7 +384,7 @@ func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *Invoic var productsInfo = fmt.Sprintf(model00301, orderProduct.ProductName, price, orderProduct.PurchaseQuantity.Current, priceTotal) products = products + productsInfo } - model003 = fmt.Sprintf(constants.INVOICE_TEMPLATE_03, "", products) + model003 = fmt.Sprintf(constants.INVOICE_TEMPLATE_03, products) var subtotal = fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Subtotal.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Subtotal.Current.CurrentAmount.(string)) var taxStr = "0.00" @@ -396,22 +400,16 @@ func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *Invoic // 生成收据发票--首款 if receiptSnsDeposit != "" { - v1 := receiptSnsDeposit - v2 := name - v3 := ctimeDate - v4 := street - v5 := city - v6 := state - model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, "", v1, v2, v3, v4, v5, v6) + model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, receiptSnsDeposit, name, ctimeDate, street+" "+suite, city, state+zipCode) v7 := "Deposit Requested" v8 := fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Deposit.PayAmount.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Deposit.PayAmount.Current.CurrentAmount.(string)) v9 := "Deposit Due" v10 := v8 - model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, "", subtotal, tax, total, v7, v8, v9, v10) + model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, subtotal, tax, total, v7, v8, v9, v10) cardSn := "****" + *orderTradeDeposit.CardSn - model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, "", *orderTradeDeposit.CardBrand, cardSn) + model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, *orderTradeDeposit.CardBrand, cardSn) var content = model001 + model002 + model003 + model004 + model005 + model006 @@ -456,22 +454,16 @@ func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *Invoic // 生成收据发票--尾款 if receiptSnsFinal != "" { - v1 := receiptSnsFinal - v2 := name - v3 := ctimeDate - v4 := street - v5 := city - v6 := state - model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, "", v1, v2, v3, v4, v5, v6) + model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, receiptSnsDeposit, name, ctimeDate, street+" "+suite, city, state+zipCode) v7 := "Balance Requested" v8 := fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.RemainingBalance.PayAmount.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.RemainingBalance.PayAmount.Current.CurrentAmount.(string)) v9 := "Balance Due" v10 := v8 - model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, "", subtotal, tax, total, v7, v8, v9, v10) + model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, subtotal, tax, total, v7, v8, v9, v10) cardSn := "****" + *orderTradeFinal.CardSn - model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, "", *orderTradeDeposit.CardBrand, cardSn) + model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, *orderTradeDeposit.CardBrand, cardSn) var content = model001 + model002 + model003 + model004 + model005 + model006 base64, err := pdf.HtmlToPdfBase64(content, "html") if err != nil {
Payment Method: Notes: