Bootstrap copied BFF and local accounts with public Sendico contracts (#34)
This commit is contained in:
1 parent
67dc5b5b1e
commit
7062672a87
556 files changed
+42291
-777
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/merrors"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
type IbanPaymentData struct {
|
||||
Iban string `bson:"iban" json:"iban"`
|
||||
AccountHolder string `bson:"accountHolder" json:"accountHolder"`
|
||||
Bic *string `bson:"bic,omitempty" json:"bic,omitempty"`
|
||||
BankName *string `bson:"bankName,omitempty" json:"bankName,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PaymentMethod) AsIban() (*IbanPaymentData, error) {
|
||||
if m.Type != PaymentTypeIban {
|
||||
return nil, merrors.InvalidArgument(fmt.Sprintf("payment method type is %s, not iban", m.Type), "type")
|
||||
}
|
||||
var d IbanPaymentData
|
||||
if err := bson.Unmarshal(m.Data, &d); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &d, nil
|
||||
}
|
||||
Reference in new issue
Block a user