Skip to content

Commit 615ac2e

Browse files
committed
Remove issuers field from iDEAL payment method.
1 parent f9c0047 commit 615ac2e

File tree

1 file changed

+1
-84
lines changed

1 file changed

+1
-84
lines changed

src/Gateway.php

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
use Pronamic\WordPress\Pay\Core\PaymentMethod;
99
use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods;
1010
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;
1511
use Pronamic\WordPress\Pay\Payments\Payment;
1612
use Pronamic\WordPress\Pay\Payments\PaymentStatus;
1713
use Pronamic\WordPress\Pay\Refunds\Refund;
@@ -57,29 +53,12 @@ public function __construct( Config $config ) {
5753
];
5854

5955
// 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-
7756
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::AMERICAN_EXPRESS ) );
7857
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::BANK_TRANSFER ) );
7958
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::BANCONTACT ) );
8059
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::CREDIT_CARD ) );
8160
$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 ) );
8362
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::MAESTRO ) );
8463
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::MASTERCARD ) );
8564
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::PAYPAL ) );
@@ -177,62 +156,6 @@ private function maybe_enrich_payment_methods() {
177156
}
178157
}
179158

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-
236159
/**
237160
* Request transaction specifications.
238161
*
@@ -463,12 +386,6 @@ public function start( Payment $payment ) {
463386
$data->Services->ServiceList[] = (object) [
464387
'Action' => 'Pay',
465388
'Name' => 'ideal',
466-
'Parameters' => [
467-
[
468-
'Name' => 'issuer',
469-
'Value' => $payment->get_meta( 'issuer' ),
470-
],
471-
],
472389
];
473390

474391
break;

0 commit comments

Comments
 (0)