Merge pull request #6499 from turbo124/v5-develop

v5.3.0
This commit is contained in:
David Bomba 2021-08-21 20:32:52 +10:00 committed by GitHub
commit 2bd839c06d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 55 additions and 6 deletions

View File

@ -1 +1 @@
5.2.19
5.3.0

View File

@ -403,11 +403,18 @@ class Import implements ShouldQueue
$company_repository->save($data, $this->company);
if (isset($data['settings']->company_logo) && strlen($data['settings']->company_logo) > 0) {
try {
$tempImage = tempnam(sys_get_temp_dir(), basename($data['settings']->company_logo));
copy($data['settings']->company_logo, $tempImage);
$this->uploadLogo($tempImage, $this->company, $this->company);
} catch (\Exception $e) {
$settings = $this->company->settings;
$settings->company_logo = '';
$this->company->settings = $settings;
$this->company->save();
}
}
@ -705,6 +712,7 @@ class Import implements ShouldQueue
$modified = $resource;
$modified['company_id'] = $this->company->id;
$modified['user_id'] = $this->processUserId($resource);
$modified['number'] = $this->checkUniqueConstraint(Vendor::class, 'number', $modified['number']);
unset($modified['id']);
unset($modified['contacts']);

View File

@ -184,8 +184,12 @@ class ReminderJob implements ShouldQueue
$invoice->fresh();
$invoice->service()->deletePdf();
/* Refresh the client here to ensure the balance is fresh */
$client = $invoice->client;
$client = $client->fresh();
nlog("adjusting client balance and invoice balance by ". ($invoice->balance - $temp_invoice_balance));
$invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save();
$client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save();
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
return $invoice;

View File

@ -61,7 +61,7 @@ class ACH
try {
$source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth);
// $source = $this->stripe->stripe->customers->createSource($customer->id, ['source' => $stripe_response->token->id]);
} catch (InvalidRequestException $e) {
throw new PaymentFailed($e->getMessage(), $e->getCode());
}

View File

@ -142,6 +142,32 @@ class ImportCustomers
$this->update_payment_methods->updateMethods($customer, $client);
}
public function importCustomer($customer_id)
{
$this->stripe->init();
$this->update_payment_methods = new UpdatePaymentMethods($this->stripe);
if(strlen($this->stripe->company_gateway->getConfigField('account_id')) < 1)
throw new StripeConnectFailure('Stripe Connect has not been configured');
$customer = Customer::retrieve($customer_id, $this->stripe_connect_auth);
if(!$customer)
return;
foreach($this->stripe->company_gateway->company->clients as $client)
{
if($client->present()->email() == $customer->email) {
$this->update_payment_methods->updateMethods($customer, $client);
}
}
}
public function match()
{
$this->stripe->init();

View File

@ -93,6 +93,12 @@ class UpdatePaymentMethods
$this->addOrUpdateCard($method, $customer->id, $client, GatewayType::SOFORT);
}
//$this->importBankAccounts($customer, $client);
}
private function importBankAccounts($customer, $client)
{
}
// private function addOrUpdateBankAccount($bank_account, $customer_reference, Client $client)

View File

@ -550,6 +550,11 @@ class StripePaymentDriver extends BaseDriver
return (new ImportCustomers($this))->match();
}
public function importCustomer($customer_id)
{
return (new ImportCustomers($this))->importCustomer($customer_id);
}
public function verifyConnect()
{
return (new Verify($this))->run();

View File

@ -40,5 +40,6 @@ trait Uploadable
$entity->save();
}
}
}
}

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.2.19',
'app_tag' => '5.2.19',
'app_version' => '5.3.0',
'app_tag' => '5.3.0',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -156,7 +156,6 @@ trait MockAccountData
}
}
$this->account = Account::factory()->create();
$this->company = Company::factory()->create([
'account_id' => $this->account->id,