1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Fix bugs when paying with a stored card

This commit is contained in:
Joshua Dwire 2016-09-15 11:37:43 -04:00
parent 6d8e1de2c9
commit 5af46cf1e9

View File

@ -253,8 +253,22 @@ class BasePaymentDriver
->wherePublicId($this->sourceId)
->firstOrFail();
}
} elseif ($this->shouldCreateToken()) {
$paymentMethod = $this->createToken();
if ( ! $this->meetsGatewayTypeLimits($paymentMethod->payment_type->gateway_type_id)) {
// The customer must have hacked the URL
Session::flash('error', trans('texts.limits_not_met'));
return redirect()->to('view/' . $this->invitation->invitation_key);
}
} else {
if ($this->shouldCreateToken()) {
$paymentMethod = $this->createToken();
}
if ( ! $this->meetsGatewayTypeLimits($this->gatewayType)) {
// The customer must have hacked the URL
Session::flash('error', trans('texts.limits_not_met'));
return redirect()->to('view/' . $this->invitation->invitation_key);
}
}
if ($this->isTwoStep()) {
@ -334,7 +348,7 @@ class BasePaymentDriver
protected function paymentDetails($paymentMethod = false)
{
$invoice = $this->invoice();
$gatewayTypeAlias = GatewayType::getAliasFromId($this->gatewayType);
$gatewayTypeAlias = $this->gatewayType == GATEWAY_TYPE_TOKEN ? $this->gatewayType : GatewayType::getAliasFromId($this->gatewayType);
$completeUrl = url('complete/' . $this->invitation->invitation_key . '/' . $gatewayTypeAlias);
$data = [