You are here

function _commerce_mollie_get_payment_method_instance in Commerce Mollie 7

Returns the Mollie payment method instance.

Return value

object|bool The payment method object for Mollie or false if none was found.

2 calls to _commerce_mollie_get_payment_method_instance()
commerce_mollie_request_status in ./commerce_mollie.module
Request new payment status.
commerce_mollie_webhook in ./commerce_mollie.module
Handles the callback/webhook call from Mollie and set the payment status accordingly.

File

./commerce_mollie.module, line 428

Code

function _commerce_mollie_get_payment_method_instance() {
  $payment_method = FALSE;
  $event = rules_get_cache('event_commerce_payment_methods');

  // Look for a Rule enabling this payment method.
  foreach ($event
    ->getIterator() as $rule) {
    foreach ($rule
      ->actions() as $action) {
      if ($action
        ->getElementName() == 'commerce_payment_enable_commerce_mollie') {
        $instance_id = commerce_payment_method_instance_id('commerce_mollie', $rule);
        $payment_method = commerce_payment_method_instance_load($instance_id);
      }
    }
  }
  return $payment_method;
}