public function onCaptured($response)
    {
        $order = $this->owner->Invoice();

        if ($order->exists()) {
            $payment_amount = MathsHelper::round($this->owner->getAmount(), 2);
            $order_amount = MathsHelper::round($order->Total, 2);

            // If our payment is the value of the order, mark paid
            // else mark part paid
            if (abs(($payment_amount - $order_amount) / $order_amount) < 0.00001) {
                $order->markPaid();
            } else {
                $order->markPartPaid();
            }

            $order->write();
        }
    }
public function onCaptured($response)
    {
        $order = $this->owner->Invoice();

        if ($order->exists()) {
            $payment_amount = MathsHelper::round($this->owner->getAmount(), 2);
            $order_amount = MathsHelper::round($order->Total, 2);

            // If our payment is the value of the order, mark paid
            // else mark part paid
            if (abs(($payment_amount - $order_amount) / $order_amount) < 0.00001) {
                $order->markPaid();
            } else {
                $order->markPartPaid();
            }

            $order->write();
        }
    }
public function onCaptured ( $ response ) { $ order = $ this -> owner -> Invoice ( ) ; if ( $ order -> exists ( ) ) { $ payment_amount = MathsHelper :: round ( $ this -> owner -> getAmount ( ) , 2 ) ; $ order_amount = MathsHelper :: round ( $ order -> Total , 2 ) ; // If our payment is the value of the order, mark paid // else mark part paid if ( abs ( ( $ payment_amount - $ order_amount ) / $ order_amount ) < 0.00001 ) { $ order -> markPaid ( ) ; } else { $ order -> markPartPaid ( ) ; } $ order -> write ( ) ; } }
Process attached order when payment is taken

@param ServiceResponse $response
@return void
Process attached order when payment is taken