-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] feat: upload xml (efactura) to ANAF (#17)
* feature: upload xml (efactura) to ANAF + tests * Upload efactura
- Loading branch information
1 parent
c8a8d7e
commit 1f5695c
Showing
15 changed files
with
228 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Anaf\Enums\Efactura; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
enum UploadStandard: string | ||
{ | ||
case UBL = 'UBL'; | ||
case CN = 'CN'; | ||
case CII = 'CII'; | ||
case RASP = 'RASP'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Anaf\Responses\Efactura; | ||
|
||
use Anaf\Contracts\Response; | ||
use Anaf\Responses\Concerns\ArrayAccessible; | ||
|
||
/** | ||
* @implements Response<array{response_date: string, execution_status: string, upload_index: string}> | ||
*/ | ||
class CreateUploadResponse implements Response | ||
{ | ||
/** | ||
* @use ArrayAccessible<array{response_date: string, execution_status: string, upload_index: string}> | ||
*/ | ||
use ArrayAccessible; | ||
|
||
/** | ||
* Creates a new CreateResponse instance. | ||
*/ | ||
private function __construct( | ||
public readonly string $responseDate, | ||
public readonly string $executionStatus, | ||
public readonly string $uploadIndex, | ||
) { | ||
} | ||
|
||
/** | ||
* Acts as static factory, and returns a new Response instance. | ||
* | ||
* @param array{dateResponse: string, ExecutionStatus: string, index_incarcare: string} $attributes | ||
*/ | ||
public static function from(array $attributes): self | ||
{ | ||
return new self( | ||
$attributes['dateResponse'], | ||
$attributes['ExecutionStatus'], | ||
$attributes['index_incarcare'], | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [ | ||
'response_date' => $this->responseDate, | ||
'execution_status' => $this->executionStatus, | ||
'upload_index' => $this->uploadIndex, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.