feat: notify supplier and client after payment is done
This commit is contained in:
@@ -64,7 +64,7 @@ func (repo *Repo) FromAmount(ctx context.Context, amount float64, timestamp time
|
||||
return order, nil
|
||||
}
|
||||
|
||||
func (repo *Repo) OrderCompleted(ctx context.Context, order *domain.Order) error {
|
||||
func (repo *Repo) OrderCompleted(ctx context.Context, order *domain.Order) (*domain.Order, error) {
|
||||
updateOpts, err := repo.collection.UpdateOne(ctx, bson.M{"_id": order.ID},
|
||||
bson.M{
|
||||
"tx": order.Tx,
|
||||
@@ -73,8 +73,8 @@ func (repo *Repo) OrderCompleted(ctx context.Context, order *domain.Order) error
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("collection.UpdateOne: %s", err)
|
||||
return nil, fmt.Errorf("collection.UpdateOne: %s", err)
|
||||
}
|
||||
log.Printf("OrderCompleted update %+v\n", updateOpts)
|
||||
return nil
|
||||
return order, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user