Ejemplo n.º 1
0
 /**
  * Update status of the specified payment
  *
  * @param Pronamic_Pay_Payment $payment
  */
 public function update_status(Pronamic_Pay_Payment $payment)
 {
     $mollie_payment = $this->client->get_payment($payment->get_transaction_id());
     if (!$mollie_payment) {
         $this->error = $this->client->get_error();
         return;
     }
     $status = Pronamic_WP_Pay_Mollie_Statuses::transform($mollie_payment->status);
     $payment->set_status($status);
     $subscription = $payment->get_subscription();
     if ($subscription && '' === $subscription->get_transaction_id()) {
         // First payment or non-subscription recurring payment,
         // use payment status for subscription too.
         $subscription->set_status($status);
     }
     if (isset($mollie_payment->details)) {
         $details = $mollie_payment->details;
         if (isset($details->consumerName)) {
             $payment->set_consumer_name($details->consumerName);
         }
         if (isset($details->consumerAccount)) {
             $payment->set_consumer_iban($details->consumerAccount);
         }
     }
 }