コード例 #1
0
        public AcApiResponse <DwInitialSetupResponse, ApiData> DwInitialSetup(DwInitialSetupRequest req)
        {
            var resp = agentConnectIntegration.DwInitialSetup(req);

            var apiResp = new AcApiResponse <DwInitialSetupResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #2
0
        public AcApiResponse <GetBankDetailsResponse, ApiData> GetBankDetails(GetBankDetailsRequest req)
        {
            var resp = agentConnectIntegration.GetBankDetails(req);

            var apiResp = new AcApiResponse <GetBankDetailsResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #3
0
        public AcApiResponse <SaveConsumerProfileImageResponse, ApiData> SaveConsumerProfileImage(SaveConsumerProfileImageRequest req)
        {
            var resp = _agentConnectIntegration.SaveConsumerProfileImage(req);

            var apiResp = new AcApiResponse <SaveConsumerProfileImageResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #4
0
        public AcApiResponse <GetConsumerProfileTransactionHistoryResponse, ApiData> GetConsumerProfileTransactionHistory(GetConsumerProfileTransactionHistoryRequest req)
        {
            var resp = _agentConnectIntegration.GetConsumerProfileTransactionHistory(req);

            var apiResp = new AcApiResponse <GetConsumerProfileTransactionHistoryResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #5
0
        public AcApiResponse <IndustryResponse, ApiData> Industry(IndustryRequest req)
        {
            var resp = _agentConnectIntegration.Industry(req);

            var apiResp = new AcApiResponse <IndustryResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #6
0
        public AcApiResponse <BillerSearchResponse, ApiData> BillerSearch(BillerSearchRequest req)
        {
            var resp = agentConnectIntegration.BillerSearch(req);

            var apiResp = new AcApiResponse <BillerSearchResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #7
0
        public AcApiResponse <GetCurrencyInfoResponse, ApiData> GetCurrencyInfo(GetCurrencyInfoRequest req)
        {
            //AgentConnect GetCurrencyInfo call
            var resp = _agentConnectIntegration.GetCurrencyInfo(req);

            var apiResp = new AcApiResponse <GetCurrencyInfoResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #8
0
        public AcApiResponse <ReceiveReversalValidationResponse, ApiData> ReceiveReversalValidation(ReceiveReversalValidationRequest req)
        {
            // AgentConnect Validate call for RECV Reversal
            var resp = _agentConnectIntegration.ReceiveReversalValidation(req);

            var apiResp = new AcApiResponse <ReceiveReversalValidationResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #9
0
        public AcApiResponse <SaveTransactionDocumentResponse, ApiData> SaveTransactionDocument(SaveTransactionDocumentRequest req)
        {
            //AgentConnect TransactionLookup call all flows
            var resp = agentConnectIntegration.SaveTransactionDocument(req);

            var apiResp = new AcApiResponse <SaveTransactionDocumentResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #10
0
        public AcApiResponse <ConsumerHistoryLookupResponse, ApiData> ConsumerHistoryLookup(ConsumerHistoryLookupRequest req)
        {
            req.ApplyBusinessRules();

            var resp = _agentConnectIntegration.ConsumerHistoryLookup(req);

            var apiResp = new AcApiResponse <ConsumerHistoryLookupResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #11
0
        public AcApiResponse <CompleteSessionResponse, ReceiptsApiData> CompleteSession(CompleteSessionRequest req)
        {
            var resp = agentConnectIntegration.CompleteSession(req);

            var additionalData = ReceiptHelper.GenerateAdditionalDataReceipts(resp.Payload?.Receipts, receiptIntegration);

            var apiResp = new AcApiResponse <CompleteSessionResponse, ReceiptsApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp,
                AdditionalData   = additionalData
            };

            return(apiResp);
        }
コード例 #12
0
        private AcApiResponse <TransactionLookupResponse, ApiData> ExecuteTransactionLookup(TransactionLookupRequest transactionLookupRequest)
        {
            AcApiResponse <TransactionLookupResponse, ApiData> apiResp = new AcApiResponse <TransactionLookupResponse, ApiData>();

            try
            {
                apiResp = _commonBusiness.TransactionLookup(transactionLookupRequest);
            }
            catch (Exception ex)
            {
                apiResp.ApiErrors = new Dictionary <string, string>();
                apiResp.ApiErrors.Add($"{transactionLookupRequest.PurposeOfLookup} TransactionLookup", ex.Message);
            }

            return(apiResp);
        }
コード例 #13
0
        public AcApiResponse <ReceiveValidationResponse, ReceiptsApiData> ReceiveValidation(ReceiveValidationRequest req)
        {
            // AgentConnect Validate call for RECV
            var resp = _agentConnectIntegration.ReceiveValidation(req);

            var additionalData = ReceiptHelper.GenerateAdditionalDataReceipts(resp.Payload?.Receipts, _receiptIntegration);

            // Map: Response Domain->Response View Model
            var apiResp = new AcApiResponse <ReceiveValidationResponse, ReceiptsApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp,
                AdditionalData   = additionalData
            };

            return(apiResp);
        }
コード例 #14
0
        public AcApiResponse <BPValidationResponse, ReceiptsApiData> BPValidation(BPValidationRequest req)
        {
            var resp = agentConnectIntegration.BPValidation(req);

            // Process Receipt
            var additionalData = ReceiptHelper.GenerateAdditionalDataReceipts(resp.Payload?.Receipts, receiptIntegration);

            // Return Response View Model
            var apiResp = new AcApiResponse <BPValidationResponse, ReceiptsApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp,
                AdditionalData   = additionalData
            };

            return(apiResp);
        }
コード例 #15
0
        public AcApiResponse <ViewModels.Consumer.GetPersonalIDImageResponse, ApiData> GetPersonalIDImage(GetPersonalIDImageRequest req)
        {
            var resp = _agentConnectIntegration.GetPersonalIDImage(req);

            var newImageItems = new List <ViewModels.Consumer.ImageItemType>();

            if (resp.Payload != null)
            {
                foreach (var image in resp.Payload.ImageItems)
                {
                    // Convert from byte[] to base64 string
                    newImageItems.Add(new ViewModels.Consumer.ImageItemType
                    {
                        Image = System.Convert.ToBase64String(image.Image.ToArray()),
                        Label = image.Label
                    });
                }
            }

            var GetPersonalIDImageResponsePayload = new ViewModels.Consumer.GetPersonalIDImageResponsePayload
            {
                ImageItems = newImageItems,
                MimeType   = resp?.Payload?.MimeType
            };

            var newResp = new ViewModels.Consumer.GetPersonalIDImageResponse
            {
                Payload = GetPersonalIDImageResponsePayload,
                Errors  = resp.Errors
            };

            var apiResp = new AcApiResponse <ViewModels.Consumer.GetPersonalIDImageResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = newResp
            };

            return(apiResp);
        }
コード例 #16
0
        public AcApiResponse <SendValidationResponse, ReceiptsApiData> SendValidation(SendValidationRequest req)
        {
            //Create request business object for agent connect service call
            req.PrimaryReceiptLanguage   = AuthIntegration.GetAgentPrimaryReceiptLanguage();
            req.SecondaryReceiptLanguage = AuthIntegration.GetAgentSecondaryReceiptLanguage();

            // AgentConnect sendValidation call for SEND
            var resp = _agentConnectIntegration.SendValidation(req);

            // Process Receipt
            var additionalData = ReceiptHelper.GenerateAdditionalDataReceipts(resp.Payload?.Receipts, _receiptIntegration);

            // Return Response View Model
            var apiResp = new AcApiResponse <SendValidationResponse, ReceiptsApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp,
                AdditionalData   = additionalData
            };

            return(apiResp);
        }
コード例 #17
0
        public AcApiResponse <ViewModels.Consumer.GetConsumerProfileDocumentResponse, ApiData> GetConsumerProfileDocument(GetConsumerProfileDocumentRequest reqVm)
        {
            var response = _agentConnectIntegration.GetConsumerProfileDocument(reqVm);

            var newImageItems = new List <ViewModels.Consumer.ImageItemType>();

            if (response.Payload != null)
            {
                foreach (var image in response.Payload.ImageItems)
                {
                    newImageItems.Add(new ViewModels.Consumer.ImageItemType
                    {
                        Image = System.Convert.ToBase64String(image.Image.ToArray()),
                        Label = image.Label
                    });
                }
            }

            var getConsumerProfileDocumentResponsePayload = new ViewModels.Consumer.GetConsumerProfileDocumentResponsePayload
            {
                ImageItems = newImageItems,
                MimeType   = response?.Payload?.MimeType
            };

            var getConsumerProfileDocumentResponse = new ViewModels.Consumer.GetConsumerProfileDocumentResponse()
            {
                Payload = getConsumerProfileDocumentResponsePayload,
                Errors  = response.Errors
            };

            var apiResp = new AcApiResponse <ViewModels.Consumer.GetConsumerProfileDocumentResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(response.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = getConsumerProfileDocumentResponse
            };

            return(apiResp);
        }
コード例 #18
0
        public AcApiResponse <ComplianceTransactionResponse, ApiData> ComplianceTransaction(
            ComplianceTransactionRequest req)
        {
            var deviceId = AuthIntegration.GetDeviceId();

            foreach (var moneyOrder in req.MoneyOrder)
            {
                if (deviceId != moneyOrder.DeviceID)
                {
                    logger.Info(string.Format("The DeviceId {0} does not match the logged in DeviceId {1}", deviceId,
                                              moneyOrder.DeviceID));
                    throw new InvalidDeviceException();
                }
            }
            var resp = agentConnectIntegration.ComplianceTransaction(req);

            var apiResp = new AcApiResponse <ComplianceTransactionResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
コード例 #19
0
        public AcApiResponse <AllLookupResponse, ApiData> All(AllLookupRequest req)
        {
            var respVm = new AllLookupResponse();
            int?flags  = null;

            var apiErrors = new Dictionary <string, string>();

            if (req.GetAllFieldsRequested)
            {
                try
                {
                    var fields = GetAllFields(req.GetAllFieldsReq);
                    respVm.GetAllFieldsResponse = fields.ResponseData;

                    flags = respVm.GetAllFieldsResponse?.Payload?.Flags;
                }
                catch (Exception e)
                {
                    apiErrors.Add("GetAllFields", e.Message);
                }
            }

            if (req.EnumerationsRequested)
            {
                try
                {
                    var enumerations = GetEnumerations(req.EnumerationReq);
                    respVm.GetEnumerationsResponse = enumerations.ResponseData;

                    flags = respVm.GetEnumerationsResponse?.Payload?.Flags;
                }
                catch (Exception e)
                {
                    apiErrors.Add("Enumerations", e.Message);
                }
            }

            if (req.ProfileRequested)
            {
                try
                {
                    var profile = _profileBusiness.Profile(req.ProfileReq);
                    respVm.ProfileResponse = profile.ResponseData;

                    flags = respVm.ProfileResponse?.Payload?.Flags;
                }
                catch (Exception e)
                {
                    apiErrors.Add("Profile", e.Message);
                }
            }

            if (req.CurrenciesRequested)
            {
                try
                {
                    var getCurrencyInfoResponse = GetCurrencyInfo(req.GetCurrencyInfoReq ?? new GetCurrencyInfoRequest());
                    respVm.GetCurrencyInfoResponse = getCurrencyInfoResponse.ResponseData;

                    flags = respVm.GetCurrencyInfoResponse?.Payload?.Flags;
                }
                catch (Exception e)
                {
                    apiErrors.Add("Currencies", e.Message);
                }
            }

            if (req.CountriesRequested)
            {
                try
                {
                    var getCountryInfoResponse = GetCountryInfo(req.GetCountryInfoReq ?? new GetCountryInfoRequest());
                    respVm.GetCountryInfoResponse = getCountryInfoResponse.ResponseData;

                    flags = respVm.GetCountryInfoResponse?.Payload?.Flags;
                }
                catch (Exception e)
                {
                    apiErrors.Add("Countries", e.Message);
                }
            }

            if (req.CountrySubdivisionsRequested)
            {
                try
                {
                    var getCountrySubdivisionResponse =
                        GetCountrySubdivision(req.GetCountrySubdivisionReq ?? new GetCountrySubdivisionRequest());
                    respVm.GetCountrySubdivisionResponse = getCountrySubdivisionResponse.ResponseData;

                    flags = respVm.GetCountrySubdivisionResponse?.Payload?.Flags;
                }
                catch (Exception e)
                {
                    apiErrors.Add("CountrySubdivisions", e.Message);
                }
            }

            if (req.IndustriesRequested)
            {
                try
                {
                    var industryResponse = Industry(req.IndustryRequestReq ?? new IndustryRequest());
                    respVm.IndustryResponse = industryResponse.ResponseData;

                    flags = respVm.IndustryResponse?.Payload?.Flags;
                }
                catch (Exception e)
                {
                    apiErrors.Add("Industries", e.Message);
                }
            }

            var apiResp = new AcApiResponse <AllLookupResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(flags, DataSource.Lookup),
                ResponseData     = respVm,
                ApiErrors        = apiErrors.Any() ? apiErrors : null
            };

            return(apiResp);
        }
コード例 #20
0
        public AcApiResponse <EditTransferTransactionResponse, ApiData> TransactionLookup(TransactionLookupRequest transactionLookupRequest)
        {
            var respVm      = new EditTransferTransactionResponse();
            var respPayload = new EditTransferTransactionResponsePayload();
            ApiResponse <TransactionLookupResponse, ApiData> respAmend           = null;
            ApiResponse <TransactionLookupResponse, ApiData> respSendReversal    = null;
            ApiResponse <TransactionLookupResponse, ApiData> respReceiveReversal = null;

            int?flags     = null;
            var apiErrors = new Dictionary <string, string>();

            var productAuthorizations = AuthIntegration.GetProductAuthorizations();

            if (productAuthorizations.CanAmend)
            {
                transactionLookupRequest.PurposeOfLookup = PurposeOfLookup.Amend;
                respAmend = ExecuteTransactionLookup(transactionLookupRequest);
                respPayload.AmendTransactionLookupResponse = respAmend;
                if (respAmend.ApiErrors != null)
                {
                    foreach (var errItem in respAmend.ApiErrors)
                    {
                        apiErrors.Add(errItem.Key, errItem.Value);
                    }
                }
            }
            if (productAuthorizations.CanSendReversal)
            {
                transactionLookupRequest.PurposeOfLookup = PurposeOfLookup.SendReversal;
                respSendReversal = ExecuteTransactionLookup(transactionLookupRequest);
                respPayload.SendReversalTransactionLookupResponse = respSendReversal;
                if (respSendReversal.ApiErrors != null)
                {
                    foreach (var errItem in respSendReversal.ApiErrors)
                    {
                        apiErrors.Add(errItem.Key, errItem.Value);
                    }
                }
            }
            if (productAuthorizations.CanReceiveReversal)
            {
                transactionLookupRequest.PurposeOfLookup = PurposeOfLookup.ReceiveReversal;
                respReceiveReversal = ExecuteTransactionLookup(transactionLookupRequest);
                respPayload.ReceiveReversalTransactionLookupResponse = respReceiveReversal;
                if (respReceiveReversal.ApiErrors != null)
                {
                    foreach (var errItem in respReceiveReversal.ApiErrors)
                    {
                        apiErrors.Add(errItem.Key, errItem.Value);
                    }
                }
            }

            //
            if (respAmend?.ResponseData?.Payload == null &&
                respSendReversal?.ResponseData?.Payload == null &&
                respReceiveReversal?.ResponseData?.Payload == null)
            {
                respVm.EditTransferTransactionResponsePayload = null;
                respVm.Errors = new List <BusinessError>();
                if (respAmend?.ResponseData?.Errors != null)
                {
                    respVm.Errors.AddRange(respAmend.ResponseData.Errors);
                }
                if (respSendReversal?.ResponseData?.Errors != null)
                {
                    respVm.Errors.AddRange(respSendReversal.ResponseData.Errors);
                }
                if (respReceiveReversal?.ResponseData?.Errors != null)
                {
                    respVm.Errors.AddRange(respReceiveReversal.ResponseData.Errors);
                }
            }
            else
            {
                respVm.EditTransferTransactionResponsePayload = new EditTransferTransactionResponsePayload();
                respVm.EditTransferTransactionResponsePayload.AmendTransactionLookupResponse           = respAmend;
                respVm.EditTransferTransactionResponsePayload.SendReversalTransactionLookupResponse    = respSendReversal;
                respVm.EditTransferTransactionResponsePayload.ReceiveReversalTransactionLookupResponse = respReceiveReversal;
                respVm.EditTransferTransactionResponsePayload.Flags = flags.GetValueOrDefault();
            }

            var apiResp = new AcApiResponse <EditTransferTransactionResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(flags, DataSource.Lookup),
                ResponseData     = respVm,
                ApiErrors        = apiErrors.Any() ? apiErrors : null
            };

            return(apiResp);
        }