1 | <?php |
||
29 | final class PaymentContext implements Context |
||
30 | { |
||
31 | /** |
||
32 | * @var SharedStorageInterface |
||
33 | */ |
||
34 | private $sharedStorage; |
||
35 | |||
36 | /** |
||
37 | * @var PaymentMethodRepositoryInterface |
||
38 | */ |
||
39 | private $paymentMethodRepository; |
||
40 | |||
41 | /** |
||
42 | * @var FactoryInterface |
||
43 | */ |
||
44 | private $paymentMethodFactory; |
||
45 | |||
46 | /** |
||
47 | * @var FactoryInterface |
||
48 | */ |
||
49 | private $paymentMethodTranslationFactory; |
||
50 | |||
51 | /** |
||
52 | * @var PaymentMethodNameToGatewayConverterInterface |
||
53 | */ |
||
54 | private $paymentMethodNameToGatewayConverter; |
||
55 | |||
56 | /** |
||
57 | * @var ObjectManager |
||
58 | */ |
||
59 | private $objectManager; |
||
60 | |||
61 | /** |
||
62 | * @param SharedStorageInterface $sharedStorage |
||
63 | * @param PaymentMethodRepositoryInterface $paymentMethodRepository |
||
64 | * @param FactoryInterface $paymentMethodFactory |
||
65 | * @param FactoryInterface $paymentMethodTranslationFactory |
||
66 | * @param PaymentMethodNameToGatewayConverterInterface $paymentMethodNameToGatewayConverter |
||
67 | * @param ObjectManager $objectManager |
||
68 | */ |
||
69 | public function __construct( |
||
84 | |||
85 | /** |
||
86 | * @Given the store (also )allows paying (with ):paymentMethodName |
||
87 | * @Given the store (also )allows paying with :paymentMethodName at position :position |
||
88 | */ |
||
89 | public function storeAllowsPaying($paymentMethodName, $position = null) |
||
90 | { |
||
91 | $this->createPaymentMethod($paymentMethodName, 'PM_'.$paymentMethodName, 'Payment method', true, $position); |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * @Given the store has a payment method :paymentMethodName with a code :paymentMethodCode |
||
96 | */ |
||
97 | public function theStoreHasAPaymentMethodWithACode($paymentMethodName, $paymentMethodCode) |
||
101 | |||
102 | /** |
||
103 | * @Given /^(this payment method) is named "([^"]+)" in the "([^"]+)" locale$/ |
||
104 | */ |
||
105 | public function thisPaymentMethodIsNamedIn(PaymentMethodInterface $paymentMethod, $name, $locale) |
||
116 | |||
117 | /** |
||
118 | * @Given the payment method :paymentMethod is disabled |
||
119 | * @Given /^(this payment method) is disabled$/ |
||
120 | */ |
||
121 | public function theStoreHasAPaymentMethodDisabled(PaymentMethodInterface $paymentMethod) |
||
127 | |||
128 | /** |
||
129 | * @Given /^(it) has instructions "([^"]+)"$/ |
||
130 | */ |
||
131 | public function itHasInstructions(PaymentMethodInterface $paymentMethod, $instructions) |
||
137 | |||
138 | /** |
||
139 | * @Given the store has :paymentMethodName payment method not assigned to any channel |
||
140 | */ |
||
141 | public function theStoreHasPaymentMethodNotAssignedToAnyChannel($paymentMethodName) |
||
145 | |||
146 | /** |
||
147 | * @param string $name |
||
148 | * @param string $code |
||
149 | * @param bool $addForCurrentChannel |
||
150 | * @param string $description |
||
151 | */ |
||
152 | private function createPaymentMethod($name, $code, $description = '', $addForCurrentChannel = true, $position = null) |
||
169 | } |
||
170 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.