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,30 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
func TestTokenPaymentDataUnmarshalReadsSnakeCaseExpiryAsInt(t *testing.T) {
|
||||
raw, err := bson.Marshal(bson.M{
|
||||
"token": "card-token",
|
||||
"last4": "1234",
|
||||
"exp_month": "01",
|
||||
"exp_year": 2031.0,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("marshal card token data: %v", err)
|
||||
}
|
||||
|
||||
var data TokenPaymentData
|
||||
if err := bson.Unmarshal(raw, &data); err != nil {
|
||||
t.Fatalf("unmarshal card token data: %v", err)
|
||||
}
|
||||
if got, want := data.ExpMonth, 1; got == nil || *got != want {
|
||||
t.Fatalf("exp_month mismatch: got=%v want=%d", got, want)
|
||||
}
|
||||
if got, want := data.ExpYear, 2031; got == nil || *got != want {
|
||||
t.Fatalf("exp_year mismatch: got=%v want=%d", got, want)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user