コード例 #1
0
        /// <summary>
        ///     Run this transaction
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override ITransactionResult Transaction(object parameters)
        {
            var sendParameters = (SendParameters)parameters;

            TestConfig.TestSettings = new IntegrationTestSettingsModel {
                AcEnvironment = sendParameters.Environment
            };

            var amtRangeParsed       = Enum.TryParse(sendParameters?.AmtRange, true, out AmountRange amtRange);
            var itemChoiceTypeParsed = Enum.TryParse(sendParameters?.FeeType, true, out ItemChoiceType1 itemChoiceType);
            var sendRequest          = new SendRequest
            {
                Environment         = sendParameters.Environment,
                AgentCountryIsoCode = sendParameters.AgentCountryIsoCode,
                AgentId             = sendParameters.AgentId,
                AgentPos            = sendParameters.AgentPos,
                AgentState          = sendParameters.GetAgentState(),
                Amount         = (double)sendParameters.CustomAmount,
                AmtRange       = amtRangeParsed ? amtRange : AmountRange.CustomAmount,
                Country        = sendParameters.Country,
                State          = sendParameters.State,
                FeeType        = itemChoiceTypeParsed ? itemChoiceType : ItemChoiceType1.amountExcludingFee,
                SendCurr       = sendParameters.SendCurr,
                ServiceOption  = sendParameters.ServiceOption,
                ThirdPartyType = sendParameters.ThirdPartyType
            };
            var sendData = new SendData(sendRequest);

            sendData = SendOperations.SendCompleteForExistingCustomer(sendData);

            var referenceNumber = sendData?.CompleteSessionResp?.Payload?.ReferenceNumber;

            var amendRequest = new AmendOperationRequest
            {
                AgentState      = sendParameters.AgentState,
                ReferenceNumber = referenceNumber
            };

            amendRequest.PopulateAgentData(sendParameters.AgentState);
            var amendData = new AmendData(amendRequest);

            amendData.Set(sendData);
            AmendOperations.AmendComplete(amendData);

            return(new TransactionResult {
                Result = amendData
            });
        }
コード例 #2
0
        public void Amend_ShouldSucceedForSendingAgent()
        {
            var sendRequest = new SendRequest
            {
                AgentState = AgentLocation.MN,
                Country    = Country.Usa,
                State      = State.Ny,
                SendCurr   = Currency.Usd,
                AmtRange   = AmountRange.NoIdsNoThirdParty,
                FeeType    = ItemChoiceType1.amountIncludingFee
            };

            sendRequest.PopulateAgentData(sendRequest.AgentState);
            var sendData = new SendData(sendRequest);

            sendData = sendOperations.SendCompleteForExistingCustomer(sendData);
            var sendCompleteSessionResponse = sendData.CompleteSessionResp;

            Assert.IsFalse(sendData.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{sendData.Errors?.Log()}");
            Assert.IsFalse(sendCompleteSessionResponse.Errors.Any(), "Send Failed.");

            //Get the transaction reference number
            string referenceNumber = sendCompleteSessionResponse.Payload?.ReferenceNumber;
            //Amend with single validate
            var request = new AmendOperationRequest
            {
                AgentState      = AgentLocation.MN,
                ReferenceNumber = referenceNumber
            };

            request.PopulateAgentData(request.AgentState);

            var amendData = new AmendData(request);

            amendData.Set(sendData);
            amendOperations.SingleValidate(amendData);
            Assert.IsFalse(amendData.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{amendData.Errors?.Log()}");
            amendOperations.AmendComplete(amendData);
            var lastAmendValidationResponse = amendData.ValidationResponses.LastOrDefault();

            // ASSERT ALL THE THINGS
            Assert.IsFalse(amendData.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{amendData.Errors?.Log()}");
            Assert.IsTrue(lastAmendValidationResponse.Payload.FieldsToCollect.Any());
        }
コード例 #3
0
        public void Amend_TransactionLookup()
        {
            var sendRequest = new SendRequest
            {
                AgentState = AgentLocation.MN,
                Country    = Country.Usa,
                State      = State.Ny,
                SendCurr   = Currency.Usd,
                AmtRange   = AmountRange.NoIdsNoThirdParty,
                FeeType    = ItemChoiceType1.amountIncludingFee
            };

            sendRequest.PopulateAgentData(sendRequest.AgentState);
            var sendData = new SendData(sendRequest);

            sendData = sendOperations.SendCompleteForExistingCustomer(sendData);
            var sendCompleteSessionResponse = sendData.CompleteSessionResp;

            Assert.IsFalse(sendData.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{sendData.Errors?.Log()}");
            Assert.IsFalse(sendCompleteSessionResponse.Errors.Any(), "Send Failed.");

            //Get the transaction reference number
            var referenceNumber = sendCompleteSessionResponse.Payload.ReferenceNumber;
            //Transaction lookup
            var request = new AmendOperationRequest
            {
                AgentState      = AgentLocation.MN,
                ReferenceNumber = referenceNumber
            };

            request.PopulateAgentData(request.AgentState);
            var amendData = new AmendData(request);

            amendData.Set(sendData);
            amendOperations.TransactionLookup(amendData);
            var tranLookupResponse = amendData.TransactionLookup.TransactionLookupResp;

            //ASSERT the resposne.
            Assert.IsFalse(tranLookupResponse.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{tranLookupResponse.Errors?.Log()}");
            Assert.IsTrue(tranLookupResponse.Payload.TransactionStatus == TransactionStatusType.AVAIL);
            Assert.IsFalse(string.IsNullOrEmpty(tranLookupResponse.Payload.MgiSessionID));
        }
コード例 #4
0
        public void AmendTransaction_Complete()
        {
            var sendRequest = new SendRequest
            {
                AgentState = AgentLocation.MN,
                Country    = Country.Usa,
                State      = State.Ny,
                SendCurr   = Currency.Usd,
                AmtRange   = AmountRange.NoIdsNoThirdParty,
                FeeType    = ItemChoiceType1.amountIncludingFee
            };

            sendRequest.PopulateAgentData(sendRequest.AgentState);

            var sendData = new SendData(sendRequest);

            sendData = sendOperations.SendCompleteForExistingCustomer(sendData);
            var sendCompleteSessionResponse = sendData.CompleteSessionResp;

            Assert.IsFalse(sendData.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{sendData.Errors?.Log()}");
            Assert.IsFalse(sendCompleteSessionResponse.Errors.Any(), "Send Failed.");

            string referenceNumber = sendCompleteSessionResponse.Payload?.ReferenceNumber;

            var request = new AmendOperationRequest
            {
                AgentState      = AgentLocation.MN,
                ReferenceNumber = referenceNumber
            };

            request.PopulateAgentData(request.AgentState);

            var amendData = new AmendData(request);

            amendData.Set(sendData);
            amendOperations.AmendComplete(amendData);
            Assert.IsFalse(amendData.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{amendData.Errors?.Log()}");
            Assert.IsFalse(string.IsNullOrEmpty(amendData.CompleteSessionResp.Payload.ReferenceNumber));
        }