@@ -48,7 +48,7 @@ abstract class AbstractIdentifyMethod implements IIdentifyMethod {
48
48
*/
49
49
protected array $ signatureMethods = [];
50
50
public function __construct (
51
- protected IdentifyMethodService $ identifyMethodService ,
51
+ protected IdentifyService $ identifyService ,
52
52
) {
53
53
$ className = (new \ReflectionClass ($ this ))->getShortName ();
54
54
$ this ->name = lcfirst ($ className );
@@ -107,9 +107,9 @@ public function notify(): bool {
107
107
if (!$ this ->willNotify ) {
108
108
return false ;
109
109
}
110
- $ signRequest = $ this ->identifyMethodService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
111
- $ libresignFile = $ this ->identifyMethodService ->getFileMapper ()->getById ($ signRequest ->getFileId ());
112
- $ this ->identifyMethodService ->getEventDispatcher ()->dispatchTyped (new SendSignNotificationEvent (
110
+ $ signRequest = $ this ->identifyService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
111
+ $ libresignFile = $ this ->identifyService ->getFileMapper ()->getById ($ signRequest ->getFileId ());
112
+ $ this ->identifyService ->getEventDispatcher ()->dispatchTyped (new SendSignNotificationEvent (
113
113
$ signRequest ,
114
114
$ libresignFile ,
115
115
$ this
@@ -131,35 +131,35 @@ public function validateToIdentify(): void {
131
131
}
132
132
133
133
protected function throwIfFileNotFound (): void {
134
- $ signRequest = $ this ->identifyMethodService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
135
- $ fileEntity = $ this ->identifyMethodService ->getFileMapper ()->getById ($ signRequest ->getFileId ());
134
+ $ signRequest = $ this ->identifyService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
135
+ $ fileEntity = $ this ->identifyService ->getFileMapper ()->getById ($ signRequest ->getFileId ());
136
136
137
137
$ nodeId = $ fileEntity ->getNodeId ();
138
138
139
- $ mountsContainingFile = $ this ->identifyMethodService ->getUserMountCache ()->getMountsForFileId ($ nodeId );
139
+ $ mountsContainingFile = $ this ->identifyService ->getUserMountCache ()->getMountsForFileId ($ nodeId );
140
140
foreach ($ mountsContainingFile as $ fileInfo ) {
141
- $ this ->identifyMethodService ->getRootFolder ()->getByIdInPath ($ nodeId , $ fileInfo ->getMountPoint ());
141
+ $ this ->identifyService ->getRootFolder ()->getByIdInPath ($ nodeId , $ fileInfo ->getMountPoint ());
142
142
}
143
- $ fileToSign = $ this ->identifyMethodService ->getRootFolder ()->getById ($ nodeId );
143
+ $ fileToSign = $ this ->identifyService ->getRootFolder ()->getById ($ nodeId );
144
144
if (count ($ fileToSign ) < 1 ) {
145
145
throw new LibresignException (json_encode ([
146
146
'action ' => JSActions::ACTION_DO_NOTHING ,
147
- 'errors ' => [$ this ->identifyMethodService ->getL10n ()->t ('File not found ' )],
147
+ 'errors ' => [$ this ->identifyService ->getL10n ()->t ('File not found ' )],
148
148
]));
149
149
}
150
150
}
151
151
152
152
protected function throwIfMaximumValidityExpired (): void {
153
- $ maximumValidity = (int ) $ this ->identifyMethodService ->getAppConfig ()->getAppValue ('maximum_validity ' , (string ) SessionService::NO_MAXIMUM_VALIDITY );
153
+ $ maximumValidity = (int ) $ this ->identifyService ->getAppConfig ()->getAppValue ('maximum_validity ' , (string ) SessionService::NO_MAXIMUM_VALIDITY );
154
154
if ($ maximumValidity <= 0 ) {
155
155
return ;
156
156
}
157
- $ signRequest = $ this ->identifyMethodService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
158
- $ now = $ this ->identifyMethodService ->getTimeFactory ()->getTime ();
157
+ $ signRequest = $ this ->identifyService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
158
+ $ now = $ this ->identifyService ->getTimeFactory ()->getTime ();
159
159
if ($ signRequest ->getCreatedAt () + $ maximumValidity < $ now ) {
160
160
throw new LibresignException (json_encode ([
161
161
'action ' => JSActions::ACTION_DO_NOTHING ,
162
- 'errors ' => [$ this ->identifyMethodService ->getL10n ()->t ('Link expired. ' )],
162
+ 'errors ' => [$ this ->identifyService ->getL10n ()->t ('Link expired. ' )],
163
163
]));
164
164
}
165
165
}
@@ -168,46 +168,46 @@ protected function throwIfInvalidToken(): void {
168
168
if (empty ($ this ->codeSentByUser )) {
169
169
return ;
170
170
}
171
- if (!$ this ->identifyMethodService ->getHasher ()->verify ($ this ->codeSentByUser , $ this ->getEntity ()->getCode ())) {
172
- throw new LibresignException ($ this ->identifyMethodService ->getL10n ()->t ('Invalid code. ' ));
171
+ if (!$ this ->identifyService ->getHasher ()->verify ($ this ->codeSentByUser , $ this ->getEntity ()->getCode ())) {
172
+ throw new LibresignException ($ this ->identifyService ->getL10n ()->t ('Invalid code. ' ));
173
173
}
174
174
}
175
175
176
176
protected function renewSession (): void {
177
- $ this ->identifyMethodService ->getSessionService ()->setIdentifyMethodId ($ this ->getEntity ()->getId ());
178
- $ renewalInterval = (int ) $ this ->identifyMethodService ->getAppConfig ()->getAppValue ('renewal_interval ' , (string ) SessionService::NO_RENEWAL_INTERVAL );
177
+ $ this ->identifyService ->getSessionService ()->setIdentifyMethodId ($ this ->getEntity ()->getId ());
178
+ $ renewalInterval = (int ) $ this ->identifyService ->getAppConfig ()->getAppValue ('renewal_interval ' , (string ) SessionService::NO_RENEWAL_INTERVAL );
179
179
if ($ renewalInterval <= 0 ) {
180
180
return ;
181
181
}
182
- $ this ->identifyMethodService ->getSessionService ()->resetDurationOfSignPage ();
182
+ $ this ->identifyService ->getSessionService ()->resetDurationOfSignPage ();
183
183
}
184
184
185
185
protected function updateIdentifiedAt (): void {
186
186
if ($ this ->getEntity ()->getCode () && !$ this ->getEntity ()->getIdentifiedAtDate ()) {
187
187
return ;
188
188
}
189
- $ this ->getEntity ()->setIdentifiedAtDate ($ this ->identifyMethodService ->getTimeFactory ()->getDateTime ());
189
+ $ this ->getEntity ()->setIdentifiedAtDate ($ this ->identifyService ->getTimeFactory ()->getDateTime ());
190
190
$ this ->willNotify = false ;
191
- $ this ->identifyMethodService ->save ($ this ->getEntity ());
191
+ $ this ->identifyService ->save ($ this ->getEntity ());
192
192
$ this ->notify ();
193
193
}
194
194
195
195
protected function throwIfRenewalIntervalExpired (): void {
196
- $ renewalInterval = (int ) $ this ->identifyMethodService ->getAppConfig ()->getAppValue ('renewal_interval ' , (string ) SessionService::NO_RENEWAL_INTERVAL );
196
+ $ renewalInterval = (int ) $ this ->identifyService ->getAppConfig ()->getAppValue ('renewal_interval ' , (string ) SessionService::NO_RENEWAL_INTERVAL );
197
197
if ($ renewalInterval <= 0 ) {
198
198
return ;
199
199
}
200
- $ signRequest = $ this ->identifyMethodService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
201
- $ startTime = $ this ->identifyMethodService ->getSessionService ()->getSignStartTime ();
200
+ $ signRequest = $ this ->identifyService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
201
+ $ startTime = $ this ->identifyService ->getSessionService ()->getSignStartTime ();
202
202
$ createdAt = $ signRequest ->getCreatedAt ();
203
203
$ lastAttempt = $ this ->getEntity ()->getLastAttemptDate ()?->format('U ' );
204
204
$ lastActionDate = max (
205
205
$ startTime ,
206
206
$ createdAt ,
207
207
$ lastAttempt ,
208
208
);
209
- $ now = $ this ->identifyMethodService ->getTimeFactory ()->getTime ();
210
- $ this ->identifyMethodService ->getLogger ()->debug ('AbstractIdentifyMethod::throwIfRenewalIntervalExpired Times ' , [
209
+ $ now = $ this ->identifyService ->getTimeFactory ()->getTime ();
210
+ $ this ->identifyService ->getLogger ()->debug ('AbstractIdentifyMethod::throwIfRenewalIntervalExpired Times ' , [
211
211
'renewalInterval ' => $ renewalInterval ,
212
212
'startTime ' => $ startTime ,
213
213
'createdAt ' => $ createdAt ,
@@ -216,13 +216,13 @@ protected function throwIfRenewalIntervalExpired(): void {
216
216
'now ' => $ now ,
217
217
]);
218
218
if ($ lastActionDate + $ renewalInterval < $ now ) {
219
- $ this ->identifyMethodService ->getLogger ()->debug ('AbstractIdentifyMethod::throwIfRenewalIntervalExpired Exception ' );
219
+ $ this ->identifyService ->getLogger ()->debug ('AbstractIdentifyMethod::throwIfRenewalIntervalExpired Exception ' );
220
220
$ blur = new Blur ($ this ->getEntity ()->getIdentifierValue ());
221
221
throw new LibresignException (json_encode ([
222
222
'action ' => $ this ->getRenewAction (),
223
223
// TRANSLATORS title that is displayed at screen to notify the signer that the link to sign the document expired
224
- 'title ' => $ this ->identifyMethodService ->getL10n ()->t ('Link expired ' ),
225
- 'body ' => $ this ->identifyMethodService ->getL10n ()->t (<<<'BODY'
224
+ 'title ' => $ this ->identifyService ->getL10n ()->t ('Link expired ' ),
225
+ 'body ' => $ this ->identifyService ->getL10n ()->t (<<<'BODY'
226
226
The link to sign the document has expired.
227
227
We will send a new link to the email %1$s.
228
228
Click below to receive the new link and be able to sign the document.
@@ -231,7 +231,7 @@ protected function throwIfRenewalIntervalExpired(): void {
231
231
),
232
232
'uuid ' => $ signRequest ->getUuid (),
233
233
// TRANSLATORS Button to renew the link to sign the document. Renew is the action to generate a new sign link when the link expired.
234
- 'renewButton ' => $ this ->identifyMethodService ->getL10n ()->t ('Renew ' ),
234
+ 'renewButton ' => $ this ->identifyService ->getL10n ()->t ('Renew ' ),
235
235
]));
236
236
}
237
237
}
@@ -245,15 +245,15 @@ private function getRenewAction(): int {
245
245
}
246
246
247
247
protected function throwIfAlreadySigned (): void {
248
- $ signRequest = $ this ->identifyMethodService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
249
- $ fileEntity = $ this ->identifyMethodService ->getFileMapper ()->getById ($ signRequest ->getFileId ());
248
+ $ signRequest = $ this ->identifyService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
249
+ $ fileEntity = $ this ->identifyService ->getFileMapper ()->getById ($ signRequest ->getFileId ());
250
250
if ($ fileEntity ->getStatus () === FileEntity::STATUS_SIGNED
251
251
|| (!is_null ($ signRequest ) && $ signRequest ->getSigned ())
252
252
) {
253
253
throw new LibresignException (json_encode ([
254
254
'action ' => JSActions::ACTION_REDIRECT ,
255
- 'errors ' => [$ this ->identifyMethodService ->getL10n ()->t ('File already signed. ' )],
256
- 'redirect ' => $ this ->identifyMethodService ->getUrlGenerator ()->linkToRoute (
255
+ 'errors ' => [$ this ->identifyService ->getL10n ()->t ('File already signed. ' )],
256
+ 'redirect ' => $ this ->identifyService ->getUrlGenerator ()->linkToRoute (
257
257
'libresign.page.validationFile ' ,
258
258
['uuid ' => $ signRequest ->getUuid ()]
259
259
),
@@ -287,7 +287,7 @@ private function overrideImmutable(array $immutable): void {
287
287
}
288
288
289
289
private function loadSavedSettings (): void {
290
- $ config = $ this ->identifyMethodService ->getSavedSettings ();
290
+ $ config = $ this ->identifyService ->getSavedSettings ();
291
291
$ this ->settings = array_reduce ($ config , function ($ carry , $ config ) {
292
292
if ($ config ['name ' ] === $ this ->name ) {
293
293
return $ config ;
@@ -319,12 +319,12 @@ private function applyDefault(array $customConfig, array $default): array {
319
319
}
320
320
321
321
public function save (): void {
322
- $ this ->identifyMethodService ->save ($ this ->getEntity ());
322
+ $ this ->identifyService ->save ($ this ->getEntity ());
323
323
$ this ->notify ();
324
324
}
325
325
326
326
public function delete (): void {
327
- $ this ->identifyMethodService ->delete ($ this ->getEntity ());
327
+ $ this ->identifyService ->delete ($ this ->getEntity ());
328
328
}
329
329
330
330
private function removeKeysThatDontExists (array $ default ): void {
0 commit comments