def test_can_refund(payment_dummy: Payment): assert payment_dummy.charge_status == ChargeStatus.NOT_CHARGED payment_dummy.is_active = False assert not payment_dummy.can_refund() payment_dummy.is_active = True assert not payment_dummy.can_refund() payment_dummy.charge_status = ChargeStatus.CHARGED assert payment_dummy.can_refund()
def test_can_authorize(payment_dummy: Payment): assert payment_dummy.charge_status == ChargeStatus.NOT_CHARGED payment_dummy.is_active = False assert not payment_dummy.can_authorize() payment_dummy.is_active = True assert payment_dummy.can_authorize() payment_dummy.charge_status = ChargeStatus.PARTIALLY_CHARGED assert not payment_dummy.can_authorize() payment_dummy.charge_status = ChargeStatus.FULLY_CHARGED assert not payment_dummy.can_authorize()
def test_can_charge(payment_dummy: Payment): assert payment_dummy.charge_status == ChargeStatus.NOT_CHARGED payment_dummy.is_active = False assert not payment_dummy.can_charge() payment_dummy.is_active = True assert payment_dummy.can_charge() payment_dummy.charge_status = ChargeStatus.CHARGED assert payment_dummy.can_charge() payment_dummy.captured_amount = payment_dummy.total assert not payment_dummy.can_charge()
def test_can_refund(payment_dummy: Payment): assert payment_dummy.charge_status == ChargeStatus.NOT_CHARGED payment_dummy.is_active = False assert not payment_dummy.can_refund() payment_dummy.is_active = True assert not payment_dummy.can_refund() payment_dummy.charge_status = ChargeStatus.PARTIALLY_CHARGED assert payment_dummy.can_refund() payment_dummy.charge_status = ChargeStatus.FULLY_CHARGED assert payment_dummy.can_refund()
def test_can_void(payment_txn_preauth: Payment): assert payment_txn_preauth.charge_status == ChargeStatus.NOT_CHARGED payment_txn_preauth.is_active = False assert not payment_txn_preauth.can_void() payment_txn_preauth.is_active = True assert payment_txn_preauth.can_void() payment_txn_preauth.charge_status = ChargeStatus.CHARGED assert not payment_txn_preauth.can_void() payment_txn_preauth.charge_status = ChargeStatus.NOT_CHARGED payment_txn_preauth.transactions.all().delete() assert not payment_txn_preauth.can_void()
def test_can_charge(payment_dummy: Payment): assert payment_dummy.charge_status == ChargeStatus.NOT_CHARGED payment_dummy.is_active = False assert not payment_dummy.can_charge() payment_dummy.is_active = True assert payment_dummy.can_charge() payment_dummy.charge_status = ChargeStatus.PARTIALLY_CHARGED assert payment_dummy.can_charge() payment_dummy.charge_status = ChargeStatus.FULLY_CHARGED assert not payment_dummy.can_charge() payment_dummy.captured_amount = payment_dummy.total assert not payment_dummy.can_charge()
def test_can_capture(payment_txn_preauth: Payment): assert payment_txn_preauth.charge_status == ChargeStatus.NOT_CHARGED payment_txn_preauth.is_active = False assert not payment_txn_preauth.can_capture() payment_txn_preauth.is_active = True assert payment_txn_preauth.can_capture() payment_txn_preauth.charge_status = ChargeStatus.PARTIALLY_CHARGED assert not payment_txn_preauth.can_capture() payment_txn_preauth.charge_status = ChargeStatus.FULLY_CHARGED assert not payment_txn_preauth.can_capture() payment_txn_preauth.captured_amount = 0 payment_txn_preauth.transactions.all().delete() assert not payment_txn_preauth.can_capture()
def test_can_void(payment_txn_preauth: Payment): assert payment_txn_preauth.charge_status == ChargeStatus.NOT_CHARGED payment_txn_preauth.is_active = False assert not payment_txn_preauth.can_void() payment_txn_preauth.is_active = True assert payment_txn_preauth.can_void() payment_txn_preauth.charge_status = ChargeStatus.PARTIALLY_CHARGED assert not payment_txn_preauth.can_void() payment_txn_preauth.charge_status = ChargeStatus.FULLY_CHARGED assert not payment_txn_preauth.can_void() payment_txn_preauth.charge_status = ChargeStatus.NOT_CHARGED payment_txn_preauth.transactions.all().delete() assert not payment_txn_preauth.can_void()