You are here

protected function StripePaymentMethodController::statusFromCharge in Stripe 7

Map a Strip Charge object to a Payment status.

Parameters

\Stripe\Charge $charge: A stripe charge object.

TODO: Add support for refunded charge.

Return value

PaymentStatusItem The Payment status matching the charge object.

1 call to StripePaymentMethodController::statusFromCharge()
StripePaymentMethodController::execute in stripe_payment/includes/StripePaymentMethodController.inc
Execute a payment.

File

stripe_payment/includes/StripePaymentMethodController.inc, line 484
Stripe Payment controller class and helper code (classes and function).

Class

StripePaymentMethodController

Code

protected function statusFromCharge(\Stripe\Charge $charge) {
  if ($charge->paid) {
    return new PaymentStatusItem(STRIPE_PAYMENT_STATUS_PAID);
  }
  elseif (!$charge->captured) {
    return new PaymentStatusItem(STRIPE_PAYMENT_STATUS_UNCAPTURED);
  }
  else {
    return new PaymentStatusItem(PAYMENT_STATUS_UNKNOWN);
  }
}