File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,13 @@ class Config extends GatewayConfig implements JsonSerializable {
5959 */
6060 public $ client_key ;
6161
62+ /**
63+ * Country code.
64+ *
65+ * @var string
66+ */
67+ public $ country_code = '' ;
68+
6269 /**
6370 * Get API key.
6471 *
@@ -99,6 +106,7 @@ public function jsonSerialize(): object {
99106 'merchant_account ' => (string ) $ this ->merchant_account ,
100107 'api_key ' => (string ) $ this ->api_key ,
101108 'client_key ' => (string ) $ this ->client_key ,
109+ 'country_code ' => (string ) $ this ->country_code ,
102110 ];
103111 }
104112}
Original file line number Diff line number Diff line change @@ -334,6 +334,14 @@ public function payment_redirect( Payment $payment ) {
334334 ],
335335 'clientKey ' => $ this ->config ->client_key ,
336336 'amount ' => AmountTransformer::transform ( $ payment ->get_total_amount () )->get_json (),
337+ /**
338+ * Country code.
339+ *
340+ * Since Adyen Web v6 the `countryCode` is a mandatory configuration property.
341+ *
342+ * @link https://docs.adyen.com/online-payments/upgrade-your-integration/migrate-to-web-v6
343+ */
344+ 'countryCode ' => Util::get_country_code ( $ payment ) ?? $ this ->config ->country_code ,
337345 ];
338346
339347 $ checkout_configuration = (object ) $ checkout_configuration ;
Original file line number Diff line number Diff line change @@ -424,6 +424,17 @@ public function get_settings_fields() {
424424 },
425425 ];
426426
427+ // Country code.
428+ $ fields [] = [
429+ 'section ' => 'general ' ,
430+ 'meta_key ' => '_pronamic_gateway_adyen_country_code ' ,
431+ 'title ' => \__ ( 'Country code ' , 'pronamic_ideal ' ),
432+ 'type ' => 'text ' ,
433+ 'classes ' => [ 'regular-text ' , 'code ' ],
434+ 'tooltip ' => \__ ( 'Country code used when it cannot be derived from the customer details. ' , 'pronamic_ideal ' ),
435+ 'required ' => true ,
436+ ];
437+
427438 // Return fields.
428439 return $ fields ;
429440 }
@@ -457,6 +468,7 @@ public function get_config( $post_id ) {
457468 $ config ->merchant_account = $ this ->get_meta ( $ post_id , 'adyen_merchant_account ' );
458469 $ config ->client_key = $ this ->get_meta ( $ post_id , 'adyen_client_key ' );
459470 $ config ->merchant_order_reference = $ this ->get_meta ( $ post_id , 'adyen_merchant_order_reference ' );
471+ $ config ->country_code = $ this ->get_meta ( $ post_id , 'adyen_country_code ' );
460472
461473 return $ config ;
462474 }
You can’t perform that action at this time.
0 commit comments