You are here

function mollie_payment_update_status in Mollie Payment 7.2

Same name and namespace in other branches
  1. 7 mollie_payment.module \mollie_payment_update_status()

Update status of payment.

See also

https://docs.mollie.com/guides/payment-status-changes

3 calls to mollie_payment_update_status()
mollie_payment_listener in ./mollie_payment.module
Listener callback.
mollie_payment_recurring_listener in ./mollie_payment.module
Recurring listener callback.
mollie_payment_return in ./mollie_payment.module
Return callback.

File

./mollie_payment.module, line 542
Provides Mollie integration for the Payment platform.

Code

function mollie_payment_update_status(Payment $payment, $mollie_status) {
  $payment_status = array(
    \Mollie\Api\Types\PaymentStatus::STATUS_OPEN => PAYMENT_STATUS_NEW,
    \Mollie\Api\Types\PaymentStatus::STATUS_CANCELED => PAYMENT_STATUS_CANCELLED,
    \Mollie\Api\Types\PaymentStatus::STATUS_PENDING => PAYMENT_STATUS_PENDING,
    \Mollie\Api\Types\PaymentStatus::STATUS_EXPIRED => PAYMENT_STATUS_EXPIRED,
    \Mollie\Api\Types\PaymentStatus::STATUS_FAILED => PAYMENT_STATUS_FAILED,
    \Mollie\Api\Types\PaymentStatus::STATUS_PAID => PAYMENT_STATUS_SUCCESS,
  );
  $payment
    ->setStatus(new PaymentStatusItem($payment_status[$mollie_status]));
  entity_save('payment', $payment);
}