-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
CheckoutManagerInterface.php
208 lines (187 loc) · 5.98 KB
/
CheckoutManagerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?php
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Enterprise License (PEL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PEL
*/
namespace Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager;
use Pimcore\Bundle\EcommerceFrameworkBundle\CartManager\CartInterface;
use Pimcore\Bundle\EcommerceFrameworkBundle\Exception\UnsupportedException;
use Pimcore\Bundle\EcommerceFrameworkBundle\Model\AbstractOrder;
use Pimcore\Bundle\EcommerceFrameworkBundle\Model\AbstractPaymentInformation;
use Pimcore\Bundle\EcommerceFrameworkBundle\PaymentManager\Payment\PaymentInterface;
use Pimcore\Bundle\EcommerceFrameworkBundle\PaymentManager\StatusInterface;
interface CheckoutManagerInterface
{
/**
* Returns all checkout steps defined for this checkout
*
* @return CheckoutStepInterface[]
*/
public function getCheckoutSteps();
/**
* Returns checkout step with given name
*
* @param string $stepName
*
* @return CheckoutStepInterface
*/
public function getCheckoutStep($stepName);
/**
* Returns current checkout step
*
* @return CheckoutStepInterface
*/
public function getCurrentStep();
/**
* Returns the cart the checkout is started with
*
* @return CartInterface
*/
public function getCart();
/**
* Commits checkout step
*
* All previous steps must be committed, otherwise committing step is not allowed
*
* @param CheckoutStepInterface $step
* @param mixed $data
*
* @return bool
*/
public function commitStep(CheckoutStepInterface $step, $data);
/**
* Checks if checkout is finished (= all checkout steps are committed)
* only a finished checkout can be committed
*
* @return bool
*/
public function isFinished();
/**
* Returns if there currently is an active payment (init or pending)
*
* @return bool
*/
public function hasActivePayment();
/**
* Init payment for checkout - only possible if payment provider is configured
* creates PaymentInformation with init state, does not change order state
*
* @return AbstractPaymentInformation
*
* @throws UnsupportedException
*/
public function initOrderPayment();
/**
* Starts payment for checkout - only possible if payment provider is configured
* sets cart to read only mode since it must not changed during ongoing payment process
*
* @return AbstractPaymentInformation
*
* @throws UnsupportedException
*
* @deprecated use V7/startOrderPaymentWithPaymentProvider instead
*/
public function startOrderPayment();
/**
* Cancels payment for current payment info
*
* - payment will be cancelled, order state will be resetted and cart will we writable again.
*
* -> this should be used, when user cancels payment
*
* Only possible when payment state is PENDING, otherwise exception is thrown
*
* @return null|AbstractOrder
*
* @throws UnsupportedException
*/
public function cancelStartedOrderPayment();
/**
* Returns order (creates it if not available yet)
*
* @return AbstractOrder
*/
public function getOrder();
/**
* Facade method for
*
* - handling payment response and
* - commit order payment
*
* Always handles payment and updates payment information - even if order is already committed or checkout is not
* finished (anymore)
*
* Use this for committing order when payment is activated
*
* Delegates to commit order processor
*
* @param array|StatusInterface $paymentResponseParams
*
* @return AbstractOrder
*/
public function handlePaymentResponseAndCommitOrderPayment($paymentResponseParams);
/**
* Start and commits payment based on a previously performed payment
* provided via the source order.
*
* @param AbstractOrder $sourceOrder
* @param string $customerId Only allow recurring payment to be performed on source-orders of the same user
*
* @return AbstractOrder
*/
public function startAndCommitRecurringOrderPayment(AbstractOrder $sourceOrder, string $customerId);
/**
* Commits order payment
*
* - updates order payment information in order object
* - only when payment status == [ORDER_STATE_COMMITTED, ORDER_STATE_PAYMENT_AUTHORIZED] -> order is committed
*
* Delegates to commit order processor
*
* @deprecated use handlePaymentResponseAndCommitOrderPayment instead
*
* @param AbstractOrder $sourceOrder
* @param StatusInterface $status
*
* @return AbstractOrder
*/
public function commitOrderPayment(StatusInterface $status, AbstractOrder $sourceOrder);
/**
* Commits order - does not consider any payment
*
* Use this for committing order when no payment is activated
*
* Delegates to commit order processor
*
* @return AbstractOrder
*/
public function commitOrder();
/**
* Returns if checkout process and subsequently order is committed
* basically checks, if order is available and if this order is committed
*
* @return bool
*/
public function isCommitted();
/**
* Returns payment adapter
*
* @return PaymentInterface|null
*/
public function getPayment();
/**
* Cleans up orders with state pending payment after 1h -> delegates this to commit order processor
*
* @return void
*/
public function cleanUpPendingOrders();
}
class_alias(CheckoutManagerInterface::class, 'Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager\ICheckoutManager');