diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index 3aa24100..505a47f1 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -17,6 +17,18 @@ type BalanceRequest struct { verifyHeader *service.RequestVerificationHeader } +type BalanceResponseBody struct { + bal *Decimal +} + +type BalanceResponse struct { + body *BalanceResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + type Decimal struct { val int64 @@ -122,3 +134,59 @@ func (d *Decimal) SetPrecision(v uint32) { d.prec = v } } + +func (br *BalanceResponseBody) GetBalance() *Decimal { + if br != nil { + return br.bal + } + + return nil +} + +func (br *BalanceResponseBody) SetBalance(v *Decimal) { + if br != nil { + br.SetBalance(v) + } +} + +func (br *BalanceResponse) GetBody() *BalanceResponseBody { + if br != nil { + return br.body + } + + return nil +} + +func (br *BalanceResponse) SetBody(v *BalanceResponseBody) { + if br != nil { + br.body = v + } +} + +func (br *BalanceResponse) GetResponseMetaHeader() *service.ResponseMetaHeader { + if br != nil { + return br.metaHeader + } + + return nil +} + +func (br *BalanceResponse) SetResponseMetaHeader(v *service.ResponseMetaHeader) { + if br != nil { + br.metaHeader = v + } +} + +func (br *BalanceResponse) GetResponseVerificationHeader() *service.ResponseVerificationHeader { + if br != nil { + return br.verifyHeader + } + + return nil +} + +func (br *BalanceResponse) SetResponseVerificationHeader(v *service.ResponseVerificationHeader) { + if br != nil { + br.verifyHeader = v + } +} diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go index 8cc2936a..5a0b6edc 100644 --- a/v2/accounting/convert.go +++ b/v2/accounting/convert.go @@ -91,3 +91,63 @@ func DecimalFromGRPCMessage(m *accounting.Decimal) *Decimal { return d } + +func BalanceResponseBodyToGRPCMessage(br *BalanceResponseBody) *accounting.BalanceResponse_Body { + if br == nil { + return nil + } + + m := new(accounting.BalanceResponse_Body) + + m.SetBalance( + DecimalToGRPCMessage(br.GetBalance()), + ) + + return m +} + +func BalanceResponseBodyFromGRPCMessage(m *accounting.BalanceResponse_Body) *BalanceResponseBody { + if m == nil { + return nil + } + + br := new(BalanceResponseBody) + + br.SetBalance( + DecimalFromGRPCMessage(m.GetBalance()), + ) + + return br +} + +func BalanceResponseToGRPCMessage(br *BalanceResponse) *accounting.BalanceResponse { + if br == nil { + return nil + } + + m := new(accounting.BalanceResponse) + + m.SetBody( + BalanceResponseBodyToGRPCMessage(br.GetBody()), + ) + + service.ResponseHeadersToGRPC(br, m) + + return m +} + +func BalanceResponseFromGRPCMessage(m *accounting.BalanceResponse) *BalanceResponse { + if m == nil { + return nil + } + + br := new(BalanceResponse) + + br.SetBody( + BalanceResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, br) + + return br +}