/// <summary>
        /// Test connectivity for ENett API
        /// </summary>
        /// <param name="user">User</param>
        public static void TestENettService(UserInfo user)
        {
            vNettService client = null;

            try
            {
                // Define a new vNett service connection
                client = new vNettService();

                // Let's test Enett API
                // for a fictive Payment ID
                ENettGetVANDetails reader = EnettUtils.ReadGetVANDetails("<GetVANDetails><PaymentID>XXXXX</PaymentID></GetVANDetails>");

                // We will submit a fictive payment id and requets detail for it
                // Of course we won't receive sucessful response but we expect that the call will be done
                // without any connection issue
                GetVNettVANResponse result = Services.GetENettVANDetails(user, reader);

                // We have called successfully ENett API
            }
            finally
            {
                // dispose
                if (client != null)
                {
                    client.Dispose();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Return values from ENett API
        /// and prepare response to caller
        /// </summary>
        /// <param name="user">user</param>
        /// <param name="vNettresponse">CompleteIssueVNettVANResponse</param>
        /// <param name="ENettGetVANDetails">ENettRequestVAN</param>
        public void SetValues(UserInfo user, GetVNettVANResponse vNettResponse, ENettGetVANDetails reader)
        {
            if (!vNettResponse.IsSuccessful)
            {
                // The request failed
                // we need to get support log id from ENett
                SetSupportLogId(vNettResponse.SupportLogId);

                // The request was not succesfully processed
                // Set the exception code and message
                SetException(user, new CEEException(vNettResponse.ErrorCode.ToString()
                                                    , vNettResponse.ErrorDescription).GetCompleteExceptionMessage());

                // No need to go further!
                return;
            }

            // The response is success
            // Let's extract and return to caller all information
            SetVNettTransactionID(vNettResponse.VNettTransactionID);
            SetPaymentID(reader.PaymentID);
            SetVAN(vNettResponse.VirtualAccountNumber);
            SetActivationDate(Util.ConvertStringToDate(vNettResponse.ActivationDate, Const.DateFormat_yyyyMMdd));
            /// EGE - 70723 ENett Response Expiry Date send to FO
            SetExpirationDate(Util.ConvertStringToDate(vNettResponse.CardExpiryDate, Const.DateFormat_MMyyyy));
            SetCardSecurityCode(vNettResponse.CardSecurityCode);
            SetCardHolderName(vNettResponse.CardHolderName);
            SetFundedAmount(vNettResponse.FundedAmount);
            SetMultiUse(vNettResponse.IsMultiUse);
            SetCurrency(vNettResponse.Currency);
        }
Example #3
0
        /// <summary>
        /// Reads request for requestVANDetails and
        /// parse input
        /// </summary>
        /// <param name="xmlRequest">XML request</param>
        /// <returns>ENettRequestVAN</returns>
        public static ENettGetVANDetails ReadGetVANDetails(string xmlRequest)
        {
            //XML Serialization
            ENettGetVANDetails RequestObject = new ENettGetVANDetails();
            XmlRootAttribute   xRoot         = new XmlRootAttribute();

            xRoot.ElementName = XMLHeaderGetVANDetails;
            xRoot.IsNullable  = true;


            XmlSerializer mySerializer = new XmlSerializer(typeof(ENettGetVANDetails), xRoot);

            using (TextReader tr = new StringReader(xmlRequest))
            {
                RequestObject = (ENettGetVANDetails)mySerializer.Deserialize(tr);
            }
            return(RequestObject);
        }
Example #4
0
        /// <summary>
        /// Prepare new ENett Virtual Account Number (VAN)
        /// </summary>
        /// <param name="user">User</param>
        /// <param name="reader">ENettGetVANDetails</param>
        /// <returns>GetVNettVANRequest</returns>
        public static GetVNettVANRequest GetENettVANDetails(UserInfo user, ENettGetVANDetails reader)
        {
            // Let's request VAN details
            GetVNettVANRequest amdReq = new GetVNettVANRequest();

            amdReq.IntegratorReference = reader.PaymentID;
            amdReq.IntegratorCode      = GetIntegratorCode();
            amdReq.IntegratorAccessKey = GetIntegratorAccessKey();
            amdReq.RequesterECN        = GetRequestorECN();


            // Please follow the same order. Client Access key + ECN + PaymentID  (IntegratorReference)
            string msgDigest = GetClientAccessKey() + GetRequestorECN() + reader.PaymentID;

            byte[] arr = System.Text.Encoding.Default.GetBytes(msgDigest);
            amdReq.MessageDigest = SHA1HashEncode(arr);

            return(amdReq);
        }