mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Fixes for hosted
This commit is contained in:
parent
3a71147843
commit
34759822f5
@ -118,14 +118,14 @@ class RotessaPaymentDriver extends BaseDriver
|
|||||||
public function importCustomers() {
|
public function importCustomers() {
|
||||||
$this->init();
|
$this->init();
|
||||||
try {
|
try {
|
||||||
if(!$result = Cache::has('rotessa-import_customers')) {
|
if(!$result = Cache::has("rotessa-import_customers-{$this->company_gateway->company->company_key}")) {
|
||||||
$result = $this->gateway->getCustomers()->send();
|
$result = $this->gateway->getCustomers()->send();
|
||||||
if(!$result->isSuccessful()) throw new \Exception($result->getMessage(), (int) $result->getCode());
|
if(!$result->isSuccessful()) throw new \Exception($result->getMessage(), (int) $result->getCode());
|
||||||
// cache results
|
// cache results
|
||||||
Cache::put('rotessa-import_customers', $result->getData(), 60 * 60 * 24);
|
Cache::put("rotessa-import_customers-{$this->company_gateway->company->company_key}", $result->getData(), 60 * 60 * 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Cache::get('rotessa-import_customers');
|
$result = Cache::get("rotessa-import_customers-{$this->company_gateway->company->company_key}");
|
||||||
$customers = collect($result)->unique('email');
|
$customers = collect($result)->unique('email');
|
||||||
$client_emails = $customers->pluck('email')->all();
|
$client_emails = $customers->pluck('email')->all();
|
||||||
$company_id = $this->company_gateway->company->id;
|
$company_id = $this->company_gateway->company->id;
|
||||||
@ -200,7 +200,9 @@ class RotessaPaymentDriver extends BaseDriver
|
|||||||
"first_name" => substr($customer->name, 0, stripos($customer->name, " ")),
|
"first_name" => substr($customer->name, 0, stripos($customer->name, " ")),
|
||||||
"last_name" => substr($customer->name, stripos($customer->name, " ")),
|
"last_name" => substr($customer->name, stripos($customer->name, " ")),
|
||||||
"email" => $customer->email,
|
"email" => $customer->email,
|
||||||
"phone" => $customer->phone
|
"phone" => $customer->phone,
|
||||||
|
"is_primary" => true,
|
||||||
|
"send_email" => true,
|
||||||
]);
|
]);
|
||||||
$client->contacts()->saveMany([$contact]);
|
$client->contacts()->saveMany([$contact]);
|
||||||
$contact = $client->contacts()->first();
|
$contact = $client->contacts()->first();
|
||||||
|
Loading…
Reference in New Issue
Block a user