Commit 5203a576 by TingSong-Syu

Product add method present

parent d9b2ef92
......@@ -53,4 +53,20 @@ class Product implements IAssignable {
public static function hasBought(string $name, int $userId): bool {
return array_key_exists($name, self::userBought($userId));
}
/**
* @param int $userId
* @param string $comment
*
* @return Order
*/
public function present(int $userId, string $comment = '') {
$purpose = new Purpose();
$purpose->productName = $this->name;
$purpose->payMethod = Order::PAY_PRESENT;
$purpose->userId = $userId;
$purpose->comment = $comment;
$purpose->money = 0;
return RPCWrapper::rpc('pay_center')->call('buy', $purpose);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment