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,25 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/merrors"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
type WalletPaymentData struct {
|
||||
WalletID string `bson:"walletId" json:"walletId"`
|
||||
}
|
||||
|
||||
func (m *PaymentMethod) AsWallet() (*WalletPaymentData, error) {
|
||||
if m.Type != PaymentTypeWallet {
|
||||
return nil, merrors.InvalidArgument(fmt.Sprintf("payment method type is %s, not wallet", m.Type), "type")
|
||||
}
|
||||
|
||||
var d WalletPaymentData
|
||||
if err := bson.Unmarshal(m.Data, &d); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &d, nil
|
||||
}
|
||||
Reference in new issue
Block a user