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
424 changes: 317 additions & 107 deletions openapi.json

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions src/Sales/Sales.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@
use SumUp\ResponseDecoder;

/**
* Query parameters for SalesListSalesV10Params.
* Query parameters for SalesListParams.
*
* @package SumUp\Services
*/
class SalesListSalesV10Params
class SalesListParams
{
/**
* Pagination token for subsequent requests. Should only be set by clients if they have
* received a token in the previous response, and this request is an immediate follow-up
* request to that response to load the subsequent page. Clients should treat this as an
* opaque token and should not attempt to parse it in any way.
* Opaque token from the previous list response. Omit it on the first request. To load
* the next page, pass the returned token unchanged. Not interchangeable with tokens
* from `POST /sales/search`.
*
* @var string|null
*/
Expand All @@ -41,7 +40,12 @@ class SalesListSalesV10Params
/**
* Class Sales
*
* Operations related to reading sales data.
* Read a merchant's fully-paid, closed sales, including item lines, taxes, discounts, and payments.
*
* List sales to retrieve full `Sale` objects, or search by date, payment status, and sales channel
* to retrieve summaries. Use a summary's `id` to get the full sale.
*
* Amounts are expressed in minor units according to each sale's `currency.scale`.
*
* @package SumUp\Services
*/
Expand Down Expand Up @@ -74,7 +78,7 @@ public function __construct(HttpClientInterface $client, string $accessToken)
}

/**
* Gets a sale
* Get a sale
*
* @param string $merchantCode The merchant code.
* @param string $saleId The sale ID.
Expand All @@ -86,7 +90,7 @@ public function __construct(HttpClientInterface $client, string $accessToken)
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function getSaleV10(string $merchantCode, string $saleId, ?RequestOptions $requestOptions = null): \SumUp\Types\Sale
public function get(string $merchantCode, string $saleId, ?RequestOptions $requestOptions = null): \SumUp\Types\Sale
{
$path = sprintf('/v1.0/merchants/%s/sales/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $saleId));
$payload = [];
Expand All @@ -103,10 +107,10 @@ public function getSaleV10(string $merchantCode, string $saleId, ?RequestOptions
}

/**
* Lists sales
* List sales
*
* @param string $merchantCode The merchant code.
* @param SalesListSalesV10Params|null $queryParams Optional query string parameters
* @param SalesListParams|null $queryParams Optional query string parameters
* @param RequestOptions|null $requestOptions Optional typed request options
*
* @return \SumUp\Types\SalePage
Expand All @@ -115,7 +119,7 @@ public function getSaleV10(string $merchantCode, string $saleId, ?RequestOptions
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function listSalesV10(string $merchantCode, ?SalesListSalesV10Params $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\SalePage
public function list(string $merchantCode, ?SalesListParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\SalePage
{
$path = sprintf('/v1.0/merchants/%s/sales', rawurlencode((string) $merchantCode));
if ($queryParams !== null) {
Expand Down Expand Up @@ -147,7 +151,7 @@ public function listSalesV10(string $merchantCode, ?SalesListSalesV10Params $que
}

/**
* Searches sales
* Search sales
*
* @param string $merchantCode The merchant code.
* @param \SumUp\Types\SaleSearchRequest|array<string, mixed> $body Required request payload
Expand All @@ -159,7 +163,7 @@ public function listSalesV10(string $merchantCode, ?SalesListSalesV10Params $que
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function searchSalesV10(string $merchantCode, \SumUp\Types\SaleSearchRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\SaleSearchResponse
public function search(string $merchantCode, \SumUp\Types\SaleSearchRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\SaleSearchResponse
{
$path = sprintf('/v1.0/merchants/%s/sales/search', rawurlencode((string) $merchantCode));
$payload = [];
Expand Down
16 changes: 8 additions & 8 deletions src/Types/PublicPaymentV10.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ class PublicPaymentV10
/**
* Payment method on public sales read API v1.0.
* Digital wallets are first-class methods. Gift card payments use `gift_card`, not `apm`.
* Input is case-insensitive; the canonical form is lowercase snake_case.
* **VALUES**: [card, cash, apm, external, apple_pay, google_pay, whatsapp_pay, gift_card].
* Values use lowercase snake_case. Known values are `card`, `cash`, `apm`, `external`,
* `apple_pay`, `google_pay`, `whatsapp_pay`, and `gift_card`.
* Additional values may be returned as new payment methods become available.
*
* @var string
*/
Expand All @@ -32,10 +33,8 @@ class PublicPaymentV10
/**
* Payment operation type.
* This is distinct from the payment instrument in `method`.
* Input is case-insensitive; the canonical form is lowercase snake_case.
* **VALUES**: [purchase, unreferenced_refund]
* Defaults to "purchase" if unspecified. Either a normal purchase or an unreferenced refund for negative
* sales like deposit returns.
* Values use lowercase snake_case. Known values are `purchase` for a normal purchase
* and `unreferenced_refund` for negative sales such as deposit returns.
*
* @var string
*/
Expand All @@ -59,8 +58,9 @@ class PublicPaymentV10
/**
* Alternative payment method type when `method` is `apm`.
* Gift card is not an APM on this API.
* Input is case-insensitive; the canonical form is lowercase snake_case.
* **VALUES**: [qr_code_pix, sepa_dd, paypal, sumup_pay, twint, iris].
* Values use lowercase snake_case. Known values are `qr_code_pix`, `sepa_dd`, `paypal`,
* `sumup_pay`, `twint`, and `iris`.
* Additional values may be returned as new alternative payment methods become available.
*
* @var string|null
*/
Expand Down
8 changes: 3 additions & 5 deletions src/Types/SalePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* Paginated list of `Sale` objects. Results are ordered **newest first** by the newest
* activity recorded for each sale. See `ListSalesV10`.
* activity recorded for each sale.
*/
class SalePage
{
Expand All @@ -17,10 +17,8 @@ class SalePage
public array $items;

/**
* Pagination token for subsequent requests. Should only be set by clients if they have
* received a token in the previous response, and this request is an immediate follow-up
* request to that response to load the subsequent page. Clients should treat this as an
* opaque token and should not attempt to parse it in any way.
* Opaque token for the next page. Pass it as the `pagination_token` query parameter
* on the next list request. Omitted when no further page is available.
*
* @var string|null
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Types/SaleSearchRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class SaleSearchRequest
public ?array $salesChannels = null;

/**
* Opaque pagination token from a previous search response. Not interchangeable with tokens
* from `GET /sales`.
* Opaque token from the previous search response. To load the next page, send it with
* the same filters. Not interchangeable with tokens from `GET /sales`.
*
* @var string|null
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Types/SaleSearchResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class SaleSearchResponse
public array $items;

/**
* Opaque token for the next page of search results.
* Opaque token for the next page. Pass it as `pagination_token` in the next search
* request body with the same filters. Omitted when no further page is available.
*
* @var string|null
*/
Expand Down
7 changes: 0 additions & 7 deletions src/Types/TransactionCheckoutInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ class TransactionCheckoutInfo
*/
public ?float $tipAmount = null;

/**
* How the payment details were captured, for example `CHIP` or `CONTACTLESS` for card-present payments and `CUSTOMER_ENTRY` for card details entered by the payer. For wallet and alternative payment methods, this can identify the method, such as `APPLE_PAY` or `BLIK`.
*
* @var TransactionCheckoutInfoEntryMode|null
*/
public ?TransactionCheckoutInfoEntryMode $entryMode = null;

/**
* Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments.
*
Expand Down
39 changes: 0 additions & 39 deletions src/Types/TransactionCheckoutInfoEntryMode.php

This file was deleted.

8 changes: 4 additions & 4 deletions src/Types/TransactionFull.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ class TransactionFull
public ?float $tipAmount = null;

/**
* How the payment details were captured, for example `CHIP` or `CONTACTLESS` for card-present payments and `CUSTOMER_ENTRY` for card details entered by the payer. For wallet and alternative payment methods, this can identify the method, such as `APPLE_PAY` or `BLIK`.
* Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments.
*
* @var string|null
*/
public ?string $entryMode = null;
public ?string $authCode = null;

/**
* Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments.
* How the payment details were captured, for example `chip` or `contactless` for card-present payments and `customer entry` for card details entered by the payer. For wallet and alternative payment methods, this can identify the method, such as `apple pay` or `blik`.
*
* @var string|null
*/
public ?string $authCode = null;
public ?string $entryMode = null;

/**
* Short description of the payment. The value is taken from the `description` property of the related checkout resource.
Expand Down
7 changes: 7 additions & 0 deletions src/Types/TransactionHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ class TransactionHistory
*/
public ?int $installmentsCount = null;

/**
* How the payment details were captured, for example `chip` or `contactless` for card-present payments and `customer entry` for card details entered by the payer. For wallet and alternative payment methods, this can identify the method, such as `apple pay` or `blik`.
*
* @var string|null
*/
public ?string $entryMode = null;

/**
* Short description of the payment. The value is taken from the `description` property of the related checkout resource.
*
Expand Down
7 changes: 7 additions & 0 deletions src/Types/TransactionMixinHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
class TransactionMixinHistory
{
/**
* How the payment details were captured, for example `chip` or `contactless` for card-present payments and `customer entry` for card details entered by the payer. For wallet and alternative payment methods, this can identify the method, such as `apple pay` or `blik`.
*
* @var TransactionMixinHistoryEntryMode|null
*/
public ?TransactionMixinHistoryEntryMode $entryMode = null;

/**
* Short description of the payment. The value is taken from the `description` property of the related checkout resource.
*
Expand Down
42 changes: 42 additions & 0 deletions src/Types/TransactionMixinHistoryEntryMode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

/**
* How the payment details were captured, for example `chip` or `contactless` for card-present payments and `customer entry` for card details entered by the payer. For wallet and alternative payment methods, this can identify the method, such as `apple pay` or `blik`.
*/
enum TransactionMixinHistoryEntryMode: string
{
case NONE = 'none';
case MAGSTRIPE = 'magstripe';
case CHIP = 'chip';
case MANUAL_ENTRY = 'manual entry';
case CUSTOMER_ENTRY = 'customer entry';
case MAGSTRIPE_FALLBACK = 'magstripe fallback';
case CONTACTLESS = 'contactless';
case MOTO = 'moto';
case CONTACTLESS_MAGSTRIPE = 'contactless magstripe';
case BOLETO = 'boleto';
case DIRECT_DEBIT = 'direct debit';
case SOFORT = 'sofort';
case IDEAL = 'ideal';
case BANCONTACT = 'bancontact';
case EPS = 'eps';
case MYBANK = 'mybank';
case SATISPAY = 'satispay';
case BLIK = 'blik';
case P_24 = 'p24';
case GIROPAY = 'giropay';
case PIX = 'pix';
case QR_CODE_PIX = 'qr code pix';
case APPLE_PAY = 'apple pay';
case GOOGLE_PAY = 'google pay';
case SUMUP_GIFT_CARD = 'sumup gift card';
case PAYPAL = 'paypal';
case TWINT = 'twint';
case IRIS = 'iris';
case SUMUP_PAY = 'sumup pay';
case NA = 'na';
}
2 changes: 1 addition & 1 deletion tests/SumUpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function testSalesAndTokensUseTheConfiguredClientAndCurrentToken(): void
$sumup = new SumUp(['client' => $http, 'api_key' => 'original-key']);
$sumup->setDefaultAccessToken('updated-key');

$sumup->sales()->getSaleV10('merchant', 'sale');
$sumup->sales()->get('merchant', 'sale');
$sumup->tokens()->create('merchant', ['actions' => ['sales.read']]);

$requests = $http->getRequests();
Expand Down
Loading