Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 53 additions & 83 deletions openapi.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/Sales/Sales.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ public function get(string $merchantCode, string $saleId, ?RequestOptions $reque
$response = $this->client->send('GET', $path, $payload, $headers, $requestOptions);

return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Sale::class, [
'401' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'403' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'404' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'412' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'403' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'412' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
], 'GET', $path);
}

Expand Down Expand Up @@ -143,10 +143,10 @@ public function list(string $merchantCode, ?SalesListParams $queryParams = null,
$response = $this->client->send('GET', $path, $payload, $headers, $requestOptions);

return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\SalePage::class, [
'400' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'401' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'403' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'412' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'403' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'412' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
], 'GET', $path);
}

Expand Down Expand Up @@ -177,10 +177,10 @@ public function search(string $merchantCode, \SumUp\Types\SaleSearchRequest|arra
$response = $this->client->send('POST', $path, $payload, $headers, $requestOptions);

return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\SaleSearchResponse::class, [
'400' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'401' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'403' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'412' => ['type' => 'class', 'class' => \SumUp\Types\ProblemV10::class],
'400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'403' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'412' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
], 'POST', $path);
}
}
50 changes: 0 additions & 50 deletions src/Types/ProblemV10.php

This file was deleted.

12 changes: 6 additions & 6 deletions src/Types/Sale.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* Non-finalised sales are never returned; only fully-paid sales.
*
* Item lines are `SaleLineItem`. Merchant fees appear as `type: "FEE"` lines; extra fee data
* Item lines are `SaleItem`. Merchant fees appear as `type: "FEE"` lines; extra fee data
* is in `features`.
*/
class Sale
Expand Down Expand Up @@ -54,19 +54,19 @@ class Sale
* The lines sold in this sale, in the order they were added to the cart.
* Includes merchant fees (`type: "FEE"`) when present; fee details are in `features`.
*
* @var SaleLineItemV10[]
* @var SaleItem[]
*/
public array $items;

/**
* Sale-level pricing aggregate, parallel to `LineItemPrice` on each `SaleLineItem`.
* Sale-level pricing aggregate, parallel to `SaleItemPrice` on each `SaleItem`.
* Line-level breakdown (unit price, line discounts, per-line taxes) lives on
* `items[].price`. This object holds the rolled-up totals and cart-level
* adjustments that consumers use for receipts and payment reconciliation.
*
* @var SalePriceV10
* @var SaleTotals
*/
public SalePriceV10 $price;
public SaleTotals $price;

/**
* The tax mode used by merchant for displaying prices and calculating taxes:
Expand All @@ -90,7 +90,7 @@ class Sale
/**
* Payments on this sale, in the order they were recorded.
*
* @var PublicPaymentV10[]
* @var SalePayment[]
*/
public array $payments;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Gift card IDs use the format "GC" followed by 9 alphanumeric characters
* (e.g. GCZ3NTMB1V).
*/
class PublicGiftCardPayment
class SaleGiftCardPayment
{
/**
* Gift card identifier. Format "GC" followed by 9 alphanumeric characters
Expand Down
22 changes: 11 additions & 11 deletions src/Types/SaleLineItemV10.php → src/Types/SaleItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Type-specific data is in `features`. There is no per-type object and no discriminator,
* so a new item type does not change this schema.
*/
class SaleLineItemV10
class SaleItem
{
/**
* Stable identifier of the line within the sale. Used for linking (e.g. deposits).
Expand All @@ -26,7 +26,7 @@ class SaleLineItemV10
* Known values: `CATALOG`, `DEPOSIT`, `GIFT_CARD`, `CUSTOM`, `FEE`.
* `FEE` lines represent merchant-charged fees on the sale (e.g. shipping, service
* charge, surcharge, cancellation). They participate in sale totals like any other
* line; type-specific data is carried in `features` (see `Feature` for the
* line; type-specific data is carried in `features` (see `SaleItemFeature` for the
* conventional feature keys).
* This is intentionally an open string, NOT a closed enum: new values are added
* over time as pure data and consumers MUST tolerate unknown values, rendering the
Expand Down Expand Up @@ -61,9 +61,9 @@ class SaleLineItemV10
/**
* The type of service for this line.
*
* @var SaleLineItemV10ServiceType|null
* @var SaleItemServiceType|null
*/
public ?SaleLineItemV10ServiceType $serviceType = null;
public ?SaleItemServiceType $serviceType = null;

/**
* Optional free-text note attached to the line, visible on receipts.
Expand All @@ -79,15 +79,15 @@ class SaleLineItemV10
* Totals and tax amounts can be negative for return-like operations (for example
* a deposit with `operation_type` = `RETURN`).
*
* @var LineItemPriceV10
* @var SaleItemPrice
*/
public LineItemPriceV10 $price;
public SaleItemPrice $price;

/**
* Categories the line belongs to. A shared optional structure available to any
* line; not a per-type field.
*
* @var CategoryV10[]|null
* @var SaleItemCategory[]|null
*/
public ?array $categories = null;

Expand All @@ -103,15 +103,15 @@ class SaleLineItemV10
* Outward identifiers and links for a line, kept in one place rather than scattered
* per item type.
*
* @var ItemReferencesV10|null
* @var SaleItemReferences|null
*/
public ?ItemReferencesV10 $references = null;
public ?SaleItemReferences $references = null;

/**
* Named, typed, type-specific data. New item types add their data here as
* features instead of new schema variants. See `Feature` for per-type examples.
* features instead of new schema variants. See `SaleItemFeature` for per-type examples.
*
* @var FeatureV10[]|null
* @var SaleItemFeature[]|null
*/
public ?array $features = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* A category a line belongs to.
*/
class CategoryV10
class SaleItemCategory
{
/**
* The category id. Usually a UUID, but not always (legacy cases).
Expand Down
6 changes: 3 additions & 3 deletions src/Types/FeatureV10.php → src/Types/SaleItemFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* `tracking_reference` (shipping); `card_type`, `scheme` (surcharge);
* `policy_id` (cancellation)
*/
class FeatureV10
class SaleItemFeature
{
/**
* The feature name/key.
Expand All @@ -44,9 +44,9 @@ class FeatureV10
* The data type of a feature value. The wire `value` is always a string and is parsed
* according to this type.
*
* @var FeatureV10ValueType
* @var SaleItemFeatureValueType
*/
public FeatureV10ValueType $valueType;
public SaleItemFeatureValueType $valueType;

/**
* The feature value in canonical string form, to be parsed per `value_type`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* The data type of a feature value. The wire `value` is always a string and is parsed
* according to this type.
*/
enum FeatureV10ValueType: string
enum SaleItemFeatureValueType: string
{
case TEXT = 'TEXT';
case INTEGER = 'INTEGER';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Totals and tax amounts can be negative for return-like operations (for example
* a deposit with `operation_type` = `RETURN`).
*/
class LineItemPriceV10
class SaleItemPrice
{
/**
* The price of a single unit. If the tax_mode is GROSS it includes taxes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
* Outward identifiers and links for a line, kept in one place rather than scattered
* per item type.
*/
class ItemReferencesV10
class SaleItemReferences
{
/**
* The source of the catalog the line originates from.
*
* @var ItemReferencesV10CatalogSource|null
* @var SaleItemReferencesCatalogSource|null
*/
public ?ItemReferencesV10CatalogSource $catalogSource = null;
public ?SaleItemReferencesCatalogSource $catalogSource = null;

/**
* Reference to the backing catalog entity (item variant, deposit, ...),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* The source of the catalog the line originates from.
*/
enum ItemReferencesV10CatalogSource: string
enum SaleItemReferencesCatalogSource: string
{
case SUMUP = 'SUMUP';
case EXTERNAL = 'EXTERNAL';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* The type of service for this line.
*/
enum SaleLineItemV10ServiceType: string
enum SaleItemServiceType: string
{
case IN_HOUSE = 'IN_HOUSE';
case TAKE_AWAY = 'TAKE_AWAY';
Expand Down
14 changes: 7 additions & 7 deletions src/Types/PublicPaymentV10.php → src/Types/SalePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Acquirer/processing cost is not on this object. Merchant-charged fees (shipping, service
* charge, etc.) appear as `type: "FEE"` item lines in `Sale.items`.
*/
class PublicPaymentV10
class SalePayment
{
/**
* Payment method on public sales read API v1.0.
Expand Down Expand Up @@ -51,9 +51,9 @@ class PublicPaymentV10
/**
* The status of the payment.
*
* @var PublicPaymentV10Status
* @var SalePaymentStatus
*/
public PublicPaymentV10Status $status;
public SalePaymentStatus $status;

/**
* Alternative payment method type when `method` is `apm`.
Expand All @@ -69,19 +69,19 @@ class PublicPaymentV10
/**
* Card brand, credit/debit processing type, and last four digits.
*
* @var PublicCardV10|null
* @var SalePaymentCard|null
*/
public ?PublicCardV10 $card = null;
public ?SalePaymentCard $card = null;

/**
* Gift card used for this payment. Present when `method` is `gift_card` and the gift card
* id is known.
* Gift card IDs use the format "GC" followed by 9 alphanumeric characters
* (e.g. GCZ3NTMB1V).
*
* @var PublicGiftCardPayment|null
* @var SaleGiftCardPayment|null
*/
public ?PublicGiftCardPayment $giftCard = null;
public ?SaleGiftCardPayment $giftCard = null;

/**
* UTC date-time when SumUp recorded this payment’s exposed `status` (successful, failed,
Expand Down
6 changes: 3 additions & 3 deletions src/Types/PublicCardV10.php → src/Types/SalePaymentCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Card brand, credit/debit processing type, and last four digits.
*/
class PublicCardV10
class SalePaymentCard
{
/**
* The brand of the card.
Expand All @@ -23,9 +23,9 @@ class PublicCardV10
* Credit or debit processing choice, not brand or funding.
* `unknown` when unavailable; prepaid/voucher are not processing types.
*
* @var PublicCardV10Type
* @var SalePaymentCardType
*/
public PublicCardV10Type $type;
public SalePaymentCardType $type;

/**
* The last 4 digits of the card used for the payment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Credit or debit processing choice, not brand or funding.
* `unknown` when unavailable; prepaid/voucher are not processing types.
*/
enum PublicCardV10Type: string
enum SalePaymentCardType: string
{
case CREDIT = 'credit';
case DEBIT = 'debit';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* The status of the payment.
*/
enum PublicPaymentV10Status: string
enum SalePaymentStatus: string
{
case FAILED = 'FAILED';
case SUCCESSFUL = 'SUCCESSFUL';
Expand Down
4 changes: 2 additions & 2 deletions src/Types/SalePriceV10.php → src/Types/SaleTotals.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
namespace SumUp\Types;

/**
* Sale-level pricing aggregate, parallel to `LineItemPrice` on each `SaleLineItem`.
* Sale-level pricing aggregate, parallel to `SaleItemPrice` on each `SaleItem`.
*
* Line-level breakdown (unit price, line discounts, per-line taxes) lives on
* `items[].price`. This object holds the rolled-up totals and cart-level
* adjustments that consumers use for receipts and payment reconciliation.
*/
class SalePriceV10
class SaleTotals
{
/**
* Final net total for the sale: sum of `items[].price.total_net_amount_final`
Expand Down
Loading