aboutsummaryrefslogtreecommitdiff
path: root/payment_method.go
diff options
context:
space:
mode:
Diffstat (limited to 'payment_method.go')
-rw-r--r--payment_method.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/payment_method.go b/payment_method.go
index b5e95fa..9dffcda 100644
--- a/payment_method.go
+++ b/payment_method.go
@@ -45,19 +45,21 @@ func (req *PaymentMethod) SetDateTime(t time.Time) {
// Signature.
func (req *PaymentMethod) Sign(opts ClientOptions) {
var (
+ merchant = opts.DefaultMerchant
+
plain string
hash [sha256.Size]byte
)
if len(req.MerchantCode) == 0 {
- req.MerchantCode = opts.MerchantCode
+ req.MerchantCode = merchant.Code
}
if len(req.DateTime) == 0 {
req.SetDateTime(time.Now())
}
- plain = fmt.Sprintf(`%s%d%s%s`, req.MerchantCode, req.Amount, req.DateTime, opts.MerchantApiKey)
+ plain = fmt.Sprintf(`%s%d%s%s`, req.MerchantCode, req.Amount, req.DateTime, merchant.ApiKey)
hash = sha256.Sum256([]byte(plain))
req.Signature = hex.EncodeToString(hash[:])