Skip to content

Commit

Permalink
Update .gitattributes
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Mar 30, 2023
1 parent 98ad51a commit 60718b3
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 111 deletions.
1 change: 1 addition & 0 deletions src/Config.php
Expand Up @@ -71,6 +71,7 @@ public function get_host() {
* Set host.
*
* @param string $host Host.
* @return void
*/
public function set_host( $host ) {
$this->host = $host;
Expand Down
31 changes: 17 additions & 14 deletions src/Gateway.php
Expand Up @@ -8,7 +8,6 @@
use Pronamic\WordPress\Pay\Core\PaymentMethod;
use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods;
use Pronamic\WordPress\Pay\Core\PaymentMethodsCollection;
use Pronamic\WordPress\Pay\Core\SelectField;
use Pronamic\WordPress\Pay\Fields\CachedCallbackOptions;
use Pronamic\WordPress\Pay\Fields\IDealIssuerSelectField;
use Pronamic\WordPress\Pay\Fields\SelectFieldOption;
Expand Down Expand Up @@ -69,7 +68,7 @@ public function __construct( Config $config ) {
function() {
return $this->get_ideal_issuers();
},
'pronamic_pay_ideal_issuers_' . \md5( \wp_json_encode( $config ) )
'pronamic_pay_ideal_issuers_' . \md5( (string) \wp_json_encode( $config ) )
)
);

Expand All @@ -92,7 +91,7 @@ function() {
/**
* Get payment methods.
*
* @param array $args Query arguments.
* @param array<string, mixed> $args Query arguments.
* @return PaymentMethodsCollection
*/
public function get_payment_methods( array $args = [] ): PaymentMethodsCollection {
Expand Down Expand Up @@ -125,7 +124,7 @@ private function get_credit_card_payment_methods() {
* @return void
*/
private function maybe_enrich_payment_methods() {
$cache_key = 'pronamic_pay_buckaroo_transaction_specifications_' . \md5( \wp_json_encode( $this->config ) );
$cache_key = 'pronamic_pay_buckaroo_transaction_specifications_' . \md5( (string) \wp_json_encode( $this->config ) );

$buckaroo_transaction_specifications = \get_transient( $cache_key );

Expand Down Expand Up @@ -187,24 +186,28 @@ private function get_ideal_issuers() {
// Get iDEAL issuers.
$object = $this->request( 'GET', 'Transaction/Specification/ideal?serviceVersion=2' );

if ( 0 === $object->Version ) {
if ( \property_exists( $object, 'Version' ) && 0 === $object->Version ) {
throw new \Exception(
\sprintf(
'No versioned specification found for iDEAL payment method: version: "%s", name: "%s".',
$object->Version,
$object->Name
\property_exists( $object, 'Name' ) ? $object->Name : ''
)
);
}

$groups = [];

$actions_pay = \array_filter(
$object->Actions,
function( $action ) {
return 'Pay' === $action->Name;
}
);
$actions_pay = [];

if ( \property_exists( $object, 'Actions' ) ) {
$actions_pay = \array_filter(
$object->Actions,
function ( $action ) {
return 'Pay' === $action->Name;
}
);
}

foreach ( $actions_pay as $action ) {
$request_parameters = \array_filter(
Expand Down Expand Up @@ -750,7 +753,7 @@ public function request( $method, $endpoint, $data = null ) {
* @return string
*/
private function get_software_header() {
return \wp_json_encode(
return (string) \wp_json_encode(
[
'PlatformName' => 'WordPress',
'PlatformVersion' => \get_bloginfo( 'version' ),
Expand Down Expand Up @@ -880,7 +883,7 @@ public function update_status( Payment $payment ) {
* Create refund.
*
* @param Refund $refund Refund.
* @return null|string
* @return void
*/
public function create_refund( Refund $refund ) {
$payment = $refund->get_payment();
Expand Down
16 changes: 15 additions & 1 deletion src/Integration.php
Expand Up @@ -30,6 +30,20 @@ class Integration extends AbstractGatewayIntegration {
*/
private $host;

/**
* Website key meta key.
*
* @var string
*/
private $meta_key_website_key;

/**
* Secret key meta key.
*
* @var string
*/
private $meta_key_secret_key;

/**
* Construct Buckaroo integration.
*
Expand Down Expand Up @@ -109,7 +123,7 @@ public function gateway_configuration_display_value( $display_value, $post_id )
/**
* Get settings fields.
*
* @return array<int, array<string, callable|int|string|bool|array<int|string,int|string>>>
* @return array<int, mixed>
*/
public function get_settings_fields() {
global $post;
Expand Down

0 comments on commit 60718b3

Please sign in to comment.