mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 01:44:33 -04:00
Add reactivate email paths for PostMark
This commit is contained in:
parent
40b56a7133
commit
daf66943d4
@ -14,6 +14,7 @@ namespace App\Http\Controllers;
|
|||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
|
use Postmark\PostmarkClient;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use App\Factory\ClientFactory;
|
use App\Factory\ClientFactory;
|
||||||
use App\Filters\ClientFilters;
|
use App\Filters\ClientFilters;
|
||||||
@ -36,6 +37,7 @@ use App\Http\Requests\Client\CreateClientRequest;
|
|||||||
use App\Http\Requests\Client\UpdateClientRequest;
|
use App\Http\Requests\Client\UpdateClientRequest;
|
||||||
use App\Http\Requests\Client\UploadClientRequest;
|
use App\Http\Requests\Client\UploadClientRequest;
|
||||||
use App\Http\Requests\Client\DestroyClientRequest;
|
use App\Http\Requests\Client\DestroyClientRequest;
|
||||||
|
use App\Http\Requests\Client\ReactivateClientEmailRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ClientController.
|
* Class ClientController.
|
||||||
@ -313,4 +315,31 @@ class ClientController extends BaseController
|
|||||||
|
|
||||||
return $this->itemResponse($client->fresh());
|
return $this->itemResponse($client->fresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reactivate a client email
|
||||||
|
*
|
||||||
|
* @param ReactivateClientEmailRequest $request
|
||||||
|
* @param string $bounce_id
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function reactivateEmail(ReactivateClientEmailRequest $request, string $bounce_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$postmark = new PostmarkClient(config('services.postmark.token'));
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$response = $postmark->activateBounce((int)$bounce_id);
|
||||||
|
|
||||||
|
return response()->json(['message' => 'Success'], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(\Exception $e){
|
||||||
|
|
||||||
|
return response()->json(['message' => $e->getMessage(), 400]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,6 +356,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
|
|||||||
$events = collect($messageDetail->messageevents)->map(function ($event) {
|
$events = collect($messageDetail->messageevents)->map(function ($event) {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'bounce_id' => $event?->Details?->BounceID ?? '',
|
||||||
'recipient' => $event->Recipient ?? '',
|
'recipient' => $event->Recipient ?? '',
|
||||||
'status' => $event->Type ?? '',
|
'status' => $event->Type ?? '',
|
||||||
'delivery_message' => $event->Details->DeliveryMessage ?? $event->Details->Summary ?? '',
|
'delivery_message' => $event->Details->DeliveryMessage ?? $event->Details->Summary ?? '',
|
||||||
|
@ -306,7 +306,10 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
return $this->hasMany(ClientContact::class)->where('is_primary', true);
|
return $this->hasMany(ClientContact::class)->where('is_primary', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function company() :BelongsTo
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
|
*/
|
||||||
|
public function company()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Company::class);
|
return $this->belongsTo(Company::class);
|
||||||
}
|
}
|
||||||
|
13076
openapi/api-docs.yaml
13076
openapi/api-docs.yaml
File diff suppressed because it is too large
Load Diff
@ -653,5 +653,91 @@
|
|||||||
$ref: '#/components/responses/429'
|
$ref: '#/components/responses/429'
|
||||||
5XX:
|
5XX:
|
||||||
description: 'Server error'
|
description: 'Server error'
|
||||||
|
default:
|
||||||
|
$ref: '#/components/responses/default'
|
||||||
|
/api/v1/reactivate_email/{bounce_id}:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- clients
|
||||||
|
summary: 'Removes email suppression of a user in the system'
|
||||||
|
description: 'Emails are suppressed by PostMark, when they receive a Hard bounce / Spam Complaint. This endpoint allows you to remove the suppression and send emails to the user again.'
|
||||||
|
operationId: reactivateEmail
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/X-API-TOKEN'
|
||||||
|
- $ref: '#/components/parameters/X-Requested-With'
|
||||||
|
- $ref: '#/components/parameters/include'
|
||||||
|
- name: bounce_id
|
||||||
|
in: path
|
||||||
|
description: 'The postmark Bounce ID reference'
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: string
|
||||||
|
example: 123243
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: 'Success'
|
||||||
|
headers:
|
||||||
|
X-MINIMUM-CLIENT-VERSION:
|
||||||
|
$ref: '#/components/headers/X-MINIMUM-CLIENT-VERSION'
|
||||||
|
X-RateLimit-Remaining:
|
||||||
|
$ref: '#/components/headers/X-RateLimit-Remaining'
|
||||||
|
X-RateLimit-Limit:
|
||||||
|
$ref: '#/components/headers/X-RateLimit-Limit'
|
||||||
|
400:
|
||||||
|
description: 'Postmark exception - generated if the suppression cannot be removed for any reason'
|
||||||
|
401:
|
||||||
|
$ref: '#/components/responses/401'
|
||||||
|
403:
|
||||||
|
$ref: '#/components/responses/403'
|
||||||
|
422:
|
||||||
|
$ref: '#/components/responses/422'
|
||||||
|
429:
|
||||||
|
$ref: '#/components/responses/429'
|
||||||
|
5XX:
|
||||||
|
description: 'Server error'
|
||||||
|
default:
|
||||||
|
$ref: '#/components/responses/default'
|
||||||
|
/api/v1/clients/{client}/updateTaxData:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- clients
|
||||||
|
summary: 'Update tax data'
|
||||||
|
description: 'Updates the clients tax data - if their address has changed'
|
||||||
|
operationId: updateClientTaxData
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/X-API-TOKEN'
|
||||||
|
- $ref: '#/components/parameters/X-Requested-With'
|
||||||
|
- $ref: '#/components/parameters/include'
|
||||||
|
- name: client
|
||||||
|
in: path
|
||||||
|
description: 'The Client Hashed ID reference'
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: string
|
||||||
|
example: V2J234DFA
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: 'Success'
|
||||||
|
headers:
|
||||||
|
X-MINIMUM-CLIENT-VERSION:
|
||||||
|
$ref: '#/components/headers/X-MINIMUM-CLIENT-VERSION'
|
||||||
|
X-RateLimit-Remaining:
|
||||||
|
$ref: '#/components/headers/X-RateLimit-Remaining'
|
||||||
|
X-RateLimit-Limit:
|
||||||
|
$ref: '#/components/headers/X-RateLimit-Limit'
|
||||||
|
400:
|
||||||
|
description: 'Postmark exception - generated if the suppression cannot be removed for any reason'
|
||||||
|
401:
|
||||||
|
$ref: '#/components/responses/401'
|
||||||
|
403:
|
||||||
|
$ref: '#/components/responses/403'
|
||||||
|
422:
|
||||||
|
$ref: '#/components/responses/422'
|
||||||
|
429:
|
||||||
|
$ref: '#/components/responses/429'
|
||||||
|
5XX:
|
||||||
|
description: 'Server error'
|
||||||
default:
|
default:
|
||||||
$ref: '#/components/responses/default'
|
$ref: '#/components/responses/default'
|
@ -164,6 +164,8 @@ Route::group(['middleware' => ['throttle:api', 'api_db', 'token_auth', 'locale']
|
|||||||
Route::post('clients/{client}/{mergeable_client}/merge', [ClientController::class, 'merge'])->name('clients.merge')->middleware('password_protected');
|
Route::post('clients/{client}/{mergeable_client}/merge', [ClientController::class, 'merge'])->name('clients.merge')->middleware('password_protected');
|
||||||
Route::post('clients/bulk', [ClientController::class, 'bulk'])->name('clients.bulk');
|
Route::post('clients/bulk', [ClientController::class, 'bulk'])->name('clients.bulk');
|
||||||
|
|
||||||
|
Route::post('reactivate_email/{bounce_id}', [ClientController::class, 'reactivateEmail'])->name('clients.reactivate_email');
|
||||||
|
|
||||||
Route::post('filters/{entity}', [FilterController::class, 'index'])->name('filters');
|
Route::post('filters/{entity}', [FilterController::class, 'index'])->name('filters');
|
||||||
|
|
||||||
Route::resource('client_gateway_tokens', ClientGatewayTokenController::class);
|
Route::resource('client_gateway_tokens', ClientGatewayTokenController::class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user