diff --git a/app/Import/Transformer/Csv/VendorTransformer.php b/app/Import/Transformer/Csv/VendorTransformer.php index 97356d9f66e7..fde473da01d7 100644 --- a/app/Import/Transformer/Csv/VendorTransformer.php +++ b/app/Import/Transformer/Csv/VendorTransformer.php @@ -52,17 +52,6 @@ class VendorTransformer extends BaseTransformer 'custom_value2' => $this->getString($data, 'vendor.custom_value2'), 'custom_value3' => $this->getString($data, 'vendor.custom_value3'), 'custom_value4' => $this->getString($data, 'vendor.custom_value4'), - // 'vendor_contacts' => [ - // [ - // 'first_name' => $this->getString( - // $data, - // 'vendor.first_name' - // ), - // 'last_name' => $this->getString($data, 'vendor.last_name'), - // 'email' => $this->getString($data, 'vendor.email'), - // 'phone' => $this->getString($data, 'vendor.phone'), - // ], - // ], 'contacts' => [ [ 'first_name' => $this->getString( @@ -70,7 +59,7 @@ class VendorTransformer extends BaseTransformer 'contact.first_name' ), 'last_name' => $this->getString($data, 'contact.last_name'), - 'email' => $this->getString($data, 'contact.email'), + 'email' => strlen($this->getString($data, 'contact.email')) > 1 ? $this->getString($data, 'contact.email') : $this->getString($data, 'vendor.email'), 'phone' => $this->getString($data, 'contact.phone'), 'custom_value1' => $this->getString( $data, diff --git a/app/Listeners/Subscription/AppStoreRenewSubscription.php b/app/Listeners/Subscription/AppStoreRenewSubscription.php index 456929d4f2d5..958fd62929de 100644 --- a/app/Listeners/Subscription/AppStoreRenewSubscription.php +++ b/app/Listeners/Subscription/AppStoreRenewSubscription.php @@ -13,6 +13,8 @@ namespace App\Listeners\Subscription; use App\Libraries\MultiDB; use App\Models\Account; +use App\Models\Company; +use App\Notifications\Ninja\RenewalFailureNotification; use Illuminate\Contracts\Queue\ShouldQueue; use Imdhemy\Purchases\Events\AppStore\DidRenew; @@ -44,6 +46,12 @@ class AppStoreRenewSubscription implements ShouldQueue $account = Account::where('inapp_transaction_id', $inapp_transaction_id)->first(); + if(!$account) { + $ninja_company = Company::on('db-ninja-01')->find(config('ninja.ninja_default_company_id')); + $ninja_company->notification(new RenewalFailureNotification("{$inapp_transaction_id}"))->ninja(); + return; + } + if($account->plan_term == 'month') $account->plan_expires = now()->addMonth(); elseif($account->plan_term == 'year') diff --git a/app/Notifications/Ninja/RenewalFailureNotification.php b/app/Notifications/Ninja/RenewalFailureNotification.php index 87bd1bd3ee06..5dbbbe8a6d05 100644 --- a/app/Notifications/Ninja/RenewalFailureNotification.php +++ b/app/Notifications/Ninja/RenewalFailureNotification.php @@ -68,7 +68,7 @@ class RenewalFailureNotification extends Notification public function toSlack($notifiable) { $content = "Plan paid, account not updated\n"; - $content .= "Contact: {$this->notification_message}"; + $content .= "Contact/Inapp Purchase: {$this->notification_message}"; return (new SlackMessage) ->success()