mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Set default designs
This commit is contained in:
parent
7eaafe52c7
commit
05a6544898
@ -496,6 +496,7 @@ class DesignController extends BaseController
|
||||
$company = auth()->user()->getCompany();
|
||||
|
||||
$design = Design::where('company_id', $company->id)
|
||||
->orWhereNull('company_id')
|
||||
->where('id', $design_id)
|
||||
->exists();
|
||||
|
||||
|
@ -403,10 +403,8 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
SystemLogger::dispatch(
|
||||
$gateway->payment_hash,
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
@ -620,21 +618,27 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
{
|
||||
$types = [];
|
||||
|
||||
// if($type == GatewayType::BANK_TRANSFER && $this->company_gateway->fees_and_limits->{GatewayType::BANK_TRANSFER}->is_enabled)
|
||||
// {
|
||||
// $types[] = $type;
|
||||
// }
|
||||
// elseif($type == GatewayType::CREDIT_CARD && $this->company_gateway->fees_and_limits->{GatewayType::CREDIT_CARD}->is_enabled)
|
||||
// {
|
||||
// $types[] = $type;
|
||||
// }
|
||||
|
||||
$types[] = GatewayType::CREDIT_CARD;
|
||||
$types[] = GatewayType::BANK_TRANSFER;
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic description handler
|
||||
*/
|
||||
public function getDescription(bool $abbreviated = true)
|
||||
{
|
||||
if(!$this->payment_hash)
|
||||
return "";
|
||||
|
||||
if($abbreviated)
|
||||
return \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray());
|
||||
|
||||
return sprintf('%s: %s', ctrans('texts.invoices'), \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray()));
|
||||
|
||||
}
|
||||
|
||||
public function disconnect()
|
||||
{
|
||||
return true;
|
||||
|
@ -88,7 +88,6 @@ class CreditCard
|
||||
'raw_value' => $request->raw_value,
|
||||
'currency' => $request->currency,
|
||||
'payment_hash' => $request->payment_hash,
|
||||
'reference' => $request->payment_hash,
|
||||
'client_id' => $this->checkout->client->id,
|
||||
];
|
||||
|
||||
@ -134,9 +133,10 @@ class CreditCard
|
||||
|
||||
private function completePayment($method, PaymentResponseRequest $request)
|
||||
{
|
||||
|
||||
$payment = new Payment($method, $this->checkout->payment_hash->data->currency);
|
||||
$payment->amount = $this->checkout->payment_hash->data->value;
|
||||
$payment->reference = $this->checkout->payment_hash->data->reference;
|
||||
$payment->reference = $this->checkout->getDescription();
|
||||
|
||||
$this->checkout->payment_hash->data = array_merge((array)$this->checkout->payment_hash->data, ['checkout_payment_ref' => $payment]);
|
||||
$this->checkout->payment_hash->save();
|
||||
|
@ -243,27 +243,18 @@ class CheckoutComPaymentDriver extends BaseDriver
|
||||
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;
|
||||
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->first();
|
||||
|
||||
if ($invoice) {
|
||||
$description = "Invoice {$invoice->number} for {$amount} for client {$this->client->present()->name()}";
|
||||
} else {
|
||||
$description = "Payment with no invoice for amount {$amount} for client {$this->client->present()->name()}";
|
||||
}
|
||||
|
||||
$this->init();
|
||||
|
||||
$method = new IdSource($cgt->token);
|
||||
|
||||
$payment = new \Checkout\Models\Payments\Payment($method, $this->client->getCurrencyCode());
|
||||
$payment->amount = $this->convertToCheckoutAmount($amount, $this->client->getCurrencyCode());
|
||||
//$payment->reference = $cgt->meta->last4 . '-' . now();
|
||||
$payment->reference = $invoice->number . '-' . now();
|
||||
|
||||
$request = new PaymentResponseRequest();
|
||||
$request->setMethod('POST');
|
||||
$request->request->add(['payment_hash' => $payment_hash->hash]);
|
||||
|
||||
//$this->setPaymentHash($payment_hash);
|
||||
|
||||
try {
|
||||
$response = $this->gateway->payments()->request($payment);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user