Exemplo n.º 1
0
        public void UpdateSubAccounts_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            int subAccountId = AppConstants.INVALID_SUBACCOUNT_ID;

            string businessName  = AppConstants.SAMPLE_BUSINESS_NAME;
            string businessEmail = AppConstants.SAMPLE_EMAIL;
            string bankCode      = AppConstants.ACCESS_BANK_CODE;
            string accountNumber = AppConstants.VALID_ACCESSBANK_ACCOUNT_NUMBER;
            double splitValue    = 0.5;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.SubAccounts.UpdateSubAccount(subAccountId,
                                                           businessName,
                                                           businessEmail,
                                                           bankCode,
                                                           accountNumber,
                                                           SplitType.Percentage,
                                                           splitValue);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <SubAccountResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE,
                         actual: result.Message);
        }
Exemplo n.º 2
0
        public BanksTests()
        {
            // Get flutterwave secret key from environmental variables
            var flutterwaveSecretKey = Environment.GetEnvironmentVariable("FLUTTERWAVESECRETKEY");

            _api = new FlutterwaveApi(flutterwaveSecretKey);
        }
Exemplo n.º 3
0
        public void CreatePaymentPlan_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            decimal amount   = 5000;
            string  name     = AppConstants.SAMPLE_PAYMENT_PLAN_NAME;
            int     duration = 24;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.Payments.CreatePaymentPlan(amount,
                                                         name,
                                                         Interval.Monthly,
                                                         duration);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <PaymentPlanResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE,
                         actual: result.Message);
            Assert.Null(result.Data);
        }
Exemplo n.º 4
0
        public void GetBanks_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.Banks.GetBanks(Country.Nigeria);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <GetBanksResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE, actual: result.Message);
            Assert.Null(result.Data);
        }
Exemplo n.º 5
0
        public void GetTransactionFees_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            decimal amount = 5000;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.Transactions.GetTransactionFee(amount);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <GetTransactionFeeResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE, actual: result.Message);
            Assert.Null(result.Data);
        }
Exemplo n.º 6
0
        public void VerifyTransaction_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            int id = AppConstants.VALID_TRANSACTION_ID;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.Transactions.VerifyTransaction(id);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <VerifyTransactionResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.VERIFY_TRANSACTION_UNAUTHORIZED_MESSAGE, actual: result.Message);
            Assert.Null(result.Data);
        }
Exemplo n.º 7
0
        public void GetSubAccount_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            int subAccountId = AppConstants.INVALID_SUBACCOUNT_ID;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.SubAccounts.GetSubAccount(subAccountId);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <SubAccountResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE,
                         actual: result.Message);
            Assert.Null(result.Data);
        }
        public void VerifyBankAccount_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            string accountNumber = AppConstants.VALID_ACCESSBANK_ACCOUNT_NUMBER;
            string bankCode      = AppConstants.ACCESS_BANK_CODE;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.Miscellaneous.VerifyBankAccount(accountNumber, bankCode);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <VerifyBankAccountResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE, actual: result.Message);
            Assert.Null(result.Data);
        }
Exemplo n.º 9
0
        public void CancelPaymentPlan_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            int paymenPlanId = AppConstants.INVALID_PAYMENT_PLAN_ID;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.Payments.CancelPaymentPlan(paymenPlanId);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <PaymentPlanResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE,
                         actual: result.Message);
            Assert.Null(result.Data);
        }
Exemplo n.º 10
0
        public void UpdatePaymentPlans_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            int    paymentPlanId = AppConstants.INVALID_PAYMENT_PLAN_ID;
            string name          = AppConstants.SAMPLE_NEW_PAYMENT_PLAN_NAME;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.Payments.UpdatePaymentPlan(paymentPlanId,
                                                         name,
                                                         PaymentPlanStatus.Active);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <PaymentPlanResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE,
                         actual: result.Message);
        }
Exemplo n.º 11
0
        public void CreateSubAccount_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            string bankCode              = AppConstants.ACCESS_BANK_CODE;
            string accountNumber         = AppConstants.VALID_ACCESSBANK_ACCOUNT_NUMBER;
            string businessName          = AppConstants.SAMPLE_BUSINESS_NAME;
            string businessEmail         = AppConstants.SAMPLE_EMAIL;
            double splitValue            = 0.5;
            string businessContact       = AppConstants.SAMPLE_CUSTOMER_NAME;
            string businessContactMobile = AppConstants.SAMPLE_PHONE_NUMBER;
            string businessMobile        = AppConstants.SAMPLE_PHONE_NUMBER;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.SubAccounts.CreateSubAccount(bankCode,
                                                           accountNumber,
                                                           businessName,
                                                           businessEmail,
                                                           Country.Nigeria,
                                                           SplitType.Percentage,
                                                           splitValue,
                                                           businessContact,
                                                           businessContactMobile,
                                                           businessMobile);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <SubAccountResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE,
                         actual: result.Message);
            Assert.Null(result.Data);
        }
Exemplo n.º 12
0
        public void InitiatePayment_InvalidSecretKey_ReturnsError()
        {
            // Arrange
            string  txRef               = AppConstants.SAMPLE_TX_REF;
            decimal amount              = 100;
            string  redirectUrl         = AppConstants.SAMPLE_REDIRECT_URL;
            string  customerEmail       = AppConstants.SAMPLE_EMAIL;
            string  customerPhonenumber = AppConstants.SAMPLE_PHONE_NUMBER;
            string  customerName        = AppConstants.SAMPLE_CUSTOMER_NAME;
            string  paymentTitle        = AppConstants.SAMPLE_PAYMENT_TITLE;
            string  paymentDescription  = AppConstants.SAMPLE_PAYMENT_DESCRIPTION;
            string  brandLogoUrl        = AppConstants.SAMPLE_BRAND_LOGO_URL;

            var flutterwaveSecretKey = "";

            _api = new FlutterwaveApi(flutterwaveSecretKey);

            // Act
            var result = _api.Payments.InitiatePayment(txRef,
                                                       amount,
                                                       redirectUrl,
                                                       customerName,
                                                       customerEmail,
                                                       customerPhonenumber,
                                                       paymentTitle,
                                                       paymentDescription,
                                                       brandLogoUrl);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <InitiatePaymentResponse>(result);
            Assert.Equal(expected: AppConstants.ERROR_STATUS, actual: result.Status);
            Assert.Equal(expected: AppConstants.INVALID_AUTHORIZATION_KEY_ERROR_MESSAGE,
                         actual: result.Message);
            Assert.Null(result.Data);
        }