I need help about the structure about a payment system. Here is how it works: Manager give to Seller an item. This item can be sold at any price and the Manager will receive a percentage. When Seller sells that item to Customer I need to save two payments. Customer->Seller and Seller->Manager. So I have created three classes:
Payment
class Payment{
private $id;
private $item;
private $date;
private $status;
private $amount;
}
Payment_Customer
class Payment_Customer extends Payment{
private $frequency;
private $rating;
private $amount_paid;
}
Payment_Seller
class Payment_Seller extends Payment{
private $percentage;
private $amount_due;
private $max_date;
}
But now I have a problem because I need an object 'entire payment' that contains both payment types so I added an object Payment_Customer and Payment_Seller into Payment class that now looks like this:
class Payment{
private $id;
private $date;
private $status;
private $amount;
private $payment_customer;
private $payment_seller;
}
That's wrong! What could be a good solution for this? Create a new class Entire_Payment which contains both payment types? Or change classes model? Any suggestion? Thanks in advance.