mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
commit
f0b51b7949
@ -50,7 +50,7 @@ class PostUpdate extends Command
|
|||||||
info("I wasn't able to migrate the data.");
|
info("I wasn't able to migrate the data.");
|
||||||
}
|
}
|
||||||
|
|
||||||
nlog("finished migrating");
|
info("finished migrating");
|
||||||
|
|
||||||
$output = [];
|
$output = [];
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping();
|
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping();
|
||||||
|
|
||||||
$schedule->job(new RecurringExpensesCron)->dailyAt('23:45')->withoutOverlapping();
|
$schedule->job(new RecurringExpensesCron)->dailyAt('00:10')->withoutOverlapping();
|
||||||
|
|
||||||
$schedule->job(new AutoBillCron)->dailyAt('00:30')->withoutOverlapping();
|
$schedule->job(new AutoBillCron)->dailyAt('00:30')->withoutOverlapping();
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ namespace App\Http\Controllers\ClientPortal;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\ClientPortal\Uploads\StoreUploadRequest;
|
use App\Http\Requests\ClientPortal\Uploads\StoreUploadRequest;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Account;
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
@ -26,14 +27,21 @@ use Illuminate\Support\Facades\Auth;
|
|||||||
class NinjaPlanController extends Controller
|
class NinjaPlanController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function index(string $contact_key, string $company_key)
|
public function index(string $contact_key, string $account_or_company_key)
|
||||||
{
|
{
|
||||||
MultiDB::findAndSetDbByCompanyKey($company_key);
|
MultiDB::findAndSetDbByCompanyKey($account_or_company_key);
|
||||||
$company = Company::where('company_key', $company_key)->first();
|
$company = Company::where('company_key', $account_or_company_key)->first();
|
||||||
|
|
||||||
|
if(!$company){
|
||||||
|
MultiDB::findAndSetDbByAccountKey($account_or_company_key);
|
||||||
|
$account = Account::where('key', $account_or_company_key)->first();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$account = $company->account;
|
||||||
|
|
||||||
|
|
||||||
nlog("Ninja Plan Controller Company key found {$company->company_key}");
|
nlog("Ninja Plan Controller Company key found {$company->company_key}");
|
||||||
|
|
||||||
$account = $company->account;
|
|
||||||
|
|
||||||
if (MultiDB::findAndSetDbByContactKey($contact_key) && $client_contact = ClientContact::where('contact_key', $contact_key)->first())
|
if (MultiDB::findAndSetDbByContactKey($contact_key) && $client_contact = ClientContact::where('contact_key', $contact_key)->first())
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,9 @@ class AutoBillCron
|
|||||||
->where('auto_bill_enabled', true)
|
->where('auto_bill_enabled', true)
|
||||||
->where('balance', '>', 0)
|
->where('balance', '>', 0)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
|
->whereHas('company', function ($query) {
|
||||||
|
$query->where('is_disabled',0);
|
||||||
|
})
|
||||||
->with('company');
|
->with('company');
|
||||||
|
|
||||||
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill");
|
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill");
|
||||||
@ -65,6 +68,9 @@ class AutoBillCron
|
|||||||
->where('auto_bill_enabled', true)
|
->where('auto_bill_enabled', true)
|
||||||
->where('balance', '>', 0)
|
->where('balance', '>', 0)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
|
->whereHas('company', function ($query) {
|
||||||
|
$query->where('is_disabled',0);
|
||||||
|
})
|
||||||
->with('company');
|
->with('company');
|
||||||
|
|
||||||
nlog($auto_bill_invoices->count(). " full invoices to auto bill");
|
nlog($auto_bill_invoices->count(). " full invoices to auto bill");
|
||||||
@ -85,6 +91,9 @@ class AutoBillCron
|
|||||||
->where('auto_bill_enabled', true)
|
->where('auto_bill_enabled', true)
|
||||||
->where('balance', '>', 0)
|
->where('balance', '>', 0)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
|
->whereHas('company', function ($query) {
|
||||||
|
$query->where('is_disabled',0);
|
||||||
|
})
|
||||||
->with('company');
|
->with('company');
|
||||||
|
|
||||||
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill db = {$db}");
|
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill db = {$db}");
|
||||||
@ -98,6 +107,9 @@ class AutoBillCron
|
|||||||
->where('auto_bill_enabled', true)
|
->where('auto_bill_enabled', true)
|
||||||
->where('balance', '>', 0)
|
->where('balance', '>', 0)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
|
->whereHas('company', function ($query) {
|
||||||
|
$query->where('is_disabled',0);
|
||||||
|
})
|
||||||
->with('company');
|
->with('company');
|
||||||
|
|
||||||
nlog($auto_bill_invoices->count(). " full invoices to auto bill db = {$db}");
|
nlog($auto_bill_invoices->count(). " full invoices to auto bill db = {$db}");
|
||||||
|
@ -66,6 +66,9 @@ class RecurringExpensesCron
|
|||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
|
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
|
||||||
->where('remaining_cycles', '!=', '0')
|
->where('remaining_cycles', '!=', '0')
|
||||||
|
->whereHas('company', function ($query) {
|
||||||
|
$query->where('is_disabled',0);
|
||||||
|
})
|
||||||
->with('company')
|
->with('company')
|
||||||
->cursor();
|
->cursor();
|
||||||
|
|
||||||
|
@ -53,23 +53,27 @@ class RecurringInvoicesCron
|
|||||||
$query->where('is_deleted',0)
|
$query->where('is_deleted',0)
|
||||||
->where('deleted_at', NULL);
|
->where('deleted_at', NULL);
|
||||||
})
|
})
|
||||||
|
->whereHas('company', function ($query) {
|
||||||
|
$query->where('is_disabled',0);
|
||||||
|
})
|
||||||
->with('company')
|
->with('company')
|
||||||
->cursor();
|
->cursor();
|
||||||
|
|
||||||
nlog(now()->format('Y-m-d') . ' Sending Recurring Invoices. Count = '.$recurring_invoices->count());
|
nlog(now()->format('Y-m-d') . ' Sending Recurring Invoices. Count = '.$recurring_invoices->count());
|
||||||
|
|
||||||
$recurring_invoices->each(function ($recurring_invoice, $key) {
|
$recurring_invoices->each(function ($recurring_invoice, $key) {
|
||||||
|
|
||||||
nlog("Current date = " . now()->format("Y-m-d") . " Recurring date = " .$recurring_invoice->next_send_date);
|
nlog("Current date = " . now()->format("Y-m-d") . " Recurring date = " .$recurring_invoice->next_send_date);
|
||||||
|
|
||||||
if (!$recurring_invoice->company->is_disabled) {
|
nlog("Trying to send {$recurring_invoice->number}");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
SendRecurring::dispatchNow($recurring_invoice, $recurring_invoice->company->db);
|
SendRecurring::dispatchNow($recurring_invoice, $recurring_invoice->company->db);
|
||||||
}
|
|
||||||
catch(\Exception $e){
|
|
||||||
nlog("Unable to sending recurring invoice {$recurring_invoice->id}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch(\Exception $e){
|
||||||
|
nlog("Unable to sending recurring invoice {$recurring_invoice->id}");
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//multiDB environment, need to
|
//multiDB environment, need to
|
||||||
@ -86,6 +90,9 @@ class RecurringInvoicesCron
|
|||||||
$query->where('is_deleted',0)
|
$query->where('is_deleted',0)
|
||||||
->where('deleted_at', NULL);
|
->where('deleted_at', NULL);
|
||||||
})
|
})
|
||||||
|
->whereHas('company', function ($query) {
|
||||||
|
$query->where('is_disabled',0);
|
||||||
|
})
|
||||||
->with('company')
|
->with('company')
|
||||||
->cursor();
|
->cursor();
|
||||||
|
|
||||||
@ -94,15 +101,15 @@ class RecurringInvoicesCron
|
|||||||
$recurring_invoices->each(function ($recurring_invoice, $key) {
|
$recurring_invoices->each(function ($recurring_invoice, $key) {
|
||||||
nlog("Current date = " . now()->format("Y-m-d") . " Recurring date = " .$recurring_invoice->next_send_date ." Recurring #id = ". $recurring_invoice->id);
|
nlog("Current date = " . now()->format("Y-m-d") . " Recurring date = " .$recurring_invoice->next_send_date ." Recurring #id = ". $recurring_invoice->id);
|
||||||
|
|
||||||
if (!$recurring_invoice->company->is_disabled) {
|
nlog("Trying to send {$recurring_invoice->number}");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
SendRecurring::dispatchNow($recurring_invoice, $recurring_invoice->company->db);
|
SendRecurring::dispatchNow($recurring_invoice, $recurring_invoice->company->db);
|
||||||
}
|
}
|
||||||
catch(\Exception $e){
|
catch(\Exception $e){
|
||||||
nlog("Unable to sending recurring invoice {$recurring_invoice->id}");
|
nlog("Unable to sending recurring invoice {$recurring_invoice->id}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,11 @@ class SendRecurring implements ShouldQueue
|
|||||||
// Generate Standard Invoice
|
// Generate Standard Invoice
|
||||||
$invoice = RecurringInvoiceToInvoiceFactory::create($this->recurring_invoice, $this->recurring_invoice->client);
|
$invoice = RecurringInvoiceToInvoiceFactory::create($this->recurring_invoice, $this->recurring_invoice->client);
|
||||||
|
|
||||||
|
if($this->recurring_invoice->auto_bill == "always")
|
||||||
|
$invoice->auto_bill_enabled = true;
|
||||||
|
elseif($this->recurring_invoice->auto_bill == "off")
|
||||||
|
$invoice->auto_bill_enabled = false;
|
||||||
|
|
||||||
$invoice->date = now()->format('Y-m-d');
|
$invoice->date = now()->format('Y-m-d');
|
||||||
$invoice->due_date = $this->recurring_invoice->calculateDueDate(now()->format('Y-m-d'));
|
$invoice->due_date = $this->recurring_invoice->calculateDueDate(now()->format('Y-m-d'));
|
||||||
$invoice->recurring_id = $this->recurring_invoice->id;
|
$invoice->recurring_id = $this->recurring_invoice->id;
|
||||||
|
@ -70,6 +70,9 @@ class ReminderJob implements ShouldQueue
|
|||||||
$query->where('is_deleted',0)
|
$query->where('is_deleted',0)
|
||||||
->where('deleted_at', NULL);
|
->where('deleted_at', NULL);
|
||||||
})
|
})
|
||||||
|
->whereHas('company', function ($query) {
|
||||||
|
$query->where('is_disabled',0);
|
||||||
|
})
|
||||||
->with('invitations')->cursor()->each(function ($invoice) {
|
->with('invitations')->cursor()->each(function ($invoice) {
|
||||||
|
|
||||||
if ($invoice->isPayable()) {
|
if ($invoice->isPayable()) {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Libraries;
|
namespace App\Libraries;
|
||||||
|
|
||||||
|
use App\Models\Account;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
@ -178,7 +179,7 @@ class MultiDB
|
|||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
|
|
||||||
foreach (self::$dbs as $db) {
|
foreach (self::$dbs as $db) {
|
||||||
if ($ct = ClientContact::on($db)->whereRaw('BINARY `token`= ?', [$token])->first()) {
|
if (ClientContact::on($db)->whereRaw('BINARY `token`= ?', [$token])->exists()) {
|
||||||
self::setDb($db);
|
self::setDb($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -230,8 +231,8 @@ class MultiDB
|
|||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
|
|
||||||
foreach (self::$dbs as $db) {
|
foreach (self::$dbs as $db) {
|
||||||
if ($ct = CompanyToken::on($db)->whereRaw('BINARY `token`= ?', [$token])->first()) {
|
if (CompanyToken::on($db)->whereRaw('BINARY `token`= ?', [$token])->exists()) {
|
||||||
self::setDb($ct->company->db);
|
self::setDb($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,8 +247,24 @@ class MultiDB
|
|||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
|
|
||||||
foreach (self::$dbs as $db) {
|
foreach (self::$dbs as $db) {
|
||||||
if ($company = Company::on($db)->where('company_key', $company_key)->first()) {
|
if (Company::on($db)->where('company_key', $company_key)->exists()) {
|
||||||
self::setDb($company->db);
|
self::setDb($db);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self::setDB($current_db);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function findAndSetDbByAccountKey($account_key) :bool
|
||||||
|
{
|
||||||
|
$current_db = config('database.default');
|
||||||
|
|
||||||
|
foreach (self::$dbs as $db) {
|
||||||
|
if (Account::on($db)->where('key', $account_key)->exists()) {
|
||||||
|
self::setDb($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,8 +279,8 @@ class MultiDB
|
|||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
|
|
||||||
foreach (self::$dbs as $db) {
|
foreach (self::$dbs as $db) {
|
||||||
if ($client_contact = ClientContact::on($db)->where('contact_key', $contact_key)->first()) {
|
if (ClientContact::on($db)->where('contact_key', $contact_key)->exists()) {
|
||||||
self::setDb($client_contact->company->db);
|
self::setDb($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,8 +295,8 @@ class MultiDB
|
|||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
|
|
||||||
foreach (self::$dbs as $db) {
|
foreach (self::$dbs as $db) {
|
||||||
if ($client = Client::on($db)->where('client_hash', $client_hash)->first()) {
|
if (Client::on($db)->where('client_hash', $client_hash)->exists()) {
|
||||||
self::setDb($client->company->db);
|
self::setDb($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +316,7 @@ class MultiDB
|
|||||||
|
|
||||||
foreach (self::$dbs as $db) {
|
foreach (self::$dbs as $db) {
|
||||||
if ($company = Company::on($db)->where($query_array)->first()) {
|
if ($company = Company::on($db)->where($query_array)->first()) {
|
||||||
self::setDb($company->db);
|
self::setDb($db);
|
||||||
return $company;
|
return $company;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,7 +332,7 @@ class MultiDB
|
|||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
|
|
||||||
foreach (self::$dbs as $db) {
|
foreach (self::$dbs as $db) {
|
||||||
if ($invite = $class::on($db)->whereRaw('BINARY `key`= ?', [$invitation_key])->first()) {
|
if ($invite = $class::on($db)->whereRaw('BINARY `key`= ?', [$invitation_key])->exists()) {
|
||||||
self::setDb($db);
|
self::setDb($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class SupportMessageSent extends Mailable
|
|||||||
$db = str_replace("db-ninja-", "", $company->db);
|
$db = str_replace("db-ninja-", "", $company->db);
|
||||||
$is_large = $company->is_large ? "L" : "S";
|
$is_large = $company->is_large ? "L" : "S";
|
||||||
$platform = array_key_exists('platform', $this->data) ? $this->data['platform'] : "U";
|
$platform = array_key_exists('platform', $this->data) ? $this->data['platform'] : "U";
|
||||||
$migrated = strlen($company->company_key) == 32 ? "M" : "";
|
$migrated = strlen($company->company_key) == 32 ? "M" : "T";
|
||||||
|
|
||||||
if(Ninja::isHosted())
|
if(Ninja::isHosted())
|
||||||
$subject = "{$priority}Hosted-{$db}-{$is_large}{$platform}{$migrated} :: {$plan} :: ".date('M jS, g:ia');
|
$subject = "{$priority}Hosted-{$db}-{$is_large}{$platform}{$migrated} :: {$plan} :: ".date('M jS, g:ia');
|
||||||
|
@ -34,6 +34,8 @@ class InvoiceObserver
|
|||||||
->where('event_id', Webhook::EVENT_CREATE_INVOICE)
|
->where('event_id', Webhook::EVENT_CREATE_INVOICE)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
|
$invoice->load('client');
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_INVOICE, $invoice, $invoice->company);
|
WebhookHandler::dispatch(Webhook::EVENT_CREATE_INVOICE, $invoice, $invoice->company);
|
||||||
}
|
}
|
||||||
@ -51,6 +53,9 @@ class InvoiceObserver
|
|||||||
->where('event_id', Webhook::EVENT_UPDATE_INVOICE)
|
->where('event_id', Webhook::EVENT_UPDATE_INVOICE)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
|
$invoice->load('client');
|
||||||
|
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company);
|
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ class QuoteObserver
|
|||||||
->where('event_id', Webhook::EVENT_CREATE_QUOTE)
|
->where('event_id', Webhook::EVENT_CREATE_QUOTE)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
|
$quote->load('client');
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company);
|
WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company);
|
||||||
}
|
}
|
||||||
@ -47,6 +49,9 @@ class QuoteObserver
|
|||||||
->where('event_id', Webhook::EVENT_UPDATE_QUOTE)
|
->where('event_id', Webhook::EVENT_UPDATE_QUOTE)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
|
$quote->load('client');
|
||||||
|
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company);
|
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company);
|
||||||
}
|
}
|
||||||
|
@ -270,6 +270,10 @@ class CreditCard
|
|||||||
if ($api_response->isSuccess()) {
|
if ($api_response->isSuccess()) {
|
||||||
$customers = $api_response->getBody();
|
$customers = $api_response->getBody();
|
||||||
$customers = json_decode($customers);
|
$customers = json_decode($customers);
|
||||||
|
|
||||||
|
if(count(array($api_response->getBody(),1)) == 0)
|
||||||
|
$customers = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$errors = $api_response->getErrors();
|
$errors = $api_response->getErrors();
|
||||||
}
|
}
|
||||||
|
@ -60,12 +60,16 @@ class ACH
|
|||||||
'method' => '1',
|
'method' => '1',
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$response = $this->wepay_payment_driver->wepay->request('payment_bank/persist', [
|
try{
|
||||||
'client_id' => config('ninja.wepay.client_id'),
|
$response = $this->wepay_payment_driver->wepay->request('payment_bank/persist', [
|
||||||
'client_secret' => config('ninja.wepay.client_secret'),
|
'client_id' => config('ninja.wepay.client_id'),
|
||||||
'payment_bank_id' => (int)$data['bank_account_id'],
|
'client_secret' => config('ninja.wepay.client_secret'),
|
||||||
]);
|
'payment_bank_id' => (int)$data['bank_account_id'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
catch(\Exception $e){
|
||||||
|
throw new PaymentFailed($e->getMessage(), 400);
|
||||||
|
}
|
||||||
// display the response
|
// display the response
|
||||||
// nlog($response);
|
// nlog($response);
|
||||||
|
|
||||||
@ -202,26 +206,31 @@ class ACH
|
|||||||
|
|
||||||
$app_fee = (config('ninja.wepay.fee_ach_multiplier') * $this->wepay_payment_driver->payment_hash->data->amount_with_fee) + config('ninja.wepay.fee_fixed');
|
$app_fee = (config('ninja.wepay.fee_ach_multiplier') * $this->wepay_payment_driver->payment_hash->data->amount_with_fee) + config('ninja.wepay.fee_fixed');
|
||||||
|
|
||||||
$response = $this->wepay_payment_driver->wepay->request('checkout/create', array(
|
try{
|
||||||
// 'callback_uri' => route('payment_webhook', ['company_key' => $this->wepay_payment_driver->company_gateway->company->company_key, 'company_gateway_id' => $this->wepay_payment_driver->company_gateway->hashed_id]),
|
$response = $this->wepay_payment_driver->wepay->request('checkout/create', array(
|
||||||
'unique_id' => Str::random(40),
|
// 'callback_uri' => route('payment_webhook', ['company_key' => $this->wepay_payment_driver->company_gateway->company->company_key, 'company_gateway_id' => $this->wepay_payment_driver->company_gateway->hashed_id]),
|
||||||
'account_id' => $this->wepay_payment_driver->company_gateway->getConfigField('accountId'),
|
'unique_id' => Str::random(40),
|
||||||
'amount' => $this->wepay_payment_driver->payment_hash->data->amount_with_fee,
|
'account_id' => $this->wepay_payment_driver->company_gateway->getConfigField('accountId'),
|
||||||
'currency' => $this->wepay_payment_driver->client->getCurrencyCode(),
|
'amount' => $this->wepay_payment_driver->payment_hash->data->amount_with_fee,
|
||||||
'short_description' => 'Goods and Services',
|
'currency' => $this->wepay_payment_driver->client->getCurrencyCode(),
|
||||||
'type' => 'goods',
|
'short_description' => 'Goods and Services',
|
||||||
'fee' => [
|
'type' => 'goods',
|
||||||
'fee_payer' => config('ninja.wepay.fee_payer'),
|
'fee' => [
|
||||||
'app_fee' => $app_fee,
|
'fee_payer' => config('ninja.wepay.fee_payer'),
|
||||||
],
|
'app_fee' => $app_fee,
|
||||||
'payment_method' => array(
|
],
|
||||||
'type' => 'payment_bank',
|
'payment_method' => array(
|
||||||
'payment_bank' => array(
|
'type' => 'payment_bank',
|
||||||
'id' => $token->token
|
'payment_bank' => array(
|
||||||
|
'id' => $token->token
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
));
|
||||||
));
|
}
|
||||||
|
catch(\Exception $e){
|
||||||
|
throw new PaymentFailed($e->getMessage(), 500);
|
||||||
|
}
|
||||||
|
|
||||||
/* Merge all data and store in the payment hash*/
|
/* Merge all data and store in the payment hash*/
|
||||||
$state = [
|
$state = [
|
||||||
'server_response' => $response,
|
'server_response' => $response,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user