def error_mastercard_charge(btn1_auth_details, partial_charge_request1, mastercard): ravepy.set_auth(btn1_auth_details) req_kwargs = {} req_kwargs.update(partial_charge_request1) req_kwargs.update(mastercard) otp = req_kwargs.pop('otp') req_kwargs.pop('cardno') return ravepy.Charge.create(source_type=CARD, **req_kwargs)
def direct_mastercard_charge_without_pin(btn1_auth_details, partial_charge_request1, mastercard): ravepy.set_auth(btn1_auth_details) req_kwargs = {} req_kwargs.update(partial_charge_request1) req_kwargs.update(mastercard) otp = req_kwargs.pop('otp') pin = req_kwargs.pop('pin') return ravepy.Charge.create(source_type=CARD, **req_kwargs)
def test_list_banks(btn1_auth_details): ravepy.set_auth(btn1_auth_details) banks = ravepy.Bank.list() assert len(banks) != 0 for bank in banks: assert isinstance(bank, Bank) assert hasattr(bank, 'name') assert hasattr(bank, 'code') assert hasattr(bank, 'internet_banking')
def direct_visacard_charge_with_3dsecure(btn1_auth_details, partial_charge_request1, visacard): ravepy.set_auth(btn1_auth_details) req_kwargs = {} req_kwargs.update(partial_charge_request1) req_kwargs.update(visacard) otp = req_kwargs.pop('otp') pin = req_kwargs.pop('pin') req_kwargs['redirect_url'] = 'https://redirect.com/webhook' req_kwargs['country'] = GHANA req_kwargs['currency'] = USD return ravepy.Charge.create(source_type=CARD, **req_kwargs)
def test_list_fees(btn1_auth_details, mastercard): ravepy.set_auth(btn1_auth_details) fee = ravepy.Fee.get_fee(500, constants.NGN, card6=mastercard['cardno'][:6]) print(fee) assert isinstance(fee, Fee) assert fee.charge_amount assert hasattr(fee, 'fee') # Confirm that accessing these does not raise fee.merchant_fee fee.rave_fee assert fee.raw_resp
def test_list_fees_with_invalid_ptype(btn1_auth_details): ravepy.set_auth(btn1_auth_details) with pytest.raises(RaveError): fee = ravepy.Fee.get_fee(500, constants.NGN, ptype='fer')
def test_set_auth_details(sample_auth_details): ravepy.set_auth(sample_auth_details) ch = ravepy.Charge.create(source_type=CARD) assert ch._auth_details == sample_auth_details