Minor fixes for pdfmock
This commit is contained in:
parent
366b9fb118
commit
d7c03afb0c
|
|
@ -40,20 +40,20 @@ class EmailPreferencesController extends Controller
|
||||||
$class = "\\App\\Models\\" . ucfirst(Str::camel($entity)) . 'Invitation';
|
$class = "\\App\\Models\\" . ucfirst(Str::camel($entity)) . 'Invitation';
|
||||||
$invitation = $class::withTrashed()->where('key', $invitation_key)->firstOrFail();
|
$invitation = $class::withTrashed()->where('key', $invitation_key)->firstOrFail();
|
||||||
|
|
||||||
$invitation->contact->is_locked = $request->action === 'unsubscribe' ? true : false;
|
// $invitation->contact->is_locked = $request->action === 'unsubscribe' ? true : false;
|
||||||
$invitation->contact->push();
|
// $invitation->contact->push();
|
||||||
|
|
||||||
if ($invitation->contact->is_locked && !Cache::has("unsubscribe_notification_suppression:{$invitation_key}")) {
|
// if ($invitation->contact->is_locked && !Cache::has("unsubscribe_notification_suppression:{$invitation_key}")) {
|
||||||
$nmo = new NinjaMailerObject();
|
// $nmo = new NinjaMailerObject();
|
||||||
$nmo->mailable = new NinjaMailer((new ClientUnsubscribedObject($invitation->contact, $invitation->contact->company, true))->build());
|
// $nmo->mailable = new NinjaMailer((new ClientUnsubscribedObject($invitation->contact, $invitation->contact->company, true))->build());
|
||||||
$nmo->company = $invitation->contact->company;
|
// $nmo->company = $invitation->contact->company;
|
||||||
$nmo->to_user = $invitation->contact->company->owner();
|
// $nmo->to_user = $invitation->contact->company->owner();
|
||||||
$nmo->settings = $invitation->contact->company->settings;
|
// $nmo->settings = $invitation->contact->company->settings;
|
||||||
|
|
||||||
NinjaMailerJob::dispatch($nmo);
|
// NinjaMailerJob::dispatch($nmo);
|
||||||
|
|
||||||
Cache::put("unsubscribe_notification_suppression:{$invitation_key}", true, 3600);
|
// Cache::put("unsubscribe_notification_suppression:{$invitation_key}", true, 3600);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return back()->with('message', ctrans('texts.updated_settings'));
|
return back()->with('message', ctrans('texts.updated_settings'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,11 @@ namespace App\Services\EDocument\Standards\Verifactu;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use App\Services\EDocument\Standards\Verifactu\ResponseProcessor;
|
use App\Services\EDocument\Standards\Verifactu\ResponseProcessor;
|
||||||
|
use App\Services\EDocument\Standards\Verifactu\Signing\SigningService;
|
||||||
|
|
||||||
class AeatClient
|
class AeatClient
|
||||||
{
|
{
|
||||||
private string $base_url = 'https://www1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP';
|
private string $base_url = 'https://www1.agenciatributaria.gob.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP';
|
||||||
|
|
||||||
private string $sandbox_url = 'https://prewww1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP';
|
private string $sandbox_url = 'https://prewww1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP';
|
||||||
|
|
||||||
|
|
@ -61,8 +62,34 @@ class AeatClient
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign SOAP envelope with XML Digital Signature
|
||||||
|
*
|
||||||
|
* @param string $xml - Unsigned SOAP envelope
|
||||||
|
* @return string - Signed SOAP envelope
|
||||||
|
*/
|
||||||
|
private function signSoapEnvelope(string $xml): string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$signingService = new SigningService(
|
||||||
|
$xml,
|
||||||
|
file_get_contents($this->ssl_key),
|
||||||
|
file_get_contents($this->certificate)
|
||||||
|
);
|
||||||
|
return $signingService->sign();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
nlog("Error signing SOAP envelope: " . $e->getMessage());
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function send($xml): array
|
public function send($xml): array
|
||||||
{
|
{
|
||||||
|
// Sign the SOAP envelope before sending
|
||||||
|
$signed_xml = $this->signSoapEnvelope($xml);
|
||||||
|
|
||||||
|
nlog("AEAT Request URL: " . $this->base_url);
|
||||||
|
nlog("Signed SOAP envelope size: " . strlen($signed_xml) . " bytes");
|
||||||
|
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'Content-Type' => 'text/xml; charset=utf-8',
|
'Content-Type' => 'text/xml; charset=utf-8',
|
||||||
|
|
@ -74,11 +101,13 @@ class AeatClient
|
||||||
'verify' => false,
|
'verify' => false,
|
||||||
'timeout' => 30,
|
'timeout' => 30,
|
||||||
])
|
])
|
||||||
->withBody($xml, 'text/xml')
|
->withBody($signed_xml, 'text/xml')
|
||||||
->post($this->base_url);
|
->post($this->base_url);
|
||||||
|
|
||||||
$success = $response->successful();
|
$success = $response->successful();
|
||||||
|
|
||||||
|
nlog("AEAT Response HTTP Code: " . $response->status());
|
||||||
|
|
||||||
$responseProcessor = new ResponseProcessor();
|
$responseProcessor = new ResponseProcessor();
|
||||||
|
|
||||||
$parsedResponse = $responseProcessor->processResponse($response->body());
|
$parsedResponse = $responseProcessor->processResponse($response->body());
|
||||||
|
|
|
||||||
|
|
@ -957,6 +957,7 @@ class PdfMock
|
||||||
'$contact.first_name' => 'Geo',
|
'$contact.first_name' => 'Geo',
|
||||||
'$company.vat_number' => 'vat number',
|
'$company.vat_number' => 'vat number',
|
||||||
'$contact.signature' => '',
|
'$contact.signature' => '',
|
||||||
|
'$verifactu_qr_code' => '',
|
||||||
'$product.tax_name1' => '',
|
'$product.tax_name1' => '',
|
||||||
'$product.tax_name2' => '',
|
'$product.tax_name2' => '',
|
||||||
'$product.tax_name3' => '',
|
'$product.tax_name3' => '',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue