                $payment->write();
                $i++;
            }

            // Ugly hack to set the money amount
            $this->payment->Status = 'Created';
            $this->payment->setAmount($total);

            // If not everything was refunded, the payment should still have the "Captured" status
            if ($total > 0) {
                $endStatus = 'Captured';
            }
        }

        parent::markCompleted($endStatus, $serviceResponse, $gatewayMessage);
        if ($endStatus === 'Captured') {
            $this->createMessage(Message\PartiallyRefundedResponse::class, $gatewayMessage);
        } else {
            $this->createMessage(Message\RefundedResponse::class, $gatewayMessage);
        }

        ErrorHandling::safeExtend($this->payment, 'onRefunded', $serviceResponse);
    }
Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.