Skip to content

Commit

Permalink
Fixes coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray authored and github-actions[bot] committed Dec 10, 2024
1 parent 8f31fbd commit 3f1c1fa
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/EndpointCollection/SalesInvoiceEndpointCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function get(string $id): SalesInvoice
/**
* Creates a SalesInvoice in Mollie.
*
* @param array|CreateSalesInvoicePayload $payload
* @param array|CreateSalesInvoicePayload $payload
*
* @throws ApiException
*/
Expand Down
14 changes: 6 additions & 8 deletions src/Factories/CreateSalesInvoicePayloadFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
namespace Mollie\Api\Factories;

use Mollie\Api\Http\Payload\CreateSalesInvoicePayload;
use Mollie\Api\Http\Payload\PaymentDetails;
use Mollie\Api\Http\Payload\EmailDetails;
use Mollie\Api\Http\Payload\Discount;
use Mollie\Api\Http\Payload\EmailDetails;
use Mollie\Api\Http\Payload\PaymentDetails;

class CreateSalesInvoicePayloadFactory extends Factory
{
/**
* Create a new CreateSalesInvoicePayload instance.
*
* @return CreateSalesInvoicePayload
*/
public function create(): CreateSalesInvoicePayload
{
Expand All @@ -27,14 +25,14 @@ public function create(): CreateSalesInvoicePayload
$this
->mapIfNotNull(
'lines',
fn(array $items) => InvoiceLineCollectionFactory::new($items)->create()
fn (array $items) => InvoiceLineCollectionFactory::new($items)->create()
),
$this->get('profileId'),
$this->get('memo'),
$this->mapIfNotNull('paymentDetails', fn(array $data) => PaymentDetails::fromArray($data)),
$this->mapIfNotNull('emailDetails', fn(array $data) => EmailDetails::fromArray($data)),
$this->mapIfNotNull('paymentDetails', fn (array $data) => PaymentDetails::fromArray($data)),
$this->mapIfNotNull('emailDetails', fn (array $data) => EmailDetails::fromArray($data)),
$this->get('webhookUrl'),
$this->mapIfNotNull('discount', fn(array $data) => Discount::fromArray($data))
$this->mapIfNotNull('discount', fn (array $data) => Discount::fromArray($data))
);
}
}
2 changes: 1 addition & 1 deletion src/Factories/InvoiceLineCollectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class InvoiceLineCollectionFactory extends Factory
public function create(): DataCollection
{
return new DataCollection(array_map(
fn(array $item) => InvoiceLineFactory::new($item)->create(),
fn (array $item) => InvoiceLineFactory::new($item)->create(),
$this->data
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Factories/InvoiceLineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function create(): InvoiceLine
$this->get('quantity'),
$this->get('vatRate'),
MoneyFactory::new($this->get('unitPrice'))->create(),
$this->mapIfNotNull('discount', fn(array $data) => Discount::fromArray($data))
$this->mapIfNotNull('discount', fn (array $data) => Discount::fromArray($data))
);
}
}
18 changes: 8 additions & 10 deletions src/Factories/UpdateSalesInvoicePayloadFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

namespace Mollie\Api\Factories;

use Mollie\Api\Http\Payload\UpdateSalesInvoicePayload;
use Mollie\Api\Http\Payload\PaymentDetails;
use Mollie\Api\Http\Payload\EmailDetails;
use Mollie\Api\Http\Payload\Discount;
use Mollie\Api\Http\Payload\EmailDetails;
use Mollie\Api\Http\Payload\PaymentDetails;
use Mollie\Api\Http\Payload\UpdateSalesInvoicePayload;

class UpdateSalesInvoicePayloadFactory extends Factory
{
/**
* Create a new UpdateSalesInvoicePayload instance.
*
* @return UpdateSalesInvoicePayload
*/
public function create(): UpdateSalesInvoicePayload
{
Expand All @@ -21,16 +19,16 @@ public function create(): UpdateSalesInvoicePayload
$this->get('recipientIdentifier'),
$this->get('paymentTerm'),
$this->get('memo'),
$this->mapIfNotNull('paymentDetails', fn(array $data) => PaymentDetails::fromArray($data)),
$this->mapIfNotNull('emailDetails', fn(array $data) => EmailDetails::fromArray($data)),
$this->mapIfNotNull('recipient', fn(array $data) => RecipientFactory::new($data)->create()),
$this->mapIfNotNull('paymentDetails', fn (array $data) => PaymentDetails::fromArray($data)),
$this->mapIfNotNull('emailDetails', fn (array $data) => EmailDetails::fromArray($data)),
$this->mapIfNotNull('recipient', fn (array $data) => RecipientFactory::new($data)->create()),
$this
->mapIfNotNull(
'lines',
fn(array $items) => InvoiceLineCollectionFactory::new($items)->create()
fn (array $items) => InvoiceLineCollectionFactory::new($items)->create()
),
$this->get('webhookUrl'),
$this->mapIfNotNull('discount', fn(array $data) => Discount::fromArray($data))
$this->mapIfNotNull('discount', fn (array $data) => Discount::fromArray($data))
);
}
}
1 change: 1 addition & 0 deletions src/Http/Payload/EmailDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class EmailDetails implements DataProvider
{
use ComposableFromArray;

public string $subject;

public string $body;
Expand Down
1 change: 1 addition & 0 deletions src/Http/Requests/CreateSalesInvoiceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class CreateSalesInvoiceRequest extends ResourceHydratableRequest implements Has
use HasJsonPayload;

protected static string $method = Method::POST;

public static string $targetResourceClass = SalesInvoice::class;

private CreateSalesInvoicePayload $payload;
Expand Down
2 changes: 2 additions & 0 deletions src/Http/Requests/UpdateSalesInvoiceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ class UpdateSalesInvoiceRequest extends ResourceHydratableRequest implements Has
use HasJsonPayload;

protected static string $method = Method::PATCH;

public static string $targetResourceClass = SalesInvoice::class;

private string $id;

private UpdateSalesInvoicePayload $payload;

public function __construct(string $id, UpdateSalesInvoicePayload $payload)
Expand Down
2 changes: 1 addition & 1 deletion src/MollieApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Mollie\Api\EndpointCollection\ProfileEndpointCollection;
use Mollie\Api\EndpointCollection\ProfileMethodEndpointCollection;
use Mollie\Api\EndpointCollection\RefundEndpointCollection;
use Mollie\Api\EndpointCollection\SalesInvoiceEndpointCollection;
use Mollie\Api\EndpointCollection\SessionEndpointCollection;
use Mollie\Api\EndpointCollection\SettlementCaptureEndpointCollection;
use Mollie\Api\EndpointCollection\SettlementChargebackEndpointCollection;
Expand All @@ -42,7 +43,6 @@
use Mollie\Api\EndpointCollection\SubscriptionPaymentEndpointCollection;
use Mollie\Api\EndpointCollection\TerminalEndpointCollection;
use Mollie\Api\EndpointCollection\WalletEndpointCollection;
use Mollie\Api\EndpointCollection\SalesInvoiceEndpointCollection;
use Mollie\Api\Helpers\Url;
use Mollie\Api\Http\Adapter\MollieHttpAdapterPicker;
use Mollie\Api\Idempotency\DefaultIdempotencyKeyGenerator;
Expand Down
1 change: 1 addition & 0 deletions src/Resources/SalesInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class SalesInvoice extends BaseResource
* @var object
*/
public $paymentDetails;

/**
* @var object
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasEndpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use Mollie\Api\EndpointCollection\ProfileEndpointCollection;
use Mollie\Api\EndpointCollection\ProfileMethodEndpointCollection;
use Mollie\Api\EndpointCollection\RefundEndpointCollection;
use Mollie\Api\EndpointCollection\SalesInvoiceEndpointCollection;
use Mollie\Api\EndpointCollection\SessionEndpointCollection;
use Mollie\Api\EndpointCollection\SettlementCaptureEndpointCollection;
use Mollie\Api\EndpointCollection\SettlementChargebackEndpointCollection;
Expand All @@ -38,7 +39,6 @@
use Mollie\Api\EndpointCollection\SubscriptionPaymentEndpointCollection;
use Mollie\Api\EndpointCollection\TerminalEndpointCollection;
use Mollie\Api\EndpointCollection\WalletEndpointCollection;
use Mollie\Api\EndpointCollection\SalesInvoiceEndpointCollection;
use Mollie\Api\MollieApiClient;

/**
Expand Down
6 changes: 6 additions & 0 deletions src/Types/PaymentTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
class PaymentTerm
{
const DAYS_7 = '7 days';

const DAYS_14 = '14 days';

const DAYS_30 = '30 days';

const DAYS_45 = '45 days';

const DAYS_60 = '60 days';

const DAYS_90 = '90 days';

const DAYS_120 = '120 days';
}
1 change: 1 addition & 0 deletions src/Types/RecipientType.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
class RecipientType
{
const CONSUMER = 'consumer';

const BUSINESS = 'business';
}
1 change: 1 addition & 0 deletions src/Types/VatMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
class VatMode
{
const EXCLUSIVE = 'exclusive';

const INCLUSIVE = 'inclusive';
}
1 change: 1 addition & 0 deletions src/Types/VatScheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
class VatScheme
{
const STANDARD = 'standard';

const ONE_STOP_SHOP = 'one-stop-shop';
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function create()
1,
'21',
new Money('EUR', '10,00'),
)
),
];

// Create a sales invoice
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/Requests/CreateSalesInvoiceRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function it_creates_sales_invoice()
1,
'21',
new Money('EUR', '10,00'),
)
),
];

// Create a sales invoice
Expand Down Expand Up @@ -89,7 +89,7 @@ public function it_resolves_correct_resource_path()
1,
'21',
new Money('EUR', '10,00'),
)
),
])
));

Expand Down

0 comments on commit 3f1c1fa

Please sign in to comment.