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; }
public requestFinancialOperationResult RequestFinancialOperation(requestFinancialOperationRequest request) { IClientChannel channel = (IClientChannel)_financialOperationFactory.CreateChannel(); bool success = false; requestFinancialOperationResult result = null; try { requestFinancialOperationResponse response = null; using (OperationContextScope scope = new OperationContextScope(channel)) { OperationContext.Current.OutgoingMessageHeaders.ReplyTo = new EndpointAddress(_config.AsyncServiceEndpoint); response = ((MerchantFinancialOperationWS)channel).requestFinancialOperation(new requestFinancialOperationRequest1(request)); channel.Close(); } result = response.@return; success = true; } finally { if (!success) { channel.Abort(); } } return(result); }
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_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_Purchase() { 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 }; 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; }
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 abstract void ProcessFinancialOperationResult(requestFinancialOperationResult result);
public abstract void ProcessFinancialOperationResult(requestFinancialOperationResult result);
public override void ProcessFinancialOperationResult(requestFinancialOperationResult result) { CreateLogFile(result, result.merchantOperationID); }
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; }