From c76e87921f002fa5b23c9d490b71bd93e4e5f6f3 Mon Sep 17 00:00:00 2001 From: huynguyenh Date: Thu, 13 Apr 2023 11:25:45 +0700 Subject: [PATCH 1/3] feat: add more bank info --- docs/docs.go | 281 +++++++++++++++++- docs/swagger.json | 281 +++++++++++++++++- docs/swagger.yaml | 188 +++++++++++- .../schemas/20230410074638-add-bank-info.sql | 8 + .../bankaccount/testdata/list/200.json | 12 + pkg/handler/invoice/invoice.go | 35 ++- pkg/model/bank_account.go | 18 +- pkg/templates/invoice.html | 14 +- pkg/view/bank.go | 48 +-- 9 files changed, 837 insertions(+), 48 deletions(-) create mode 100644 migrations/schemas/20230410074638-add-bank-info.sql diff --git a/docs/docs.go b/docs/docs.go index 8ae1e9446..81006c95c 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -5299,6 +5299,12 @@ const docTemplate = `{ "id": { "type": "string" }, + "intermediaryBankAddress": { + "type": "string" + }, + "intermediaryBankName": { + "type": "string" + }, "name": { "type": "string" }, @@ -5319,6 +5325,59 @@ const docTemplate = `{ } } }, + "model.BaseSalary": { + "type": "object", + "properties": { + "batch": { + "type": "integer" + }, + "category": { + "type": "string" + }, + "company_account_amount": { + "type": "integer" + }, + "contract_amount": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "currency": { + "$ref": "#/definitions/model.Currency" + }, + "currency_id": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "effective_date": { + "type": "string" + }, + "employee": { + "$ref": "#/definitions/model.Employee" + }, + "employee_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "insurance_amount": { + "type": "integer" + }, + "personal_account_amount": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, "model.Chapter": { "type": "object", "properties": { @@ -5424,6 +5483,35 @@ const docTemplate = `{ } } }, + "model.CommissionExplain": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "bucket_id": { + "type": "integer" + }, + "formatted_amount": { + "type": "string" + }, + "id": { + "type": "string" + }, + "month": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "todo_id": { + "type": "integer" + }, + "year": { + "type": "integer" + } + } + }, "model.CompanyContactInfo": { "type": "object", "properties": { @@ -5600,12 +5688,15 @@ const docTemplate = `{ "avatar": { "type": "string" }, + "base_salary": { + "$ref": "#/definitions/model.BaseSalary" + }, "basecampAttachableSGID": { "type": "string" }, "basecampID": { "description": "social services", - "type": "string" + "type": "integer" }, "city": { "type": "string" @@ -5661,6 +5752,9 @@ const docTemplate = `{ "$ref": "#/definitions/model.EmployeeStack" } }, + "employee_salary": { + "$ref": "#/definitions/model.EmployeeSalary" + }, "fullName": { "description": "basic info", "type": "string" @@ -5938,6 +6032,59 @@ const docTemplate = `{ } } }, + "model.EmployeeSalary": { + "type": "object", + "properties": { + "actual_pay_day": { + "type": "integer" + }, + "bonus_amount": { + "type": "integer" + }, + "bonus_detail": { + "type": "array", + "items": { + "type": "integer" + } + }, + "commission_amount": { + "type": "integer" + }, + "commission_detail": { + "type": "array", + "items": { + "type": "integer" + } + }, + "employee_id": { + "type": "string" + }, + "is_done": { + "type": "boolean" + }, + "month": { + "type": "integer" + }, + "plan_pay_day": { + "type": "integer" + }, + "reimbursement_amount": { + "type": "integer" + }, + "reimbursement_detail": { + "type": "array", + "items": { + "type": "integer" + } + }, + "total_amount": { + "type": "integer" + }, + "year": { + "type": "integer" + } + } + }, "model.EmployeeStack": { "type": "object", "properties": { @@ -6252,6 +6399,103 @@ const docTemplate = `{ } } }, + "model.Payroll": { + "type": "object", + "properties": { + "base_salary_amount": { + "type": "integer" + }, + "commission_amount": { + "type": "integer" + }, + "commission_explain": { + "type": "array", + "items": { + "type": "integer" + } + }, + "commission_explains": { + "description": "CommissionExplains is commission explains in email template", + "type": "array", + "items": { + "$ref": "#/definitions/model.CommissionExplain" + } + }, + "contract_amount": { + "type": "integer" + }, + "conversion_amount": { + "type": "integer" + }, + "due_date": { + "type": "string" + }, + "employee": { + "$ref": "#/definitions/model.Employee" + }, + "employee_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_paid": { + "type": "boolean" + }, + "month": { + "type": "integer" + }, + "project_bonus": { + "type": "integer" + }, + "project_bonus_explain": { + "type": "array", + "items": { + "type": "integer" + } + }, + "project_bonus_explains": { + "description": "ProjectBonusExplains is project bonus explains in email template", + "type": "array", + "items": { + "$ref": "#/definitions/model.ProjectBonusExplain" + } + }, + "total": { + "type": "integer" + }, + "total_allowance": { + "description": "TotalAllowance is amount of allowance in email template", + "type": "number" + }, + "total_explain": { + "type": "array", + "items": { + "type": "integer" + } + }, + "twAmount": { + "description": "TotalAllowance is amount of allowance in email template", + "type": "number" + }, + "twFee": { + "type": "number" + }, + "twRate": { + "description": "TWRate is rate of allowance in email template", + "type": "number" + }, + "user_rank_snapshot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "year": { + "type": "integer" + } + } + }, "model.Position": { "type": "object", "properties": { @@ -6382,6 +6626,35 @@ const docTemplate = `{ } } }, + "model.ProjectBonusExplain": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "bucket_id": { + "type": "integer" + }, + "description": { + "type": "string" + }, + "formatted_amount": { + "type": "string" + }, + "month": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "todo_id": { + "type": "integer" + }, + "year": { + "type": "integer" + } + } + }, "model.ProjectHead": { "type": "object", "properties": { @@ -8480,6 +8753,12 @@ const docTemplate = `{ "id": { "type": "string" }, + "intermediaryBankAddress": { + "type": "string" + }, + "intermediaryBankName": { + "type": "string" + }, "name": { "type": "string" }, diff --git a/docs/swagger.json b/docs/swagger.json index 49ef16e46..a0ff033af 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -5291,6 +5291,12 @@ "id": { "type": "string" }, + "intermediaryBankAddress": { + "type": "string" + }, + "intermediaryBankName": { + "type": "string" + }, "name": { "type": "string" }, @@ -5311,6 +5317,59 @@ } } }, + "model.BaseSalary": { + "type": "object", + "properties": { + "batch": { + "type": "integer" + }, + "category": { + "type": "string" + }, + "company_account_amount": { + "type": "integer" + }, + "contract_amount": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "currency": { + "$ref": "#/definitions/model.Currency" + }, + "currency_id": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "effective_date": { + "type": "string" + }, + "employee": { + "$ref": "#/definitions/model.Employee" + }, + "employee_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "insurance_amount": { + "type": "integer" + }, + "personal_account_amount": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, "model.Chapter": { "type": "object", "properties": { @@ -5416,6 +5475,35 @@ } } }, + "model.CommissionExplain": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "bucket_id": { + "type": "integer" + }, + "formatted_amount": { + "type": "string" + }, + "id": { + "type": "string" + }, + "month": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "todo_id": { + "type": "integer" + }, + "year": { + "type": "integer" + } + } + }, "model.CompanyContactInfo": { "type": "object", "properties": { @@ -5592,12 +5680,15 @@ "avatar": { "type": "string" }, + "base_salary": { + "$ref": "#/definitions/model.BaseSalary" + }, "basecampAttachableSGID": { "type": "string" }, "basecampID": { "description": "social services", - "type": "string" + "type": "integer" }, "city": { "type": "string" @@ -5653,6 +5744,9 @@ "$ref": "#/definitions/model.EmployeeStack" } }, + "employee_salary": { + "$ref": "#/definitions/model.EmployeeSalary" + }, "fullName": { "description": "basic info", "type": "string" @@ -5930,6 +6024,59 @@ } } }, + "model.EmployeeSalary": { + "type": "object", + "properties": { + "actual_pay_day": { + "type": "integer" + }, + "bonus_amount": { + "type": "integer" + }, + "bonus_detail": { + "type": "array", + "items": { + "type": "integer" + } + }, + "commission_amount": { + "type": "integer" + }, + "commission_detail": { + "type": "array", + "items": { + "type": "integer" + } + }, + "employee_id": { + "type": "string" + }, + "is_done": { + "type": "boolean" + }, + "month": { + "type": "integer" + }, + "plan_pay_day": { + "type": "integer" + }, + "reimbursement_amount": { + "type": "integer" + }, + "reimbursement_detail": { + "type": "array", + "items": { + "type": "integer" + } + }, + "total_amount": { + "type": "integer" + }, + "year": { + "type": "integer" + } + } + }, "model.EmployeeStack": { "type": "object", "properties": { @@ -6244,6 +6391,103 @@ } } }, + "model.Payroll": { + "type": "object", + "properties": { + "base_salary_amount": { + "type": "integer" + }, + "commission_amount": { + "type": "integer" + }, + "commission_explain": { + "type": "array", + "items": { + "type": "integer" + } + }, + "commission_explains": { + "description": "CommissionExplains is commission explains in email template", + "type": "array", + "items": { + "$ref": "#/definitions/model.CommissionExplain" + } + }, + "contract_amount": { + "type": "integer" + }, + "conversion_amount": { + "type": "integer" + }, + "due_date": { + "type": "string" + }, + "employee": { + "$ref": "#/definitions/model.Employee" + }, + "employee_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_paid": { + "type": "boolean" + }, + "month": { + "type": "integer" + }, + "project_bonus": { + "type": "integer" + }, + "project_bonus_explain": { + "type": "array", + "items": { + "type": "integer" + } + }, + "project_bonus_explains": { + "description": "ProjectBonusExplains is project bonus explains in email template", + "type": "array", + "items": { + "$ref": "#/definitions/model.ProjectBonusExplain" + } + }, + "total": { + "type": "integer" + }, + "total_allowance": { + "description": "TotalAllowance is amount of allowance in email template", + "type": "number" + }, + "total_explain": { + "type": "array", + "items": { + "type": "integer" + } + }, + "twAmount": { + "description": "TotalAllowance is amount of allowance in email template", + "type": "number" + }, + "twFee": { + "type": "number" + }, + "twRate": { + "description": "TWRate is rate of allowance in email template", + "type": "number" + }, + "user_rank_snapshot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "year": { + "type": "integer" + } + } + }, "model.Position": { "type": "object", "properties": { @@ -6374,6 +6618,35 @@ } } }, + "model.ProjectBonusExplain": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "bucket_id": { + "type": "integer" + }, + "description": { + "type": "string" + }, + "formatted_amount": { + "type": "string" + }, + "month": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "todo_id": { + "type": "integer" + }, + "year": { + "type": "integer" + } + } + }, "model.ProjectHead": { "type": "object", "properties": { @@ -8472,6 +8745,12 @@ "id": { "type": "string" }, + "intermediaryBankAddress": { + "type": "string" + }, + "intermediaryBankName": { + "type": "string" + }, "name": { "type": "string" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index eb49a5aa0..527557770 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -48,6 +48,10 @@ definitions: $ref: '#/definitions/gorm.DeletedAt' id: type: string + intermediaryBankAddress: + type: string + intermediaryBankName: + type: string name: type: string ownerName: @@ -61,6 +65,41 @@ definitions: updatedAt: type: string type: object + model.BaseSalary: + properties: + batch: + type: integer + category: + type: string + company_account_amount: + type: integer + contract_amount: + type: integer + createdAt: + type: string + currency: + $ref: '#/definitions/model.Currency' + currency_id: + type: string + deletedAt: + $ref: '#/definitions/gorm.DeletedAt' + effective_date: + type: string + employee: + $ref: '#/definitions/model.Employee' + employee_id: + type: string + id: + type: string + insurance_amount: + type: integer + personal_account_amount: + type: integer + type: + type: string + updatedAt: + type: string + type: object model.Chapter: properties: code: @@ -130,6 +169,25 @@ definitions: updatedAt: type: string type: object + model.CommissionExplain: + properties: + amount: + type: integer + bucket_id: + type: integer + formatted_amount: + type: string + id: + type: string + month: + type: integer + name: + type: string + todo_id: + type: integer + year: + type: integer + type: object model.CompanyContactInfo: properties: address: @@ -245,11 +303,13 @@ definitions: type: string avatar: type: string + base_salary: + $ref: '#/definitions/model.BaseSalary' basecampAttachableSGID: type: string basecampID: description: social services - type: string + type: integer city: type: string country: @@ -266,6 +326,8 @@ definitions: type: string displayName: type: string + employee_salary: + $ref: '#/definitions/model.EmployeeSalary' employeeChapters: items: $ref: '#/definitions/model.EmployeeChapter' @@ -470,6 +532,41 @@ definitions: updatedAt: type: string type: object + model.EmployeeSalary: + properties: + actual_pay_day: + type: integer + bonus_amount: + type: integer + bonus_detail: + items: + type: integer + type: array + commission_amount: + type: integer + commission_detail: + items: + type: integer + type: array + employee_id: + type: string + is_done: + type: boolean + month: + type: integer + plan_pay_day: + type: integer + reimbursement_amount: + type: integer + reimbursement_detail: + items: + type: integer + type: array + total_amount: + type: integer + year: + type: integer + type: object model.EmployeeStack: properties: createdAt: @@ -677,6 +774,72 @@ definitions: updatedAt: type: string type: object + model.Payroll: + properties: + base_salary_amount: + type: integer + commission_amount: + type: integer + commission_explain: + items: + type: integer + type: array + commission_explains: + description: CommissionExplains is commission explains in email template + items: + $ref: '#/definitions/model.CommissionExplain' + type: array + contract_amount: + type: integer + conversion_amount: + type: integer + due_date: + type: string + employee: + $ref: '#/definitions/model.Employee' + employee_id: + type: string + id: + type: string + is_paid: + type: boolean + month: + type: integer + project_bonus: + type: integer + project_bonus_explain: + items: + type: integer + type: array + project_bonus_explains: + description: ProjectBonusExplains is project bonus explains in email template + items: + $ref: '#/definitions/model.ProjectBonusExplain' + type: array + total: + type: integer + total_allowance: + description: TotalAllowance is amount of allowance in email template + type: number + total_explain: + items: + type: integer + type: array + twAmount: + description: TotalAllowance is amount of allowance in email template + type: number + twFee: + type: number + twRate: + description: TWRate is rate of allowance in email template + type: number + user_rank_snapshot: + items: + type: integer + type: array + year: + type: integer + type: object model.Position: properties: code: @@ -763,6 +926,25 @@ definitions: updatedAt: type: string type: object + model.ProjectBonusExplain: + properties: + amount: + type: integer + bucket_id: + type: integer + description: + type: string + formatted_amount: + type: string + month: + type: integer + name: + type: string + todo_id: + type: integer + year: + type: integer + type: object model.ProjectHead: properties: commissionRate: @@ -2159,6 +2341,10 @@ definitions: type: string id: type: string + intermediaryBankAddress: + type: string + intermediaryBankName: + type: string name: type: string ownerName: diff --git a/migrations/schemas/20230410074638-add-bank-info.sql b/migrations/schemas/20230410074638-add-bank-info.sql new file mode 100644 index 000000000..36ae6d947 --- /dev/null +++ b/migrations/schemas/20230410074638-add-bank-info.sql @@ -0,0 +1,8 @@ + +-- +migrate Up +alter table public.bank_accounts add column intermediary_bank_address text; +alter table public.bank_accounts add column intermediary_bank_name text; + +-- +migrate Down +alter table public.bank_accounts drop column intermediary_bank_address; +alter table public.bank_accounts drop column intermediary_bank_name; diff --git a/pkg/handler/bankaccount/testdata/list/200.json b/pkg/handler/bankaccount/testdata/list/200.json index 387efb271..f2f65505b 100644 --- a/pkg/handler/bankaccount/testdata/list/200.json +++ b/pkg/handler/bankaccount/testdata/list/200.json @@ -8,6 +8,8 @@ "address": "Hado Centrosa", "swiftCode": "AVBWFPW", "routingNumber": "", + "intermediaryBankAddress": "", + "intermediaryBankName": "", "name": "DF Bank Account", "ukSortCode": "", "currencyID": "7037bdb6-584e-4e35-996d-ef28a243f48a", @@ -27,6 +29,8 @@ "address": "HCM VN", "swiftCode": "123456", "routingNumber": "123456", + "intermediaryBankAddress": "", + "intermediaryBankName": "", "name": "name1", "ukSortCode": "name1", "currencyID": "06a699ed-618b-400b-ac8c-8739956fa8e7", @@ -46,6 +50,8 @@ "address": "HCM VN", "swiftCode": "123457", "routingNumber": "123457", + "intermediaryBankAddress": "", + "intermediaryBankName": "", "name": "name2", "ukSortCode": "name2", "currencyID": "0a6f4a2e-a097-4f7e-ae65-bfee3298e5cc", @@ -65,6 +71,8 @@ "address": "HCM VN", "swiftCode": "123458", "routingNumber": "123458", + "intermediaryBankAddress": "", + "intermediaryBankName": "", "name": "name3", "ukSortCode": "name3", "currencyID": "1c7dcbe2-6984-461d-8ed9-537676f2b590", @@ -84,6 +92,8 @@ "address": "HN VN", "swiftCode": "123459", "routingNumber": "123459", + "intermediaryBankAddress": "", + "intermediaryBankName": "", "name": "name4", "ukSortCode": "name4", "currencyID": "0a6f4a2e-a097-4f7e-ae65-bfee3298e5cc", @@ -103,6 +113,8 @@ "address": "HN VN", "swiftCode": "123450", "routingNumber": "123450", + "intermediaryBankAddress": "", + "intermediaryBankName": "", "name": "name5", "ukSortCode": "name5", "currencyID": "06a699ed-618b-400b-ac8c-8739956fa8e7", diff --git a/pkg/handler/invoice/invoice.go b/pkg/handler/invoice/invoice.go index 05a42151d..36f177a11 100644 --- a/pkg/handler/invoice/invoice.go +++ b/pkg/handler/invoice/invoice.go @@ -443,23 +443,30 @@ func (h *handler) generateInvoicePDF(l logger.Logger, invoice *model.Invoice) er haveRouting := invoice.Bank.RoutingNumber != "" haveSwiftCode := invoice.Bank.SwiftCode != "" haveUKSortCode := invoice.Bank.UKSortCode != "" + haveIntermediaryBankName := invoice.Bank.IntermediaryBankName != "" + haveIntermediaryBankAddress := invoice.Bank.IntermediaryBankAddress != "" data := &struct { - Path string - Invoice *model.Invoice - HaveRouting bool - HaveUKSortCode bool - HaveSWIFTCode bool - CompanyContactInfo *model.CompanyContactInfo - InvoiceItem []model.InvoiceItem + Path string + Invoice *model.Invoice + HaveRouting bool + HaveUKSortCode bool + HaveSWIFTCode bool + HaveIntermediaryBankName bool + HaveIntermediaryBankAddress bool + CompanyContactInfo *model.CompanyContactInfo + InvoiceItem []model.InvoiceItem + IntermediaryBankName string }{ - Path: h.config.Invoice.TemplatePath, - Invoice: invoice, - HaveRouting: haveRouting, - HaveUKSortCode: haveUKSortCode, - HaveSWIFTCode: haveSwiftCode, - CompanyContactInfo: companyInfo, - InvoiceItem: items, + Path: h.config.Invoice.TemplatePath, + Invoice: invoice, + HaveRouting: haveRouting, + HaveUKSortCode: haveUKSortCode, + HaveSWIFTCode: haveSwiftCode, + HaveIntermediaryBankName: haveIntermediaryBankName, + HaveIntermediaryBankAddress: haveIntermediaryBankAddress, + CompanyContactInfo: companyInfo, + InvoiceItem: items, } funcMap := template.FuncMap{ diff --git a/pkg/model/bank_account.go b/pkg/model/bank_account.go index 96d829a42..38bf410c7 100644 --- a/pkg/model/bank_account.go +++ b/pkg/model/bank_account.go @@ -4,14 +4,16 @@ package model type BankAccount struct { BaseModel - AccountNumber string - BankName string - OwnerName string - Address *string - SwiftCode string - RoutingNumber string - Name string - UKSortCode string + AccountNumber string + BankName string + OwnerName string + Address *string + SwiftCode string + RoutingNumber string + Name string + UKSortCode string + IntermediaryBankName string + IntermediaryBankAddress string CurrencyID UUID Currency *Currency diff --git a/pkg/templates/invoice.html b/pkg/templates/invoice.html index 2cb966889..845fc8e18 100644 --- a/pkg/templates/invoice.html +++ b/pkg/templates/invoice.html @@ -285,6 +285,18 @@ {{.Invoice.Bank.SwiftCode}} {{end}} + {{if .HaveIntermediaryBankName}} + + Intermediary Bank: + {{.Invoice.Bank.IntermediaryBankName}} + + {{end}} + {{if .HaveIntermediaryBankAddress}} + + Intermediary Bank Address: + {{.Invoice.Bank.IntermediaryBankNameAddress}} + + {{end}} {{if .HaveRouting}} Routing number: @@ -301,4 +313,4 @@ - \ No newline at end of file + diff --git a/pkg/view/bank.go b/pkg/view/bank.go index 9a6e2e01c..7c10e4322 100644 --- a/pkg/view/bank.go +++ b/pkg/view/bank.go @@ -7,17 +7,19 @@ type ListBankAccountResponse struct { } type BankAccount struct { - ID string `json:"id"` - AccountNumber string `json:"accountNumber"` - BankName string `json:"bankName"` - OwnerName string `json:"ownerName"` - Address *string `json:"address"` - SwiftCode string `json:"swiftCode"` - RoutingNumber string `json:"routingNumber"` - Name string `json:"name"` - UKSortCode string `json:"ukSortCode"` - CurrencyID string `json:"currencyID"` - Currency Currency `json:"currency"` + ID string `json:"id"` + AccountNumber string `json:"accountNumber"` + BankName string `json:"bankName"` + OwnerName string `json:"ownerName"` + Address *string `json:"address"` + SwiftCode string `json:"swiftCode"` + IntermediaryBankAddress string `json:"intermediaryBankAddress"` + IntermediaryBankName string `json:"intermediaryBankName"` + RoutingNumber string `json:"routingNumber"` + Name string `json:"name"` + UKSortCode string `json:"ukSortCode"` + CurrencyID string `json:"currencyID"` + Currency Currency `json:"currency"` } func ToListBankAccount(accounts []*model.BankAccount) []BankAccount { @@ -25,17 +27,19 @@ func ToListBankAccount(accounts []*model.BankAccount) []BankAccount { for _, acc := range accounts { res = append(res, BankAccount{ - ID: acc.ID.String(), - AccountNumber: acc.AccountNumber, - BankName: acc.BankName, - OwnerName: acc.OwnerName, - Address: acc.Address, - SwiftCode: acc.SwiftCode, - RoutingNumber: acc.RoutingNumber, - Name: acc.Name, - UKSortCode: acc.UKSortCode, - CurrencyID: acc.CurrencyID.String(), - Currency: toCurrency(acc.Currency), + ID: acc.ID.String(), + AccountNumber: acc.AccountNumber, + BankName: acc.BankName, + OwnerName: acc.OwnerName, + Address: acc.Address, + SwiftCode: acc.SwiftCode, + RoutingNumber: acc.RoutingNumber, + Name: acc.Name, + UKSortCode: acc.UKSortCode, + IntermediaryBankName: acc.IntermediaryBankName, + IntermediaryBankAddress: acc.IntermediaryBankAddress, + CurrencyID: acc.CurrencyID.String(), + Currency: toCurrency(acc.Currency), }) } From 1b3be0f4fbbb0afed86d3390323606fb19e20718 Mon Sep 17 00:00:00 2001 From: huynguyenh Date: Thu, 13 Apr 2023 11:46:24 +0700 Subject: [PATCH 2/3] chore: typo --- pkg/templates/invoice.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/templates/invoice.html b/pkg/templates/invoice.html index 845fc8e18..e19abcbde 100644 --- a/pkg/templates/invoice.html +++ b/pkg/templates/invoice.html @@ -294,7 +294,7 @@ {{if .HaveIntermediaryBankAddress}} Intermediary Bank Address: - {{.Invoice.Bank.IntermediaryBankNameAddress}} + {{.Invoice.Bank.IntermediaryBankAddress}} {{end}} {{if .HaveRouting}} From fa0832727d2e4a91fe692e7c12e6d8a848c63100 Mon Sep 17 00:00:00 2001 From: lmquang Date: Thu, 13 Apr 2023 13:26:28 +0700 Subject: [PATCH 3/3] chore: update Dockerfile --- Dockerfile | 4 ++-- pkg/handler/invoice/invoice.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 84dabdba0..47170d4b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM surnet/alpine-wkhtmltopdf:3.10-0.12.5-full as wkhtmltopdf +FROM surnet/alpine-wkhtmltopdf:3.17.0-0.12.6-full as wkhtmltopdf FROM golang:1.18-alpine as builder RUN mkdir /build @@ -9,7 +9,7 @@ ENV GOOS=linux GOARCH=amd64 CGO_ENABLED=0 RUN go install -v ./... RUN go install -v github.com/rubenv/sql-migrate/sql-migrate@latest -FROM alpine:3.15 +FROM alpine:3.17.3 RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \ echo http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \ diff --git a/pkg/handler/invoice/invoice.go b/pkg/handler/invoice/invoice.go index 36f177a11..6467796a7 100644 --- a/pkg/handler/invoice/invoice.go +++ b/pkg/handler/invoice/invoice.go @@ -308,7 +308,7 @@ func (h *handler) Send(c *gin.Context) { iv.Number = *nextInvoiceNumber if err := h.generateInvoicePDF(l, iv); err != nil { - l.Error(err, "failed to get next invoice Number") + l.Error(err, "failed to generate Invoice PDF") c.JSON(http.StatusInternalServerError, view.CreateResponse[any](nil, nil, err, req, "")) return }