diff --git a/app/PaymentDrivers/AuthorizePaymentDriver.php b/app/PaymentDrivers/AuthorizePaymentDriver.php index fa185bab2636..5cc9abb4c9f4 100644 --- a/app/PaymentDrivers/AuthorizePaymentDriver.php +++ b/app/PaymentDrivers/AuthorizePaymentDriver.php @@ -94,12 +94,12 @@ class AuthorizePaymentDriver extends BaseDriver return $this->authorizeView($payment_method); } - public function purchase() + public function purchase($amount, $return_client_response = false) { return () } - public function refund() + public function refund($amount, $transaction_reference, $return_client_response = false) { } diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 43cf26c9ab58..e488d5798964 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -17,7 +17,6 @@ use App\Models\CompanyGateway; use App\PaymentDrivers\AbstractPaymentDriver; use App\Utils\Traits\MakesHash; use App\Utils\Traits\SystemLogTrait; -use Omnipay\Omnipay; /** * Class BaseDriver @@ -44,6 +43,8 @@ class BaseDriver extends AbstractPaymentDriver /* Authorise payment methods */ protected $can_authorise_credit_card = false; + /* The client */ + protected $client; public function __construct(CompanyGateway $company_gateway, Client $client = null, $invitation = false) { @@ -54,10 +55,32 @@ class BaseDriver extends AbstractPaymentDriver $this->client = $client; } - + /** + * Authorize a payment method. + * + * Returns a reusable token for storage for future payments + * @param const $payment_method the GatewayType::constant + * @return view Return a view for collecting payment method information + */ public function authorize($payment_method) {} - public function purchase() {} + /** + * Executes purchase attempt for a given amount + * + * @param float $amount The amount to be collected + * @param boolean $return_client_response Whether the method needs to return a response (otherwise we assume an unattended payment) + * @return mixed + */ + public function purchase($amount, $return_client_response = false) {} + + /** + * Executes a refund attempt for a given amount with a transaction_reference + * + * @param float $amount The amount to be refunded + * @param string $transaction_reference The transaction reference + * @param boolean $return_client_response Whether the method needs to return a response (otherwise we assume an unattended payment) + * @return mixed + */ + public function refund($amount, $transaction_reference, $return_client_response = false) {} - public function refund() {} }