1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* PHP version 5.4 and 7 |
5
|
|
|
* |
6
|
|
|
* @category RequestEntity |
7
|
|
|
* @package Payever\Payments |
8
|
|
|
* @author payever GmbH <[email protected]> |
9
|
|
|
* @copyright 2017-2021 payever GmbH |
10
|
|
|
* @license MIT <https://opensource.org/licenses/MIT> |
11
|
|
|
* @link https://docs.payever.org/shopsystems/api/getting-started |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Payever\ExternalIntegration\Payments\Http\RequestEntity; |
15
|
|
|
|
16
|
|
|
use Payever\ExternalIntegration\Payments\Http\MessageEntity\CartItemEntity; |
17
|
|
|
use Payever\ExternalIntegration\Payments\Http\MessageEntity\PaymentDataEntity; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* This class represents Create Payment RequestInterface Entity |
21
|
|
|
* |
22
|
|
|
* @method string getChannel() |
23
|
|
|
* @method integer getChannelSetId() |
24
|
|
|
* @method float getAmount() |
25
|
|
|
* @method float getFee() |
26
|
|
|
* @method string getOrderId() |
27
|
|
|
* @method string getCurrency() |
28
|
|
|
* @method CartItemEntity[] getCart() |
29
|
|
|
* @method PaymentDataEntity|null getPaymentData() |
30
|
|
|
* @method string getSalutation() |
31
|
|
|
* @method string getPaymentMethod() |
32
|
|
|
* @method string|null getVariantId() |
33
|
|
|
* @method string getFirstName() |
34
|
|
|
* @method string getLastName() |
35
|
|
|
* @method string getStreet() |
36
|
|
|
* @method string getStreetNumber() |
37
|
|
|
* @method string getZip() |
38
|
|
|
* @method string getCity() |
39
|
|
|
* @method string getCountry() |
40
|
|
|
* @method string getSocialSecurityNumber() |
41
|
|
|
* @method \DateTime|false getBirthdate() |
42
|
|
|
* @method string getPhone() |
43
|
|
|
* @method string getEmail() |
44
|
|
|
* @method string getSuccessUrl() |
45
|
|
|
* @method string getFailureUrl() |
46
|
|
|
* @method string getCancelUrl() |
47
|
|
|
* @method string getNoticeUrl() |
48
|
|
|
* @method string getPendingUrl() |
49
|
|
|
* @method string getXFrameHost() |
50
|
|
|
* @method string getPluginVersion() |
51
|
|
|
* @method self setChannel(string $channel) |
52
|
|
|
* @method self setChannelSetId(int $id) |
53
|
|
|
* @method self setAmount(float $amount) |
54
|
|
|
* @method self setFee(float $fee) |
55
|
|
|
* @method self setOrderId(string $id) |
56
|
|
|
* @method self setPaymentMethod(string $method) |
57
|
|
|
* @method self setVariantId(string|null $variantId) |
58
|
|
|
* @method self setCurrency(string $currency) |
59
|
|
|
* @method self setSalutation(string $salutation) |
60
|
|
|
* @method self setFirstName(string $name) |
61
|
|
|
* @method self setLastName(string $name) |
62
|
|
|
* @method self setStreet(string $street) |
63
|
|
|
* @method self setStreetNumber(string $streetNumber) |
64
|
|
|
* @method self setZip(string $zip) |
65
|
|
|
* @method self setCity(string $city) |
66
|
|
|
* @method self setCountry(string $country) |
67
|
|
|
* @method self setSocialSecurityNumber(string $ssn) |
68
|
|
|
* @method self setPhone(string $phone) |
69
|
|
|
* @method self setEmail(string $email) |
70
|
|
|
* @method self setSuccessUrl(string $url) |
71
|
|
|
* @method self setFailureUrl(string $url) |
72
|
|
|
* @method self setCancelUrl(string $url) |
73
|
|
|
* @method self setNoticeUrl(string $url) |
74
|
|
|
* @method self setPendingUrl(string $url) |
75
|
|
|
* @method self setXFrameHost(string $host) |
76
|
|
|
* @method self setPluginVersion(string $version) |
77
|
|
|
*/ |
78
|
|
|
class SubmitPaymentRequest extends CreatePaymentRequest |
79
|
|
|
{ |
80
|
|
|
/** @var PaymentDataEntity $paymentData */ |
81
|
|
|
protected $paymentData; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* {@inheritdoc} |
85
|
|
|
*/ |
86
|
|
|
public function isValid() |
87
|
|
|
{ |
88
|
|
|
if (!$this->paymentData instanceof PaymentDataEntity) { |
89
|
|
|
return false; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
return parent::isValid(); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Sets payment data |
97
|
|
|
* |
98
|
|
|
* @param array|string $paymentData |
99
|
|
|
* |
100
|
|
|
* @return $this |
101
|
|
|
*/ |
102
|
|
|
public function setPaymentData($paymentData) |
103
|
|
|
{ |
104
|
|
|
if (!$paymentData) { |
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
if (is_string($paymentData)) { |
109
|
|
|
$paymentData = json_decode($paymentData, true); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
if (!is_array($paymentData)) { |
113
|
|
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
$this->paymentData = new PaymentDataEntity($paymentData); |
117
|
|
|
|
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|