public void FinancialOperation_Rejected_Purchase() { var request = GetRequest(); request.alias.aliasName = "351#911212212"; // FAKE FORCE REJECT var amount = 70; //0.70€ var operationId = MBWayClient.GetUniqID(); var currencyCode = CurrencyCodes.EURO_TWO_DECIMALS; request.financialOperation = new financialOperation { amount = amount, currencyCode = currencyCode, merchantOprId = operationId, operationTypeCode = FinancialOperationTypes.PURCHASE }; var result = this.GetClient().RequestFinancialOperation(request); Assert.IsFalse(result.IsValid); Assert.AreEqual(amount, result.amount); Assert.AreEqual("113", result.statusCode); Assert.AreEqual(currencyCode, result.currencyCode); Assert.IsTrue(string.IsNullOrEmpty(result.token)); Assert.IsNotNull(result.timestamp); currentResult = result; }
public void FinancialOperation_PurchaseAuthorization() { var request = GetRequest(); var amount = 70; //0.70€ var operationId = MBWayClient.GetUniqID(); var currencyCode = CurrencyCodes.EURO_TWO_DECIMALS; request.financialOperation = new financialOperation { amount = amount, currencyCode = currencyCode, merchantOprId = operationId, operationTypeCode = FinancialOperationTypes.PURCHASE_AUTHORIZATION }; var result = this.GetClient().RequestFinancialOperation(request); Assert.IsTrue(result.IsValid); Assert.AreEqual(amount, result.amount); Assert.AreEqual(operationId, result.merchantOperationID); Assert.AreEqual(currencyCode, result.currencyCode); Assert.IsTrue(!string.IsNullOrEmpty(result.token)); Assert.IsNotNull(result.timestamp); currentResult = result; }
protected MBWayClient GetClient() { if (client != null) return client; client = new MBWayClient(this.GetConfig(), true); return client; }
protected MBWayClient GetClient() { if (client != null) { return(client); } client = new MBWayClient(this.GetConfig(), true); return(client); }
public void Config_WithCertificateThumbprint() { var config = new MBWayConfig { CertificateThumbprint = ConfigurationManager.AppSettings["CERTIFICATE_THUMBPRINT"], MerchantIP = ConfigurationManager.AppSettings["MERCHANT_IP"], MerchantPOSID = ConfigurationManager.AppSettings["MERCHANT_POSID"], AsyncServiceEndpoint = ConfigurationManager.AppSettings["ASYNC_SERVICE_ENDPOINT"] }; Assert.IsNotNull(config); var client = new MBWayClient(config); Assert.IsNotNull(client); }
public void Config_WithCertificateThumbprintFail() { var config = new MBWayConfig { CertificateThumbprint = "123123123123", MerchantIP = ConfigurationManager.AppSettings["MERCHANT_IP"], MerchantPOSID = ConfigurationManager.AppSettings["MERCHANT_POSID"], AsyncServiceEndpoint = ConfigurationManager.AppSettings["ASYNC_SERVICE_ENDPOINT"] }; Assert.IsNotNull(config); MBWayClient client = null; AssertThrows <ApplicationException>(() => { client = new MBWayClient(config); }); Assert.IsNull(client); }
public void Config_WithCertificatePathFail() { var config = new MBWayConfig { CertificatePass = @"c:\path\to\nowhere.pfx", CertificatePath = "NotThePassword!", MerchantIP = ConfigurationManager.AppSettings["MERCHANT_IP"], MerchantPOSID = ConfigurationManager.AppSettings["MERCHANT_POSID"], AsyncServiceEndpoint = ConfigurationManager.AppSettings["ASYNC_SERVICE_ENDPOINT"] }; Assert.IsNotNull(config); MBWayClient client = null; AssertThrows <ApplicationException>(() => { client = new MBWayClient(config); }); Assert.IsNull(client); }
public void FinancialOperation_PurchaseAfterAuthorization() { FinancialOperation_PurchaseAuthorization(); Assert.IsNotNull(currentResult); Assert.IsTrue(currentResult.IsValid); ApprovalSleep(); // allow for aproval in app and async callback var request = GetRequest(); request.referencedFinancialOperation = new financialOperation { amount = currentResult.amount, currencyCode = currentResult.currencyCode, merchantOprId = currentResult.merchantOperationID, operationTypeCode = FinancialOperationTypes.PURCHASE_AUTHORIZATION }; var newOperationId = MBWayClient.GetUniqID(); request.financialOperation = new financialOperation { amount = currentResult.amount, currencyCode = currentResult.currencyCode, merchantOprId = newOperationId, operationTypeCode = FinancialOperationTypes.PURCHASE_AFTER_AUTHORIZATION }; var result = this.GetClient().RequestFinancialOperation(request); Assert.IsTrue(result.IsValid); Assert.AreEqual(currentResult.amount, result.amount); Assert.AreEqual(newOperationId, result.merchantOperationID); Assert.AreEqual(currentResult.currencyCode, result.currencyCode); Assert.IsNotNull(result.timestamp); currentResult = result; }
public void FinancialOperation_Purchase_Annulment() { FinancialOperation_Purchase(); Assert.IsNotNull(currentResult); Assert.IsTrue(currentResult.IsValid); var request = GetRequest(); request.referencedFinancialOperation = new financialOperation { amount = currentResult.amount, currencyCode = currentResult.currencyCode, merchantOprId = currentResult.merchantOperationID, operationTypeCode = FinancialOperationTypes.PURCHASE }; var newOperationId = MBWayClient.GetUniqID(); request.financialOperation = new financialOperation { amount = currentResult.amount, currencyCode = currentResult.currencyCode, merchantOprId = newOperationId, operationTypeCode = FinancialOperationTypes.ANNULMENT }; var result = this.GetClient().RequestFinancialOperation(request); Assert.IsTrue(result.IsValid); Assert.AreEqual(currentResult.amount, result.amount); Assert.AreEqual(newOperationId, result.merchantOperationID); Assert.AreEqual(currentResult.currencyCode, result.currencyCode); Assert.IsNotNull(result.timestamp); }