diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index d9ffe3792038..41e832f03576 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -600,6 +600,7 @@ class CompanySettings extends BaseSettings '$client.city_state_postal', '$client.country', '$contact.email', + '$client.phone', ], 'company_details' => [ '$company.name', diff --git a/app/Jobs/Mail/PaymentFailureMailer.php b/app/Jobs/Mail/PaymentFailureMailer.php index 1fb0f000db5c..bce2f69c3656 100644 --- a/app/Jobs/Mail/PaymentFailureMailer.php +++ b/app/Jobs/Mail/PaymentFailureMailer.php @@ -11,12 +11,12 @@ namespace App\Jobs\Mail; +use App\Jobs\Mail\NinjaMailer; use App\Jobs\Mail\NinjaMailerJob; use App\Jobs\Mail\NinjaMailerObject; use App\Libraries\MultiDB; use App\Mail\Admin\EntityNotificationMailer; use App\Mail\Admin\PaymentFailureObject; -use App\Mail\NinjaMailer; use App\Models\User; use App\Utils\Traits\Notifications\UserNotifies; use Illuminate\Bus\Queueable; diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index 1d33db7e9630..4e7dd9447d55 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -15,7 +15,9 @@ use App\DataMapper\InvoiceItem; use App\Factory\InvoiceFactory; use App\Factory\InvoiceToRecurringInvoiceFactory; use App\Factory\RecurringInvoiceFactory; +use App\Jobs\Util\SubscriptionWebhookHandler; use App\Jobs\Util\SystemLogger; +use App\Models\Client; use App\Models\ClientContact; use App\Models\ClientSubscription; use App\Models\Invoice; @@ -243,38 +245,36 @@ class SubscriptionService 'db' => $this->subscription->company->db, ]); - $headers = [ - 'Content-Type' => 'application/json', - 'X-Requested-With' => 'XMLHttpRequest', - ]; - - //$this->subscription->webhook_configuration['post_purchase_headers'] - - $client = new \GuzzleHttp\Client( - [ - 'headers' => $headers, - ]); + $headers = [ + 'Content-Type' => 'application/json', + 'X-Requested-With' => 'XMLHttpRequest', + ]; - try{ + $client = new \GuzzleHttp\Client( + [ + 'headers' => $headers, + ]); + + try { $response = $client->{$this->subscription->webhook_configuration['post_purchase_rest_method']}($this->subscription->webhook_configuration['post_purchase_url'],[ RequestOptions::JSON => ['body' => $body], RequestOptions::ALLOW_REDIRECTS => false ]); } catch(\Exception $e) { - nlog($e->getMessage()); + } - // $response = $client->post('http://ninja.test:8000/api/admin/plan',[RequestOptions::JSON => ['body' => $body]]); + $client = \App\Models\Client::find($this->decodePrimaryKey($body['client'])); - // SystemLogger::dispatch( - // $body, - // SystemLog::CATEGORY_WEBHOOK, - // SystemLog::EVENT_WEBHOOK_RESPONSE, - // SystemLog::TYPE_WEBHOOK_RESPONSE, - // $this->client_subscription->client, - // ); + SystemLogger::dispatch( + $body, + SystemLog::CATEGORY_WEBHOOK, + SystemLog::EVENT_WEBHOOK_RESPONSE, + SystemLog::TYPE_WEBHOOK_RESPONSE, + $client, + ); } diff --git a/database/migrations/2021_04_05_115345_add_trial_duration_to_accounts_table.php b/database/migrations/2021_04_05_115345_add_trial_duration_to_accounts_table.php new file mode 100644 index 000000000000..bdee046183ca --- /dev/null +++ b/database/migrations/2021_04_05_115345_add_trial_duration_to_accounts_table.php @@ -0,0 +1,30 @@ +unsignedInteger('trial_duration')->nullable(); + }); + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +}