Skip to content

Commit 5cb1723

Browse files
add payment setups support (#296)
This pull request introduces significant new functionality to support payment setups in the Checkout API, including the addition of new client classes, data models, and enhancements to existing payment and industry data structures. The main focus is on expanding the API's support for more complex payment setup scenarios, such as customer details, industry-specific data, and a variety of payment methods.
1 parent 67a1506 commit 5cb1723

27 files changed

+907
-2
lines changed

lib/Checkout/CheckoutApi.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Checkout\Payments\Links\PaymentLinksClient;
1818
use Checkout\Payments\PaymentsClient;
1919
use Checkout\Payments\Sessions\PaymentSessionsClient;
20+
use Checkout\Payments\Setups\PaymentSetupsClient;
2021
use Checkout\Reports\ReportsClient;
2122
use Checkout\Risk\RiskClient;
2223
use Checkout\Sessions\SessionsClient;
@@ -48,6 +49,8 @@ final class CheckoutApi extends CheckoutApmApi
4849

4950
private $paymentSessionsClient;
5051

52+
private $paymentSetupsClient;
53+
5154
private $forwardClient;
5255

5356
public function __construct(CheckoutConfiguration $configuration)
@@ -71,6 +74,7 @@ public function __construct(CheckoutConfiguration $configuration)
7174
$this->issuingClient = new IssuingClient($baseApiClient, $configuration);
7275
$this->paymentContextClient = new PaymentContextsClient($baseApiClient, $configuration);
7376
$this->paymentSessionsClient = new PaymentSessionsClient($baseApiClient, $configuration);
77+
$this->paymentSetupsClient = new PaymentSetupsClient($baseApiClient, $configuration);
7478
$this->forwardClient = new ForwardClient($baseApiClient, $configuration);
7579
$this->balancesClient = new BalancesClient(
7680
$this->getBalancesApiClient($configuration),
@@ -247,6 +251,14 @@ public function getPaymentSessionsClient()
247251
return $this->paymentSessionsClient;
248252
}
249253

254+
/**
255+
* @return PaymentSetupsClient
256+
*/
257+
public function getPaymentSetupsClient()
258+
{
259+
return $this->paymentSetupsClient;
260+
}
261+
250262
/**
251263
* @return ForwardClient
252264
*/

lib/Checkout/Payments/Destination/PaymentRequestIdDestination.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Checkout\Payments\Destination;
44

55
use Checkout\Payments\PaymentDestinationType;
6+
use Checkout\Common\AccountHolder;
67

78
class PaymentRequestIdDestination extends PaymentRequestDestination
89
{

lib/Checkout/Payments/FlightLegDetails.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Checkout\Payments;
44

5+
use DateTime;
6+
57
class FlightLegDetails
68
{
79
/**
@@ -30,7 +32,7 @@ class FlightLegDetails
3032

3133
/**
3234
* The departure date in YYYY-MM-DD format.
33-
* @var string
35+
* @var DateTime
3436
*/
3537
public $departure_date;
3638

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace Checkout\Payments\Setups\Common\Customer;
4+
5+
use Checkout\Common\Phone;
6+
7+
class Customer
8+
{
9+
/**
10+
* @var Email
11+
*/
12+
public $email;
13+
14+
/**
15+
* @var string
16+
*/
17+
public $name;
18+
19+
/**
20+
* @var Phone
21+
*/
22+
public $phone;
23+
24+
/**
25+
* @var Device
26+
*/
27+
public $device;
28+
29+
/**
30+
* @var MerchantAccount
31+
*/
32+
public $merchant_account;
33+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Checkout\Payments\Setups\Common\Customer;
4+
5+
class Device
6+
{
7+
/**
8+
* @var string
9+
*/
10+
public $locale;
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Checkout\Payments\Setups\Common\Customer;
4+
5+
class Email
6+
{
7+
/**
8+
* @var string
9+
*/
10+
public $address;
11+
12+
/**
13+
* @var bool
14+
*/
15+
public $verified;
16+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace Checkout\Payments\Setups\Common\Customer;
4+
5+
use DateTime;
6+
7+
class MerchantAccount
8+
{
9+
/**
10+
* @var string
11+
*/
12+
public $id;
13+
14+
/**
15+
* @var DateTime
16+
*/
17+
public $registration_date;
18+
19+
/**
20+
* @var DateTime
21+
*/
22+
public $last_modified;
23+
24+
/**
25+
* @var bool
26+
*/
27+
public $returning_customer;
28+
29+
/**
30+
* @var DateTime
31+
*/
32+
public $first_transaction_date;
33+
34+
/**
35+
* @var DateTime
36+
*/
37+
public $last_transaction_date;
38+
39+
/**
40+
* @var int
41+
*/
42+
public $total_order_count;
43+
44+
/**
45+
* @var int
46+
*/
47+
public $last_payment_amount;
48+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Checkout\Payments\Setups\Common\Industry;
4+
5+
use Checkout\Payments\Ticket;
6+
7+
class AirlineData
8+
{
9+
/**
10+
* @var Ticket
11+
*/
12+
public $ticket;
13+
14+
/**
15+
* @var array of Passenger
16+
*/
17+
public $passengers;
18+
19+
/**
20+
* @var array of FlightLegDetails
21+
*/
22+
public $flight_leg_details;
23+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Checkout\Payments\Setups\Common\Industry;
4+
5+
use Checkout\Payments\AccommodationData;
6+
7+
class Industry
8+
{
9+
/**
10+
* @var AirlineData
11+
*/
12+
public $airline_data;
13+
14+
/**
15+
* @var AccommodationData
16+
*/
17+
public $accommodation_data;
18+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Checkout\Payments\Setups\Common\Order;
4+
5+
use Checkout\Payments\ShippingDetails;
6+
7+
class Order
8+
{
9+
/**
10+
* @var array of Product
11+
*/
12+
public $items;
13+
14+
/**
15+
* @var ShippingDetails
16+
*/
17+
public $shipping;
18+
19+
/**
20+
* @var array of OrderSubMerchant
21+
*/
22+
public $sub_merchants;
23+
24+
/**
25+
* @var int
26+
*/
27+
public $discount_amount;
28+
}

0 commit comments

Comments
 (0)