diff --git a/.changeset/three-cows-buy.md b/.changeset/three-cows-buy.md new file mode 100644 index 000000000..c090c1d65 --- /dev/null +++ b/.changeset/three-cows-buy.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +refactor: Flatten schema directory tree Rebilly/api-definitions#1655 diff --git a/examples/purchase.php b/examples/purchase.php index f72007d86..2534ed082 100644 --- a/examples/purchase.php +++ b/examples/purchase.php @@ -17,7 +17,7 @@ use Rebilly\Sdk\Model\OrderItem; use Rebilly\Sdk\Model\OrderItemPlan; use Rebilly\Sdk\Model\PaymentCardToken; -use Rebilly\Sdk\Model\PaymentToken; +use Rebilly\Sdk\Model\PaymentInstructionToken; use Rebilly\Sdk\Model\Plan; use Rebilly\Sdk\Model\PlanFormulaFlatRate; use Rebilly\Sdk\Model\PostTransactionRequest; @@ -165,7 +165,7 @@ function printEntity(mixed $entity): void ->setIsMerchantInitiated(true) ->setIsProcessedOutside(true) ->setPaymentInstruction( - PaymentToken::from() + PaymentInstructionToken::from() ->setToken($token->getId()), ) ->setInvoiceIds([(string) $invoice->getId()]); diff --git a/src/Api/ReportsApi.php b/src/Api/ReportsApi.php index d09685aa9..3b767d04e 100644 --- a/src/Api/ReportsApi.php +++ b/src/Api/ReportsApi.php @@ -18,7 +18,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\Utils; use Rebilly\Sdk\Collection; -use Rebilly\Sdk\Model\APILogSummary; +use Rebilly\Sdk\Model\ApiLogSummary; use Rebilly\Sdk\Model\CumulativeSubscriptions; use Rebilly\Sdk\Model\DashboardResponse; use Rebilly\Sdk\Model\DccMarkup; @@ -51,14 +51,14 @@ public function __construct(protected ?ClientInterface $client) } /** - * @return APILogSummary + * @return ApiLogSummary */ public function getApiLogSummary( DateTimeImmutable $periodStart, DateTimeImmutable $periodEnd, ?int $limit = null, ?int $offset = null, - ): APILogSummary { + ): ApiLogSummary { $queryParams = [ 'periodStart' => $periodStart->format('Y-m-d\TH:i:s\Z'), 'periodEnd' => $periodEnd->format('Y-m-d\TH:i:s\Z'), @@ -71,7 +71,7 @@ public function getApiLogSummary( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return APILogSummary::from($data); + return ApiLogSummary::from($data); } /** diff --git a/src/Model/APILogSummary.php b/src/Model/ApiLogSummary.php similarity index 85% rename from src/Model/APILogSummary.php rename to src/Model/ApiLogSummary.php index dca1fd3bb..5628bcbb8 100644 --- a/src/Model/APILogSummary.php +++ b/src/Model/ApiLogSummary.php @@ -15,7 +15,7 @@ use JsonSerializable; -class APILogSummary implements JsonSerializable +class ApiLogSummary implements JsonSerializable { private array $fields = []; @@ -32,7 +32,7 @@ public static function from(array $data = []): self } /** - * @return null|APILogSummaryData[] + * @return null|ApiLogSummaryData[] */ public function getData(): ?array { @@ -40,12 +40,12 @@ public function getData(): ?array } /** - * @param null|APILogSummaryData[]|array[] $data + * @param null|ApiLogSummaryData[]|array[] $data */ public function setData(null|array $data): static { $data = $data !== null ? array_map( - fn ($value) => $value !== null ? ($value instanceof APILogSummaryData ? $value : APILogSummaryData::from($value)) : null, + fn ($value) => $value !== null ? ($value instanceof ApiLogSummaryData ? $value : ApiLogSummaryData::from($value)) : null, $data, ) : null; diff --git a/src/Model/APILogSummaryData.php b/src/Model/ApiLogSummaryData.php similarity index 98% rename from src/Model/APILogSummaryData.php rename to src/Model/ApiLogSummaryData.php index 927398079..e2beb6977 100644 --- a/src/Model/APILogSummaryData.php +++ b/src/Model/ApiLogSummaryData.php @@ -15,7 +15,7 @@ use JsonSerializable; -class APILogSummaryData implements JsonSerializable +class ApiLogSummaryData implements JsonSerializable { private array $fields = []; diff --git a/src/Model/FeeFormulaFactory.php b/src/Model/FeeFormulaFactory.php index 6c0bc0210..dbe85d541 100644 --- a/src/Model/FeeFormulaFactory.php +++ b/src/Model/FeeFormulaFactory.php @@ -21,7 +21,7 @@ public static function from(array $data = []): FeeFormula { return match ($data['type']) { 'fixed-fee' => FixedFeeFormula::from($data), - 'percentage' => PercentageFormula::from($data), + 'percentage' => PercentageFeeFormula::from($data), default => throw new UnknownDiscriminatorValueException(), }; } diff --git a/src/Model/Manual.php b/src/Model/ManualTax.php similarity index 97% rename from src/Model/Manual.php rename to src/Model/ManualTax.php index a5200f592..c64785c73 100644 --- a/src/Model/Manual.php +++ b/src/Model/ManualTax.php @@ -15,7 +15,7 @@ use JsonSerializable; -class Manual implements Taxes, JsonSerializable +class ManualTax implements Taxes, JsonSerializable { private array $fields = []; diff --git a/src/Model/PaymentInstructionFactory.php b/src/Model/PaymentInstructionFactory.php index 35bd1b9bd..10d9e78a0 100644 --- a/src/Model/PaymentInstructionFactory.php +++ b/src/Model/PaymentInstructionFactory.php @@ -20,13 +20,13 @@ class PaymentInstructionFactory public static function from(array $data = []): PaymentInstruction { if (isset($data['token'])) { - return PaymentToken::from($data); + return PaymentInstructionToken::from($data); } if (isset($data['paymentInstrumentId'])) { return PaymentInstructionInstrument::from($data); } if (isset($data['methods'])) { - return PaymentMethods::from($data); + return PaymentInstructionMethods::from($data); } return match ($data['method']) { diff --git a/src/Model/PaymentMethods.php b/src/Model/PaymentInstructionMethods.php similarity index 99% rename from src/Model/PaymentMethods.php rename to src/Model/PaymentInstructionMethods.php index bbe604ad7..1ef1609b7 100644 --- a/src/Model/PaymentMethods.php +++ b/src/Model/PaymentInstructionMethods.php @@ -15,7 +15,7 @@ use JsonSerializable; -class PaymentMethods implements PaymentInstruction, JsonSerializable +class PaymentInstructionMethods implements PaymentInstruction, JsonSerializable { public const METHOD_PAYMENT_CARD = 'payment-card'; diff --git a/src/Model/PaymentToken.php b/src/Model/PaymentInstructionToken.php similarity index 99% rename from src/Model/PaymentToken.php rename to src/Model/PaymentInstructionToken.php index 7c7440051..a8453eccd 100644 --- a/src/Model/PaymentToken.php +++ b/src/Model/PaymentInstructionToken.php @@ -15,7 +15,7 @@ use JsonSerializable; -class PaymentToken implements PaymentInstruction, JsonSerializable +class PaymentInstructionToken implements PaymentInstruction, JsonSerializable { public const METHOD_PAYMENT_CARD = 'payment-card'; diff --git a/src/Model/PercentageFormula.php b/src/Model/PercentageFeeFormula.php similarity index 97% rename from src/Model/PercentageFormula.php rename to src/Model/PercentageFeeFormula.php index dc76fb21c..b55f27817 100644 --- a/src/Model/PercentageFormula.php +++ b/src/Model/PercentageFeeFormula.php @@ -15,7 +15,7 @@ use JsonSerializable; -class PercentageFormula implements FeeFormula, JsonSerializable +class PercentageFeeFormula implements FeeFormula, JsonSerializable { private array $fields = []; diff --git a/src/Model/RebillyAvalara.php b/src/Model/RebillyAvalaraTax.php similarity index 97% rename from src/Model/RebillyAvalara.php rename to src/Model/RebillyAvalaraTax.php index 422956975..a3164d1ba 100644 --- a/src/Model/RebillyAvalara.php +++ b/src/Model/RebillyAvalaraTax.php @@ -15,7 +15,7 @@ use JsonSerializable; -class RebillyAvalara implements Taxes, JsonSerializable +class RebillyAvalaraTax implements Taxes, JsonSerializable { private array $fields = []; diff --git a/src/Model/RebillyTaxjar.php b/src/Model/RebillyTaxJarTax.php similarity index 97% rename from src/Model/RebillyTaxjar.php rename to src/Model/RebillyTaxJarTax.php index d37117efa..59c4474e8 100644 --- a/src/Model/RebillyTaxjar.php +++ b/src/Model/RebillyTaxJarTax.php @@ -15,7 +15,7 @@ use JsonSerializable; -class RebillyTaxjar implements Taxes, JsonSerializable +class RebillyTaxJarTax implements Taxes, JsonSerializable { private array $fields = []; diff --git a/src/Model/TaxesFactory.php b/src/Model/TaxesFactory.php index a42f3b823..4e4c5a4eb 100644 --- a/src/Model/TaxesFactory.php +++ b/src/Model/TaxesFactory.php @@ -20,9 +20,9 @@ class TaxesFactory public static function from(array $data = []): Taxes { return match ($data['calculator']) { - 'manual' => Manual::from($data), - 'rebilly-avalara' => RebillyAvalara::from($data), - 'rebilly-taxjar' => RebillyTaxjar::from($data), + 'manual' => ManualTax::from($data), + 'rebilly-avalara' => RebillyAvalaraTax::from($data), + 'rebilly-taxjar' => RebillyTaxJarTax::from($data), default => throw new UnknownDiscriminatorValueException(), }; }