Skip to content
Open
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
890 changes: 788 additions & 102 deletions openapi.json

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions src/Checkouts/Checkouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,43 @@ public function listAvailablePaymentMethods(string $merchantCode, ?CheckoutsList
], 'GET', $path);
}

/**
* Process a checkout
*
* @param string $checkoutId Unique identifier of the checkout resource.
* @param \SumUp\Types\ProcessCheckout|array<string, mixed> $body Required request payload
* @param RequestOptions|null $requestOptions Optional typed request options
*
* @return mixed|\SumUp\Types\CheckoutAccepted
* @throws \SumUp\Exception\ApiException
* @throws \SumUp\Exception\UnexpectedApiException
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function process(string $checkoutId, \SumUp\Types\ProcessCheckout|array $body, ?RequestOptions $requestOptions = null)
{
$path = sprintf('/v0.1/checkouts/%s', rawurlencode((string) $checkoutId));
$payload = [];
$requestBody = $body;
if (is_array($requestBody)) {
$requestBody = \SumUp\Types\ProcessCheckout::fromArray($requestBody);
}
$payload = RequestEncoder::encode($requestBody);
$headers = RequestHeaders::build($this->accessToken, $requestOptions);

$response = $this->client->send('PUT', $path, $payload, $headers, $requestOptions);

return ResponseDecoder::decodeOrThrow($response, [
'200' => ['type' => 'mixed'],
'202' => ['type' => 'class', 'class' => \SumUp\Types\CheckoutAccepted::class],
], [
'400' => ['type' => 'mixed'],
'401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class],
'409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class],
], 'PUT', $path);
}

/**
* Update a checkout
*
Expand Down
10 changes: 10 additions & 0 deletions src/Members/Members.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ class MembersListParams
*/
public ?string $userId = null;

/**
* Filter the returned members by user type. Repeat this parameter to include multiple user types.
*
* @var string[]|null
*/
public ?array $userType = null;

/**
* Filter the returned members by the membership status.
*
Expand Down Expand Up @@ -446,6 +453,9 @@ public function list(string $merchantCode, ?MembersListParams $queryParams = nul
if (isset($queryParams->userId)) {
$queryParamsData['user.id'] = $queryParams->userId;
}
if (isset($queryParams->userType)) {
$queryParamsData['user.type'] = $queryParams->userType;
}
if (isset($queryParams->status)) {
$queryParamsData['status'] = $queryParams->status;
}
Expand Down
93 changes: 3 additions & 90 deletions src/Merchants/Merchants.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,6 @@
use SumUp\HttpClient\RequestOptions;
use SumUp\ResponseDecoder;

/**
* Query parameters for MerchantsGetParams.
*
* @package SumUp\Services
*/
class MerchantsGetParams
{
/**
* The version of the resource. At the moment, the only supported value is `latest`. When provided and the requested resource's `change_status` is pending, the resource will be returned with all pending changes applied. When no changes are pending the resource is returned as is. The `change_status` in the response body will reflect the current state of the resource.
*
* @var string|null
*/
public ?string $version = null;

}

/**
* Query parameters for MerchantsGetPersonParams.
*
* @package SumUp\Services
*/
class MerchantsGetPersonParams
{
/**
* The version of the resource. At the moment, the only supported value is `latest`. When provided and the requested resource's `change_status` is pending, the resource will be returned with all pending changes applied. When no changes are pending the resource is returned as is. The `change_status` in the response body will reflect the current state of the resource.
*
* @var string|null
*/
public ?string $version = null;

}

/**
* Query parameters for MerchantsListPersonsParams.
*
* @package SumUp\Services
*/
class MerchantsListPersonsParams
{
/**
* The version of the resource. At the moment, the only supported value is `latest`. When provided and the requested resource's `change_status` is pending, the resource will be returned with all pending changes applied. When no changes are pending the resource is returned as is. The `change_status` in the response body will reflect the current state of the resource.
*
* @var string|null
*/
public ?string $version = null;

}

/**
* Class Merchants
*
Expand Down Expand Up @@ -98,7 +50,6 @@ public function __construct(HttpClientInterface $client, string $accessToken)
* Get Merchant
*
* @param string $merchantCode Short unique identifier for the merchant.
* @param MerchantsGetParams|null $queryParams Optional query string parameters
* @param RequestOptions|null $requestOptions Optional typed request options
*
* @return \SumUp\Types\Merchant
Expand All @@ -107,21 +58,9 @@ public function __construct(HttpClientInterface $client, string $accessToken)
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function get(string $merchantCode, ?MerchantsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\Merchant
public function get(string $merchantCode, ?RequestOptions $requestOptions = null): \SumUp\Types\Merchant
{
$path = sprintf('/v1/merchants/%s', rawurlencode((string) $merchantCode));
if ($queryParams !== null) {
$queryParamsData = [];
if (isset($queryParams->version)) {
$queryParamsData['version'] = $queryParams->version;
}
if (!empty($queryParamsData)) {
$queryString = http_build_query($queryParamsData);
if (!empty($queryString)) {
$path .= '?' . $queryString;
}
}
}
$payload = [];
$headers = RequestHeaders::build($this->accessToken, $requestOptions);

Expand All @@ -137,7 +76,6 @@ public function get(string $merchantCode, ?MerchantsGetParams $queryParams = nul
*
* @param string $merchantCode Short unique identifier for the merchant.
* @param string $personId Person ID
* @param MerchantsGetPersonParams|null $queryParams Optional query string parameters
* @param RequestOptions|null $requestOptions Optional typed request options
*
* @return \SumUp\Types\Person
Expand All @@ -146,21 +84,9 @@ public function get(string $merchantCode, ?MerchantsGetParams $queryParams = nul
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function getPerson(string $merchantCode, string $personId, ?MerchantsGetPersonParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\Person
public function getPerson(string $merchantCode, string $personId, ?RequestOptions $requestOptions = null): \SumUp\Types\Person
{
$path = sprintf('/v1/merchants/%s/persons/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $personId));
if ($queryParams !== null) {
$queryParamsData = [];
if (isset($queryParams->version)) {
$queryParamsData['version'] = $queryParams->version;
}
if (!empty($queryParamsData)) {
$queryString = http_build_query($queryParamsData);
if (!empty($queryString)) {
$path .= '?' . $queryString;
}
}
}
$payload = [];
$headers = RequestHeaders::build($this->accessToken, $requestOptions);

Expand All @@ -175,7 +101,6 @@ public function getPerson(string $merchantCode, string $personId, ?MerchantsGetP
* List Persons
*
* @param string $merchantCode Short unique identifier for the merchant.
* @param MerchantsListPersonsParams|null $queryParams Optional query string parameters
* @param RequestOptions|null $requestOptions Optional typed request options
*
* @return \SumUp\Types\ListPersonsResponseBody
Expand All @@ -184,21 +109,9 @@ public function getPerson(string $merchantCode, string $personId, ?MerchantsGetP
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function listPersons(string $merchantCode, ?MerchantsListPersonsParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\ListPersonsResponseBody
public function listPersons(string $merchantCode, ?RequestOptions $requestOptions = null): \SumUp\Types\ListPersonsResponseBody
{
$path = sprintf('/v1/merchants/%s/persons', rawurlencode((string) $merchantCode));
if ($queryParams !== null) {
$queryParamsData = [];
if (isset($queryParams->version)) {
$queryParamsData['version'] = $queryParams->version;
}
if (!empty($queryParamsData)) {
$queryString = http_build_query($queryParamsData);
if (!empty($queryString)) {
$path .= '?' . $queryString;
}
}
}
$payload = [];
$headers = RequestHeaders::build($this->accessToken, $requestOptions);

Expand Down
61 changes: 61 additions & 0 deletions src/Types/Card.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

/**
* __Required when payment type is `card`.__ Details of the payment card.
*/
class Card
{
/**
* Name of the cardholder as it appears on the payment card.
*
* @var string
*/
public string $name;

/**
* Number of the payment card (without spaces).
*
* @var string
*/
public string $number;

/**
* Two- or four-digit expiration year in `YY` or `YYYY` format.
*
* @var string
*/
public string $expiryYear;

/**
* Two-digit expiration month, from `01` through `12`.
*
* @var string
*/
public string $expiryMonth;

/**
* Three or four-digit card verification value (security code) of the payment card.
*
* @var string
*/
public string $cvv;

/**
* Required five-digit ZIP code. Applicable only to merchant users in the USA.
*
* @var string|null
*/
public ?string $zipCode = null;

/**
* Issuing card network of the payment card used for the transaction.
*
* @var CardType
*/
public CardType $type;

}
36 changes: 36 additions & 0 deletions src/Types/CardType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

/**
* Issuing card network of the payment card used for the transaction.
*/
enum CardType: string
{
case ALELO = 'ALELO';
case AMEX = 'AMEX';
case CONECS = 'CONECS';
case CUP = 'CUP';
case DINERS = 'DINERS';
case DISCOVER = 'DISCOVER';
case EFTPOS = 'EFTPOS';
case ELO = 'ELO';
case ELV = 'ELV';
case GIROCARD = 'GIROCARD';
case HIPERCARD = 'HIPERCARD';
case INTERAC = 'INTERAC';
case JCB = 'JCB';
case MAESTRO = 'MAESTRO';
case MASTERCARD = 'MASTERCARD';
case PLUXEE = 'PLUXEE';
case SWILE = 'SWILE';
case TICKET = 'TICKET';
case VISA = 'VISA';
case VISA_ELECTRON = 'VISA_ELECTRON';
case VISA_VPAY = 'VISA_VPAY';
case VPAY = 'VPAY';
case VR = 'VR';
case UNKNOWN = 'UNKNOWN';
}
19 changes: 19 additions & 0 deletions src/Types/CheckoutAccepted.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

/**
* Response returned when checkout processing requires an additional payer action, such as a 3DS challenge or a redirect to an external payment method page.
*/
class CheckoutAccepted
{
/**
* Instructions for the next action the payer or client must take.
*
* @var CheckoutAcceptedNextStep|null
*/
public ?CheckoutAcceptedNextStep $nextStep = null;

}
47 changes: 47 additions & 0 deletions src/Types/CheckoutAcceptedNextStep.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

/**
* Instructions for the next action the payer or client must take.
*/
class CheckoutAcceptedNextStep
{
/**
* URL to open or submit in order to continue processing.
*
* @var string|null
*/
public ?string $url = null;

/**
* HTTP method to use when following the next step.
*
* @var string|null
*/
public ?string $method = null;

/**
* Merchant URL where the payer returns after the external flow finishes.
*
* @var string|null
*/
public ?string $redirectUrl = null;

/**
* Allowed presentation mechanisms for the next step. `iframe` means the flow can be embedded, while `browser` means it can be completed through a full-page redirect.
*
* @var string[]|null
*/
public ?array $mechanism = null;

/**
* Parameters required to complete the next step. The exact keys depend on the payment provider and flow type.
*
* @var array<string, mixed>|null
*/
public ?array $payload = null;

}
Loading
Loading