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
622 changes: 605 additions & 17 deletions openapi.json

Large diffs are not rendered by default.

66 changes: 64 additions & 2 deletions src/Readers/Readers.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ class ReadersListResponse
/**
* Class Readers
*
* A reader represents a device that accepts payments. You can use the SumUp Solo to accept in-person payments.
*
* @package SumUp\Services
*/
class Readers implements SumUpService
Expand Down Expand Up @@ -269,6 +267,42 @@ public function createCheckout(string $merchantCode, string $readerId, \SumUp\Ty
], 'POST', $path);
}

/**
* Create a Go Reader Payment
*
* @param string $merchantCode Short unique identifier for the merchant.
* @param string $readerId The unique identifier of the reader.
* @param \SumUp\Types\ReaderPaymentRequestParams|array<string, mixed> $body Required request payload
* @param RequestOptions|null $requestOptions Optional typed request options
*
* @return \SumUp\Types\ReaderPaymentResponse
* @throws \SumUp\Exception\ApiException
* @throws \SumUp\Exception\UnexpectedApiException
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function createGoCheckout(string $merchantCode, string $readerId, \SumUp\Types\ReaderPaymentRequestParams|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\ReaderPaymentResponse
{
$path = sprintf('/v0/merchants/%s/readers/%s/go-checkout', rawurlencode((string) $merchantCode), rawurlencode((string) $readerId));
$payload = [];
$requestBody = $body;
if (is_array($requestBody)) {
$requestBody = \SumUp\Types\ReaderPaymentRequestParams::fromArray($requestBody);
}
$payload = RequestEncoder::encode($requestBody);
$headers = RequestHeaders::build($this->accessToken, $requestOptions);

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

return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\ReaderPaymentResponse::class, [
'400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'422' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
'500' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class],
], 'POST', $path);
}

/**
* Delete a reader
*
Expand Down Expand Up @@ -323,6 +357,34 @@ public function get(string $merchantCode, string $readerId, ?RequestOptions $req
], 'GET', $path);
}

/**
* Get a Reader Checkout
*
* @param string $merchantCode Merchant Code
* @param string $readerId The unique identifier of the Reader
* @param string $checkoutId The unique identifier of the Checkout
* @param RequestOptions|null $requestOptions Optional typed request options
*
* @return \SumUp\Types\GetReaderCheckoutResponse
* @throws \SumUp\Exception\ApiException
* @throws \SumUp\Exception\UnexpectedApiException
* @throws \SumUp\Exception\ConnectionException
* @throws \SumUp\Exception\SDKException
*/
public function getCheckout(string $merchantCode, string $readerId, string $checkoutId, ?RequestOptions $requestOptions = null): \SumUp\Types\GetReaderCheckoutResponse
{
$path = sprintf('/v0.1/merchants/%s/readers/%s/checkout/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $readerId), rawurlencode((string) $checkoutId));
$payload = [];
$headers = RequestHeaders::build($this->accessToken, $requestOptions);

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

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

/**
* Get a Reader Status
*
Expand Down
21 changes: 21 additions & 0 deletions src/Types/Affiliate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

class Affiliate
{
/**
*
* @var string
*/
public string $appId;

/**
*
* @var string
*/
public string $key;

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

declare(strict_types=1);

namespace SumUp\Types;

class Amount
{
/**
* Currency ISO 4217 code
*
* @var string
*/
public string $currency;

/**
* Amount in minor units (e.g. cents).
*
* @var int
*/
public int $value;

}
7 changes: 7 additions & 0 deletions src/Types/CreateReaderCheckoutResponseData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

class CreateReaderCheckoutResponseData
{
/**
* The checkout ID is a unique identifier for the checkout.
*
* @var string|null
*/
public ?string $checkoutId = null;

/**
* The client transaction ID is a unique identifier for the transaction that is generated for the client.
* It can be used later to fetch the transaction details via the [Transactions API](https://developer.sumup.com/api/transactions/get).
Expand Down
15 changes: 15 additions & 0 deletions src/Types/GetReaderCheckoutResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

class GetReaderCheckoutResponse
{
/**
*
* @var GetReaderCheckoutResponseData
*/
public GetReaderCheckoutResponseData $data;

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

declare(strict_types=1);

namespace SumUp\Types;

class GetReaderCheckoutResponseData
{
/**
* Type of the card. Required for some countries
*
* @var GetReaderCheckoutResponseDataCardType
*/
public GetReaderCheckoutResponseDataCardType $cardType;

/**
* Unique identifier for the checkout
*
* @var string
*/
public string $checkoutId;

/**
* Client transaction identifier associated with the checkout
*
* @var string
*/
public string $clientTransactionId;

/**
* Checkout creation timestamp
*
* @var string
*/
public string $createdAt;

/**
* Number of installments for the transaction. Required for some countries.
*
* @var int
*/
public int $installments;

/**
* Payment failure reason
*
* @var string|null
*/
public ?string $paymentFailureReason = null;

/**
* Payment status from payments v2 event
*
* @var string
*/
public string $paymentStatus;

/**
* Type of the payment. Required for some countries
*
* @var GetReaderCheckoutResponseDataPaymentType
*/
public GetReaderCheckoutResponseDataPaymentType $paymentType;

/**
* Reader firmware version
*
* @var string
*/
public string $readerFirmwareVersion;

/**
* Device serial number
*
* @var string
*/
public string $readerSerialNumber;

/**
* Current status of the checkout
*
* @var GetReaderCheckoutResponseDataStatus
*/
public GetReaderCheckoutResponseDataStatus $status;

/**
* Amount structure.
* The amount is represented as an integer value altogether with the currency and the minor unit.
* For example, EUR 1.00 is represented as value 100 with minor unit of 2.
*
* @var GetReaderCheckoutResponseDataTotalAmount
*/
public GetReaderCheckoutResponseDataTotalAmount $totalAmount;

/**
* Checkout last update timestamp
*
* @var string
*/
public string $updatedAt;

/**
* Checkout expiration timestamp. After this time, the checkout will be automatically cancelled.
*
* @var string
*/
public string $validUntil;

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

declare(strict_types=1);

namespace SumUp\Types;

/**
* Type of the card. Required for some countries
*/
enum GetReaderCheckoutResponseDataCardType: string
{
case CREDIT = 'credit';
case DEBIT = 'debit';
}
14 changes: 14 additions & 0 deletions src/Types/GetReaderCheckoutResponseDataPaymentType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

/**
* Type of the payment. Required for some countries
*/
enum GetReaderCheckoutResponseDataPaymentType: string
{
case CARD = 'card';
case PIX = 'pix';
}
16 changes: 16 additions & 0 deletions src/Types/GetReaderCheckoutResponseDataStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

/**
* Current status of the checkout
*/
enum GetReaderCheckoutResponseDataStatus: string
{
case PENDING = 'pending';
case SUCCESSFUL = 'successful';
case FAILED = 'failed';
case CANCELLED = 'cancelled';
}
39 changes: 39 additions & 0 deletions src/Types/GetReaderCheckoutResponseDataTotalAmount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace SumUp\Types;

/**
* Amount structure.
*
* The amount is represented as an integer value altogether with the currency and the minor unit.
*
* For example, EUR 1.00 is represented as value 100 with minor unit of 2.
*
*/
class GetReaderCheckoutResponseDataTotalAmount
{
/**
* Currency ISO 4217 code
*
* @var string
*/
public string $currency;

/**
* The minor units of the currency.
* It represents the number of decimals of the currency. For the currencies CLP, COP and HUF, the minor unit is 0.
*
* @var int
*/
public int $minorUnit;

/**
* Integer value of the amount.
*
* @var int
*/
public int $value;

}
3 changes: 1 addition & 2 deletions src/Types/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
class Reader
{
/**
* Unique identifier of the object.
* Note that this identifies the instance of the physical devices pairing with your SumUp account. If you [delete](https://developer.sumup.com/api/readers/delete-reader) a reader, and pair the device again, the ID will be different. Do not use this ID to refer to a physical device.
* Unique identifier of the reader that the payment is initiated on.
*
* @var string
*/
Expand Down
Loading
Loading