|
8 | 8 | use Pronamic\WordPress\Pay\Core\PaymentMethod; |
9 | 9 | use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods; |
10 | 10 | use Pronamic\WordPress\Pay\Core\PaymentMethodsCollection; |
11 | | -use Pronamic\WordPress\Pay\Fields\CachedCallbackOptions; |
12 | | -use Pronamic\WordPress\Pay\Fields\IDealIssuerSelectField; |
13 | | -use Pronamic\WordPress\Pay\Fields\SelectFieldOption; |
14 | | -use Pronamic\WordPress\Pay\Fields\SelectFieldOptionGroup; |
15 | 11 | use Pronamic\WordPress\Pay\Payments\Payment; |
16 | 12 | use Pronamic\WordPress\Pay\Payments\PaymentStatus; |
17 | 13 | use Pronamic\WordPress\Pay\Refunds\Refund; |
@@ -57,29 +53,12 @@ public function __construct( Config $config ) { |
57 | 53 | ]; |
58 | 54 |
|
59 | 55 | // Methods. |
60 | | - $ideal_payment_method = new PaymentMethod( Core_PaymentMethods::IDEAL ); |
61 | | - |
62 | | - $ideal_issuer_field = new IDealIssuerSelectField( 'ideal-issuer' ); |
63 | | - |
64 | | - $ideal_issuer_field->set_required( true ); |
65 | | - |
66 | | - $ideal_issuer_field->set_options( |
67 | | - new CachedCallbackOptions( |
68 | | - function() { |
69 | | - return $this->get_ideal_issuers(); |
70 | | - }, |
71 | | - 'pronamic_pay_ideal_issuers_' . \md5( (string) \wp_json_encode( $config ) ) |
72 | | - ) |
73 | | - ); |
74 | | - |
75 | | - $ideal_payment_method->add_field( $ideal_issuer_field ); |
76 | | - |
77 | 56 | $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::AMERICAN_EXPRESS ) ); |
78 | 57 | $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::BANK_TRANSFER ) ); |
79 | 58 | $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::BANCONTACT ) ); |
80 | 59 | $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::CREDIT_CARD ) ); |
81 | 60 | $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::GIROPAY ) ); |
82 | | - $this->register_payment_method( $ideal_payment_method ); |
| 61 | + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::IDEAL ) ); |
83 | 62 | $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::MAESTRO ) ); |
84 | 63 | $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::MASTERCARD ) ); |
85 | 64 | $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::PAYPAL ) ); |
@@ -177,62 +156,6 @@ private function maybe_enrich_payment_methods() { |
177 | 156 | } |
178 | 157 | } |
179 | 158 |
|
180 | | - /** |
181 | | - * Get iDEAL issuers. |
182 | | - * |
183 | | - * @link https://dev.buckaroo.nl/Playground |
184 | | - * @since 1.2.4 |
185 | | - * @return iterable<SelectFieldOption|SelectFieldOptionGroup> |
186 | | - */ |
187 | | - private function get_ideal_issuers() { |
188 | | - // Get iDEAL issuers. |
189 | | - $object = $this->request( 'GET', 'Transaction/Specification/ideal?serviceVersion=2' ); |
190 | | - |
191 | | - if ( \property_exists( $object, 'Version' ) && 0 === $object->Version ) { |
192 | | - throw new \Exception( |
193 | | - \sprintf( |
194 | | - 'No versioned specification found for iDEAL payment method: version: "%s", name: "%s".', |
195 | | - $object->Version, |
196 | | - \property_exists( $object, 'Name' ) ? $object->Name : '' |
197 | | - ) |
198 | | - ); |
199 | | - } |
200 | | - |
201 | | - $groups = []; |
202 | | - |
203 | | - $actions_pay = []; |
204 | | - |
205 | | - if ( \property_exists( $object, 'Actions' ) ) { |
206 | | - $actions_pay = \array_filter( |
207 | | - $object->Actions, |
208 | | - function ( $action ) { |
209 | | - return 'Pay' === $action->Name; |
210 | | - } |
211 | | - ); |
212 | | - } |
213 | | - |
214 | | - foreach ( $actions_pay as $action ) { |
215 | | - $request_parameters = \array_filter( |
216 | | - $action->RequestParameters, |
217 | | - function( $request_parameter ) { |
218 | | - return 'issuer' === $request_parameter->Name; |
219 | | - } |
220 | | - ); |
221 | | - |
222 | | - foreach ( $request_parameters as $request_parameter ) { |
223 | | - foreach ( $request_parameter->ListItemDescriptions as $item ) { |
224 | | - if ( ! \array_key_exists( $item->GroupName, $groups ) ) { |
225 | | - $groups[ $item->GroupName ] = new SelectFieldOptionGroup( $item->GroupName ); |
226 | | - } |
227 | | - |
228 | | - $groups[ $item->GroupName ]->options[] = new SelectFieldOption( $item->Value, $item->Description ); |
229 | | - } |
230 | | - } |
231 | | - } |
232 | | - |
233 | | - return array_values( $groups ); |
234 | | - } |
235 | | - |
236 | 159 | /** |
237 | 160 | * Request transaction specifications. |
238 | 161 | * |
@@ -463,12 +386,6 @@ public function start( Payment $payment ) { |
463 | 386 | $data->Services->ServiceList[] = (object) [ |
464 | 387 | 'Action' => 'Pay', |
465 | 388 | 'Name' => 'ideal', |
466 | | - 'Parameters' => [ |
467 | | - [ |
468 | | - 'Name' => 'issuer', |
469 | | - 'Value' => $payment->get_meta( 'issuer' ), |
470 | | - ], |
471 | | - ], |
472 | 389 | ]; |
473 | 390 |
|
474 | 391 | break; |
|
0 commit comments