1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2012 |
6
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2017 |
7
|
|
|
* @package MShop |
8
|
|
|
* @subpackage Service |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
namespace Aimeos\MShop\Service\Provider\Payment; |
13
|
|
|
|
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Payment provider for pre-paid orders. |
17
|
|
|
* |
18
|
|
|
* @package MShop |
19
|
|
|
* @subpackage Service |
20
|
|
|
*/ |
21
|
|
|
class PrePay |
22
|
|
|
extends \Aimeos\MShop\Service\Provider\Payment\Base |
|
|
|
|
23
|
|
|
implements \Aimeos\MShop\Service\Provider\Payment\Iface |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* Cancels the authorization for the given order if supported. |
27
|
|
|
* |
28
|
|
|
* @param \Aimeos\MShop\Order\Item\Iface $order Order invoice object |
29
|
|
|
*/ |
30
|
|
|
public function cancel( \Aimeos\MShop\Order\Item\Iface $order ) |
31
|
|
|
{ |
32
|
|
|
$order->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_CANCELED ); |
33
|
|
|
$this->saveOrder( $order ); |
34
|
|
|
|
35
|
|
|
return $order; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Executes the payment again for the given order if supported. |
41
|
|
|
* This requires support of the payment gateway and token based payment |
42
|
|
|
* |
43
|
|
|
* @param \Aimeos\MShop\Order\Item\Iface $order Order invoice object |
44
|
|
|
* @return void |
45
|
|
|
*/ |
46
|
|
|
public function repay( \Aimeos\MShop\Order\Item\Iface $order ) |
47
|
|
|
{ |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Updates the orders for whose status updates have been received by the confirmation page |
53
|
|
|
* |
54
|
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request object with parameters and request body |
55
|
|
|
* @param \Aimeos\MShop\Order\Item\Iface $order Order item that should be updated |
56
|
|
|
* @return \Aimeos\MShop\Order\Item\Iface Updated order item |
57
|
|
|
* @throws \Aimeos\MShop\Service\Exception If updating the orders failed |
58
|
|
|
*/ |
59
|
|
|
public function updateSync( \Psr\Http\Message\ServerRequestInterface $request, \Aimeos\MShop\Order\Item\Iface $order ) |
60
|
|
|
{ |
61
|
|
|
$order->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_PENDING ); |
62
|
|
|
$this->saveOrder( $order ); |
63
|
|
|
|
64
|
|
|
return $order; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Checks what features the payment provider implements. |
70
|
|
|
* |
71
|
|
|
* @param integer $what Constant from abstract class |
72
|
|
|
* @return boolean True if feature is available in the payment provider, false if not |
73
|
|
|
*/ |
74
|
|
|
public function isImplemented( $what ) |
75
|
|
|
{ |
76
|
|
|
return $what === \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_CANCEL; |
77
|
|
|
} |
78
|
|
|
} |