package booking

import (
	"log"
)

func (bs Service) OnePayment(id int) *Payment {
	p, err := bs.store.GetPayment(id)
	if err != nil {
		log.Println(err)
	}
	return p
}

func (bs Service) CreatePayment(bid int, amount float64, paymentMethod string) (*Payment, error) {
	p, err := bs.store.CreatePayment(&Payment{
		BookingID:     uint(bid),
		Amount:        amount,
		PaymentMethod: paymentMethod,
	})
	if err != nil {
		return nil, err
	}

	return p, nil
}

func (bs Service) UpdatePayment(id int, amount float64, paymentMethod string) *Payment {
	p, err := bs.store.UpdatePayment(id, amount, paymentMethod)
	if err != nil {
		log.Println(err)
	}
	return p
}
