Skip to content

Commit 1bc85b7

Browse files
committed
fix: state check
1 parent 29644ae commit 1bc85b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/wallet/wallet.grpc.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package wallet
22

33
import (
44
"context"
5+
"fmt"
56
"log"
67
"time"
78

@@ -283,6 +284,10 @@ func (s *walletServiceImpl) PayPleasePay(ctx context.Context, request *v1.PayPle
283284
return nil, status.Error(codes.FailedPrecondition, "you cannot pay to yourself")
284285
}
285286

287+
if pleasePay.State != "PENDING" {
288+
return nil, status.Error(codes.FailedPrecondition, fmt.Sprintf("please pay is not in correct state. expected `PENDING` found `%v`", pleasePay.State))
289+
}
290+
286291
if float32(payer.Money) < float32(pleasePay.Amount) {
287292
return nil, status.Error(codes.FailedPrecondition, "not enough money")
288293
}

0 commit comments

Comments
 (0)