Skip to content

Commit

Permalink
Pluralise origin
Browse files Browse the repository at this point in the history
  • Loading branch information
vifer committed Jan 24, 2024
1 parent 60c05c3 commit 52b0e63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Resources/Transactions/Operations/ListTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ListTransactions implements HasParameters
* @param array<string> $invoiceNumbers
* @param array<StatusTransaction> $statuses
* @param array<string> $subscriptionIds
* @param array<Origin> $origin
* @param array<Origin> $origins
*/
public function __construct(
private readonly ?Pager $pager = null,
Expand All @@ -36,7 +36,7 @@ public function __construct(
private readonly array $statuses = [],
private readonly array $subscriptionIds = [],
private readonly ?DateComparison $updatedAt = null,
private readonly array $origin = [],
private readonly array $origins = [],
) {
if ($invalid = array_filter($this->customerIds, fn ($value): bool => ! is_string($value))) {
throw InvalidArgumentException::arrayContainsInvalidTypes('customerIds', 'string', implode(', ', $invalid));
Expand All @@ -62,8 +62,8 @@ public function __construct(
throw InvalidArgumentException::arrayContainsInvalidTypes('subscriptionIds', 'string', implode(', ', $invalid));
}

if ($invalid = array_filter($this->origin, fn ($value): bool => ! $value instanceof Origin)) {
throw InvalidArgumentException::arrayContainsInvalidTypes('origin', Origin::class, implode(', ', $invalid));
if ($invalid = array_filter($this->origins, fn ($value): bool => ! $value instanceof Origin)) {
throw InvalidArgumentException::arrayContainsInvalidTypes('origins', Origin::class, implode(', ', $invalid));
}
}

Expand All @@ -84,7 +84,7 @@ public function getParameters(): array
'status' => implode(',', array_map($enumStringify, $this->statuses)),
'subscription_id' => implode(',', $this->subscriptionIds),
'updated_at' . $this->updatedAt?->comparator() => $this->updatedAt?->formatted(),
'origin' => implode(',', array_map($enumStringify, $this->origin)),
'origin' => implode(',', array_map($enumStringify, $this->origins)),
]),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ public static function listOperationsProvider(): \Generator
sprintf('%s/transactions?include=customer,address,discount', Environment::SANDBOX->baseUrl()),
];

yield 'With Origin' => [
new ListTransactions(origin: [Origin::Web, Origin::Api, Origin::SubscriptionRecurring]),
yield 'With Origins' => [
new ListTransactions(origins: [Origin::Web, Origin::Api, Origin::SubscriptionRecurring]),
new Response(200, body: self::readRawJsonFixture('response/list_default')),
sprintf('%s/transactions?origin=web,api,subscription_recurring', Environment::SANDBOX->baseUrl()),
];
Expand Down

0 comments on commit 52b0e63

Please sign in to comment.