default currency resolver
This commit is contained in:
@@ -15,6 +15,12 @@ type PaymentIntent struct {
|
|||||||
Attributes map[string]string `json:"attributes,omitempty"`
|
Attributes map[string]string `json:"attributes,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AssetResolverStub struct{}
|
||||||
|
|
||||||
|
func (a *AssetResolverStub) IsSupported(_ string) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (p *PaymentIntent) Validate() error {
|
func (p *PaymentIntent) Validate() error {
|
||||||
// Kind must be set (non-zero)
|
// Kind must be set (non-zero)
|
||||||
var zeroKind PaymentKind
|
var zeroKind PaymentKind
|
||||||
@@ -34,7 +40,7 @@ func (p *PaymentIntent) Validate() error {
|
|||||||
return merrors.InvalidArgument("amount is required", "intent.amount")
|
return merrors.InvalidArgument("amount is required", "intent.amount")
|
||||||
}
|
}
|
||||||
//TODO: collect supported currencies and validate against them
|
//TODO: collect supported currencies and validate against them
|
||||||
if err := ValidateMoney(p.Amount, nil); err != nil {
|
if err := ValidateMoney(p.Amount, &AssetResolverStub{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user