Ejemplo n.º 1
0
        /// <summary>
        /// Implements call to Twofish method widgetConfig
        /// </summary>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XmlDocument document containing the WidgetConfig information</returns>
        public XmlDocument WidgetConfig(CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            DebugLog("WidgetConfig", keyValues);

            return(rest.GetXMLRequest("widgetConfig", keyValues));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retreive information about a transfer of funds
        /// </summary>
        /// <param name="id">id of transfer to find</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML document containing the information about the transfer</returns>
        public XmlDocument FindTransfer(string id, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);
            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("id", id);

            DebugLog("FindTransfer", keyValues);

            return(rest.GetXMLRequest("transfer", keyValues));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Implements call to user method to retreive user information
        /// </summary>
        /// <param name="userId">userId</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML response document containing user information</returns>
        public XmlDocument UserInfo(UserId userId, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("id", userId.ToString());

            DebugLog("UserInfo", keyValues);

            return(rest.GetXMLRequest("user", keyValues));    //twofish Command FindUser
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Implements call to Twofish method ItemTypes to retrieve the item type information for a given store
        /// </summary>
        /// <param name="storeName"></param>
        /// <param name="commmonKeyValue"></param>
        /// <param name="baseAddress"></param>
        /// <returns>Twofish XML response document containing item type information for a given store</returns>
        public XmlDocument ItemTypes(string storeName, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(true);

            keyValues.Add("storeName", storeName);

            DebugLog("ItemTypes", keyValues);

            return(rest.GetXMLRequest("itemTypes", keyValues));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Implements call to Twofish method CreateCatalog
        /// </summary>
        /// <param name="itemsInfo">IPAddress</param>
        /// <param name="fileData">Twofish catalog csv file</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>Twofish CreateCatalog XML response document</returns>
        public XmlDocument CreateCatalog(ItemsInfo itemsInfo, PostFile fileData, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(true);

            keyValues.Add("ipAddress", itemsInfo.IPAddress);

            DebugLog("CreateCatalog", keyValues);

            return(rest.MultiPartFormXMLPost("catalog", keyValues, fileData.FileData));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Implements call to Twofish method StoreBulkLoad
        /// Loads a store catalog
        /// </summary>
        /// <param name="storeInfo">IpAddress</param>
        /// <param name="fileData">Twofish store csv file</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>Twofish store bulk load XML response document</returns>
        public XmlDocument StoreBulkLoad(StoreInfo storeInfo, PostFile fileData, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("ipAddress", storeInfo.IpAddress);
            keyValues.Add("submit", "User Bulk Load (pretty format)");
            DebugLog("StoreBulkLoad", keyValues);

            return(rest.MultiPartFormXMLPost("store/bulk", keyValues, fileData.FileData));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Implements call to Twofish method item to find an item.
        /// </summary>
        /// <param name="itemsInfo">ItemName</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>Twofish XML response document containing detailed information about the Item</returns>
        public XmlDocument FindItem(ItemsInfo itemsInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(true);

            keyValues.Add("name", itemsInfo.ItemName);

            DebugLog("Item", keyValues);

            return(rest.GetXMLRequest("item", keyValues));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Implements call to user/widget method to retreive user foreign exchange offers and payment methods
        /// </summary>
        /// <param name="userId">userId</param>
        /// <param name="virtualCurrencyId">virtualCurrencyId</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML response document containing user foreign exchange offers and payment methods</returns>
        public XmlDocument UserWidget(UserId userId, String virtualCurrencyId, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false, "DefaultPaymentGateway");

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("virtualCurrencyId", virtualCurrencyId);

            DebugLog("UserWidget", keyValues);

            return(rest.GetXMLRequest("user/widget", keyValues));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Implements call to user/secureKey method to generate a new secure key for the user.
        /// </summary>
        /// <param name="userId">userId, IPAddress</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML response document containing user new secure key</returns>
        public XmlDocument SecureKey(UserId userId, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("ipAddress", userId.IPAddress);

            DebugLog("SecureKey", keyValues);

            return(rest.PostXMLRequest("user/secureKey", keyValues));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Implements call to Twofish method purchase/paypal/checkout to start the Paypal checkout process
        /// Purchase a foreign exchange offer
        /// </summary>
        /// <param name="userId">userId, IPAddress</param>
        /// <param name="purchaseInfo">OfferId, ExternalTxnId</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML document containing Paypal url used to continue the purchase process</returns>
        public XmlDocument PayPalCheckout(UserId userId, PurchaseInfo purchaseInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("ipAddress", userId.IPAddress);
            keyValues.Add("offerId", purchaseInfo.OfferId);
            keyValues.Add("externalTxnId", purchaseInfo.ExternalTxnId);

            DebugLog("PayPalCheckout", keyValues);

            return(rest.PostXMLRequest("purchase/paypal/checkout", keyValues));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Implements call to Twofish method StoreBulkGet
        /// Retreive Twofish Store offers
        /// </summary>
        /// <param name="storeInfo">StoreName, IpAddress</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML response document containing the Twofish CSV file listing all store offers</returns>
        public XmlDocument StoreBulkGet(StoreInfo storeInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(true);

            keyValues.Add("name", storeInfo.StoreName);
            keyValues.Add("ipAddress", storeInfo.IpAddress);

            DebugLog("StoreBulkGet", keyValues);

            string storeData = rest.GetStringRequest("store/bulk", keyValues);

            return(rest.WrapDataXML("Store", "StoreBulkGet", storeInfo.StoreName, storeData));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Implements call to Twofish method FindCurrency
        /// </summary>
        /// <param name="currencyInfo">id, appId</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XmlDocument document containing the list of currency's for the application</returns>
        public XmlDocument FindCurrency(CurrencyInfo currencyInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);
            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            if (currencyInfo != null)
            {
                keyValues.Add("currency.id", currencyInfo.CurrencyId);
                keyValues.Add("currency.appId", currencyInfo.CurrencyAppId);
            }

            DebugLog("FindCurrency", keyValues);

            return(rest.GetXMLRequest("currency", keyValues));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Does a tranfer of funds from one account to another account of the same currency.
        /// </summary>
        /// <param name="transferInfo">Amount, DebitAccountId, CreditAccountId, TransferType, ExternalTxnId, IpAddress</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML document containing results of the transfer</returns>
        public XmlDocument CreateTransfer(TransferInfo transferInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);
            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("amount", transferInfo.Amount);
            keyValues.Add("debitAccountId", transferInfo.DebitAccountId);
            keyValues.Add("creditAccountId", transferInfo.CreditAccountId);
            keyValues.Add("transferType", transferInfo.TransferType);
            keyValues.Add("externalTxnId", transferInfo.ExternalTxnId);
            keyValues.Add("ipAddress", transferInfo.IpAddress);

            DebugLog("CreateTransfer", keyValues);

            return(rest.PostXMLRequest("transfer", keyValues));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Implements call to Twofish method FindCatalog
        /// Retreive Twofish items catalog
        /// </summary>
        /// <param name="itemsInfo">ItemTypeNames, IPAddress</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML response document containing the Twofish CSV file listing the Items Catalog</returns>
        public XmlDocument FindCatalog(ItemsInfo itemsInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("appName", GetAppName());
            keyValues.Add("itemTypeNames", itemsInfo.ItemTypeNames);
            keyValues.Add("ipAddress", itemsInfo.IPAddress);

            DebugLog("FindCatalog", keyValues);

            string catalogData = rest.GetStringRequest("catalog", keyValues);

            return(rest.WrapDataXML("Catalog", "FindCatalog", "Catalog", catalogData));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Implements call to Twofish method purchase to retreive the user payment history
        /// </summary>
        /// <param name="userId">userId</param>
        /// <param name="filter">StartIndex, BlockSize</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XmlDocument document containing the users purchase history</returns>
        public XmlDocument PurchaseHistory(UserId userId, ResultFilter filter, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("id", userId.ToString());

            if (filter != null)
            {
                keyValues.Add("fetchRequest.startIndex", filter.StartIndex);
                keyValues.Add("fetchRequest.blockSize", filter.BlockSize);
            }
            DebugLog("purchase", keyValues);

            return(rest.GetXMLRequest("purchase", keyValues));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Purchase an item as a gift from a store.
        /// </summary>
        /// <param name="userId">userId</param>
        /// <param name="purchaseInfo">RecipientUserId, NoteToRecipient AccountId, OfferIds, ExternalTxnId, IPAddress</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML document containing purchase gift results</returns>
        public XmlDocument PurchaseGift(UserId userId, PurchaseInfo purchaseInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("recipientUserId", purchaseInfo.RecipientUserId);
            keyValues.Add("note", purchaseInfo.NoteToRecipient);
            keyValues.Add("accountId", purchaseInfo.AccountId);
            keyValues.Add("offerId", purchaseInfo.OfferId);
            keyValues.Add("externalTxnId", purchaseInfo.ExternalTxnId);
            keyValues.Add("ipAddress", userId.IPAddress);

            DebugLog("PurchaseGift", keyValues);

            return(rest.PostXMLRequest("store/purchaseGift", keyValues));
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Parse CSV file that is a Catalog File, a Store File or a combination of Catalog and Store File.
        /// Upload created Catalog and Store Files to Twofish returning the XML results form Twofish.
        /// </summary>
        /// <param name="itemInfo">ItemsInfo, used for the for the the IP Address.</param>
        /// <param name="fileData">PostFile The CSV file</param>
        /// <param name="commmonKeyValue">CommmonKeyValues</param>
        /// <param name="baseAddress">BaseAddress</param>
        /// <returns>An XML document containing the response from Catalog and or Store uploads as returned by Twofish.</returns>
        public XmlDocument UploadCatalogStore(ItemsInfo itemInfo, PostFile fileData, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            XmlDocument response = null;

            try
            {
                response = new XmlDocument();
                response.LoadXml("<response></response>");

                fileData.RemoveLeadingSpacesAndLines();

                PostFile catalogFile = CreateCatalogUpload(fileData);
                if (catalogFile.FileData != null)
                {
                    Catalog     catalogCommand  = new Catalog();
                    XmlDocument catalogResponse = catalogCommand.CreateCatalog(itemInfo, catalogFile, commmonKeyValue, baseAddress);
                    AddToResponse(response, "/response", "Catalog", catalogResponse);
                }

                StoreInfo storeInfo = new StoreInfo();
                storeInfo.IpAddress = itemInfo.IPAddress;

                string[] storeNameArray = FindStoreNames(fileData);

                if (storeNameArray != null)
                {
                    foreach (string storeName in storeNameArray)
                    {
                        Store       storeCommand  = new Store();
                        PostFile    storeFile     = CreateStoreUpload(fileData, storeName);
                        XmlDocument storeResponse = storeCommand.StoreBulkLoad(storeInfo, storeFile, commmonKeyValue, baseAddress);
                        AddToResponse(response, "/response", storeName, storeResponse);
                    }
                }
            }

            catch (Exception ex)
            {
                response = CreateErrorDoc(ex.Message);
                logError("UploadCatalogStore", ex);
            }

            return(response);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Implements call to user/update method to update a Twofish user account
        /// </summary>
        /// <param name="userInfo">UserId, CountryCode, ExternalKey, Gender, DateOfBirth, EmailAddress, Tags, IPAddress</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML response document containing user information</returns>
        public XmlDocument UpdateUser(UserInfo userInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("user.id", userInfo.UserId);
            keyValues.Add("user.countryCode", userInfo.CountryCode);
            keyValues.Add("user.externalKey", userInfo.ExternalKey);
            keyValues.Add("user.gender", userInfo.Gender);
            keyValues.Add("user.dateOfBirth", userInfo.DateOfBirth);
            keyValues.Add("user.emailAddress", userInfo.EmailAddress);
            keyValues.Add("user.tags", userInfo.Tags);
            keyValues.Add("ipAddress", userInfo.IPAddress);

            DebugLog("UpdateUser", keyValues);

            return(rest.PostXMLRequest("user/update", keyValues));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Retrieve all of the store offer for a given store
        /// </summary>
        /// <param name="storeName">storeName<storeName/param>
        /// <param name="filter">ItemTypeNames, MaxRemaining, LatestEndDate, OrderBy, Descending, StartIndex, BlockSize</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML doucment containing stores offers</returns>
        public XmlDocument FindStore(String storeName, ResultFilter filter, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(true);

            keyValues.Add("name", storeName);
            keyValues.Add("itemTypeNames", filter.ItemTypeNames);
            keyValues.Add("maxRemaining", filter.MaxRemaining);
            keyValues.Add("latestEndDate", filter.LatestEndDate);
            keyValues.Add("orderBy", filter.OrderBy);
            keyValues.Add("descending", filter.Descending);
            keyValues.Add("fetchRequest.startIndex", filter.StartIndex);
            keyValues.Add("fetchRequest.blockSize", filter.BlockSize);

            DebugLog("Store", keyValues);

            return(rest.GetXMLRequest("store", keyValues));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Implements call to Twofish method item/update to update an item
        /// </summary>
        /// <param name="itemsInfo">ItemName, ItemTypeName, ButtonName, Description, SmallImageUrl, MediumImageUrl, LargeImageUrl, Available, IPAddress</param>
        /// <param name="appName">The name of the application to contain the item</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>Twofish XML response document containing Update Item response</returns>
        public XmlDocument UpdateItem(ItemsInfo itemsInfo, string appName, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("item.name", itemsInfo.ItemName);
            keyValues.Add("item.appName", appName);
            keyValues.Add("item.itemTypeName", itemsInfo.ItemTypeName);
            keyValues.Add("item.buttonName", itemsInfo.ButtonName);
            keyValues.Add("item.description", itemsInfo.Description);
            keyValues.Add("item.smallImageUrl", itemsInfo.SmallImageUrl);
            keyValues.Add("item.mediumImageUrl", itemsInfo.MediumImageUrl);
            keyValues.Add("item.largeImageUrl", itemsInfo.LargeImageUrl);
            keyValues.Add("item.available", itemsInfo.Available);
            keyValues.Add("ipAddress", itemsInfo.IPAddress);
            //   keyValues.Add("p.color", "Blue");  // Test for additional properties.

            DebugLog("UpdateItem", keyValues);

            return(rest.PostXMLRequest("item/update", keyValues));
        }
Ejemplo n.º 21
0
        public XmlDocument PaymentServiceURL(UserId userId, PurchaseInfo purchaseInfo, GatewayInfo gateWayInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("ipAddress", userId.IPAddress);
            keyValues.Add("forexOfferId", purchaseInfo.OfferId);
            keyValues.Add("paymentGatewayConfigId", gateWayInfo.PaymentGatewayConfigId);
            keyValues.Add("returnURL", gateWayInfo.ReturnURL);
            keyValues.Add("cancelURL", gateWayInfo.CancelURL);

            DebugLog("PaymentServiceURL", keyValues);

            return(rest.GetXMLRequest("purchase/paymentServiceURL", keyValues));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Implements call to Twofish method purchase/oneClick to complete a one click credit card purchase
        /// User SecureKey is required
        /// Purchase of a foreign exchange offer
        /// </summary>
        /// <param name="userId">userId, IPAddress, SecureKey</param>
        /// <param name="purchaseInfo">OfferId, ExternalTxnId</param>
        /// <param name="creditCardInfo">SecurityCode</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML document containing one click credit card purchase results</returns>
        public XmlDocument PurchaseCreditCardOneClick(UserId userId, PurchaseInfo purchaseInfo, CreditCardInfo creditCardInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("ipAddress", userId.IPAddress);
            keyValues.Add("secureKey", userId.SecureKey);
            keyValues.Add("offerId", purchaseInfo.OfferId);
            keyValues.Add("externalTxnId", purchaseInfo.ExternalTxnId);
            keyValues.Add("cc.securityCode", creditCardInfo.SecurityCode);

            //Do not log the credit card number in plain text
            string[] itemsToEncrypt = new string[] { "cc.securityCode" };
            DebugLogEncryptList("PurchaseCreditCard", keyValues, itemsToEncrypt);

            return(rest.PostXMLRequest("purchase/oneClick", keyValues));
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Implements call to Twofish method purchase/creditCard to complete a recurring credit card purchase
        /// Recurring purchase of a foreign exchange offer
        /// </summary>
        /// <param name="userId">userId, IPAddress, SecureKey (optional)</param>
        /// <param name="purchaseInfo">OfferId, ExternalTxnId, Token, PayerId</param>
        /// <param name="creditCardInfo">CreditCardnumber, CreditCardtype, ExpireDate, SecurityCode, FirstName, MiddleName, LastName, Address, City, StateProvince, ZipCode, CountryCode, PhoneNumber</param>
        /// <param name="recurringInfo">StartDate, NumPayments, PayFrequency</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML document containing recurring credit card purchase results</returns>
        public XmlDocument PurchaseCreditCardRecurring(UserId userId, PurchaseInfo purchaseInfo, CreditCardInfo creditCardInfo, PurchaseRecurringInfo recurringInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("ipAddress", userId.IPAddress);
            keyValues.Add("secureKey", userId.SecureKey);
            keyValues.Add("offerId", purchaseInfo.OfferId);
            keyValues.Add("externalTxnId", purchaseInfo.ExternalTxnId);
            keyValues.Add("cc.number", creditCardInfo.CreditCardnumber);
            keyValues.Add("cc.type", creditCardInfo.CreditCardtype);
            keyValues.Add("cc.expDate", creditCardInfo.ExpireDate);
            keyValues.Add("cc.securityCode", creditCardInfo.SecurityCode);
            keyValues.Add("cc.firstName", creditCardInfo.FirstName);
            keyValues.Add("cc.middleName", creditCardInfo.MiddleName);
            keyValues.Add("cc.surname", creditCardInfo.LastName);
            keyValues.Add("cc.address", creditCardInfo.Address);
            keyValues.Add("cc.city", creditCardInfo.City);
            keyValues.Add("cc.stateProvince", creditCardInfo.StateProvince);
            keyValues.Add("cc.zip", creditCardInfo.ZipCode);
            keyValues.Add("cc.countryCode", creditCardInfo.CountryCode);
            keyValues.Add("cc.phoneNumber", creditCardInfo.PhoneNumber);
            keyValues.Add("startDateString", recurringInfo.StartDate);
            keyValues.Add("numPayments", recurringInfo.NumPayments);
            keyValues.Add("payFrequency", recurringInfo.PayFrequency);

            //Do not log the credit card number in plain text
            string[] itemsToEncrypt = new string[] { "cc.number", "cc.securityCode" };
            DebugLogEncryptList("PurchaseCreditCard", keyValues, itemsToEncrypt);

            return(rest.PostXMLRequest("purchase/creditCardRecurring", keyValues));
        }
Ejemplo n.º 24
0
        public XmlDocument PaymentOptions(UserId userId, string PaymentGatewayName, PaymentInfo paymentInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false, PaymentGatewayName);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("countryCode", paymentInfo.CountryCode);
            keyValues.Add("currencyCode", paymentInfo.CurrencyCode);
            keyValues.Add("virtualCurrencyIds", paymentInfo.VirtualCurrencyIds);

            DebugLog("PaymentOptions", keyValues);

            return(rest.GetXMLRequest("user/paymentOptions", keyValues));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Implements call to Twofish method purchase/paypal/recurring to complete the Paypal recurring payment purchase checkout process
        /// This is called from the Paypal callback method
        /// </summary>
        /// <param name="userId">userId, IPAddress</param>
        /// <param name="purchaseInfo">OfferId, ExternalTxnId, Token, PayerId</param>
        /// <param name="recurringInfo">BillingDescription, StartDate, NumPayments, PayFrequency</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>XML document containing recurring purchase results</returns>
        public XmlDocument PayPalRecurringPurchase(UserId userId, PurchaseInfo purchaseInfo, PurchaseRecurringInfo recurringInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("offerId", purchaseInfo.OfferId);
            keyValues.Add("externalTxnId", purchaseInfo.ExternalTxnId);
            keyValues.Add("token", purchaseInfo.Token);
            keyValues.Add("payerId", purchaseInfo.PayerId);
            keyValues.Add("ipAddress", userId.IPAddress);
            keyValues.Add("billingDescription", recurringInfo.BillingDescription);
            keyValues.Add("startDateString", recurringInfo.StartDate);
            keyValues.Add("numPayments", recurringInfo.NumPayments);
            keyValues.Add("payFrequency", recurringInfo.PayFrequency);

            DebugLog("PayPalRecurringPurchase", keyValues);

            return(rest.PostXMLRequest("purchase/paypal/recurring", keyValues));
        }
Ejemplo n.º 26
0
        // loop though each parameter in the method and look for argIndex corresponding
        //
        /// <summary>
        /// GetCommandTheArgs loops though each parameter in the method and look for argIndex corresponding
        /// parameter are in the command object or standard commands.
        /// </summary>
        /// <param name="methodInfo">Reflection MethodInfo used to retrieve the parameter types for the method to be invoked</param>
        /// <param name="parameters">Dictionary of the input parmeters</param>
        /// <param name="fileData">MemoryStream containing file data. In most cases null.</param>
        /// <returns>object containing the arguments for the method to be invoked</returns>
        private object[] GetCommandTheArgs(MethodInfo methodInfo, NameValueCollection parameters, MemoryStream fileData)
        {
            int numArgs = methodInfo.GetParameters().Length;

            object[] args = new object[numArgs];

            try
            {
                for (int argIndex = 0; argIndex < numArgs; argIndex++)
                {
                    ParameterInfo parameterInfo = methodInfo.GetParameters()[argIndex];

                    if (parameterInfo.ParameterType == typeof(UserId))
                    {
                        args[argIndex] = GetUserIdParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(CommmonKeyValues))
                    {
                        args[argIndex] = new CommmonKeyValues();;
                    }
                    else if (parameterInfo.ParameterType == typeof(BaseAddress))
                    {
                        args[argIndex] = new BaseAddress();
                    }
                    else if (parameterInfo.ParameterType == typeof(UserInfo))
                    {
                        args[argIndex] = GetUserInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(ItemsInfo))
                    {
                        args[argIndex] = GetItemsInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(CurrencyInfo))
                    {
                        args[argIndex] = GetCurrencyInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(PurchaseInfo))
                    {
                        args[argIndex] = GetPurchaseInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(PaymentInfo))
                    {
                        args[argIndex] = GetPaymentInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(CatalogInfo))
                    {
                        args[argIndex] = GetCatalogInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(StoreInfo))
                    {
                        args[argIndex] = GetStoreInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(ResultFilter))
                    {
                        args[argIndex] = GetResultFilterParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(TransferInfo))
                    {
                        args[argIndex] = GetTransferInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(CreditCardInfo))
                    {
                        args[argIndex] = GetCreditCardInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(PurchaseRecurringInfo))
                    {
                        args[argIndex] = GetPurchaseRecurringInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(GatewayInfo))
                    {
                        args[argIndex] = GetGatewayInfoParamaters(parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(String))
                    {
                        args[argIndex] = GetStringParamater(parameterInfo.Name, parameters);
                    }
                    else if (parameterInfo.ParameterType == typeof(PostFile))
                    {
                        PostFile postFile = new PostFile();
                        fileData.Position = 0;
                        postFile.FileData = fileData;
                        args[argIndex]    = postFile;
                    }
                }
            }

            catch (Exception ex)
            {
                logError("GetCommandTheArgs", ex);
            }

            return(args);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Implements call to Twofish method itemInstances to retrieve the item instance information for a user and item
        /// </summary>
        /// <param name="userId">userId</param>
        /// <param name="itemsInfo">ItemName, ItemTypeName, IPAddress</param>
        /// <param name="filter">Filter</param>
        /// <param name="commmonKeyValue">Twofish REST service common values</param>
        /// <param name="baseAddress">Twofish REST service base address</param>
        /// <returns>Twofish XML response document containing item instances information for a user and item</returns>
        public XmlDocument ItemInstance(UserId userId, ItemsInfo itemsInfo, ResultFilter filter, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress)
        {
            ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue);

            Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(true);

            keyValues.Add("userId", userId.ToString());
            keyValues.Add("itemName", itemsInfo.ItemName);
            keyValues.Add("itemTypeName", itemsInfo.ItemTypeName);
            keyValues.Add("ipAddress", itemsInfo.IPAddress);
            keyValues.Add("filter", filter.Filter);
            keyValues.Add("fetchRequest.startIndex", filter.StartIndex);
            keyValues.Add("fetchRequest.blockSize", filter.BlockSize);

            DebugLog("ItemInstance", keyValues);

            return(rest.GetXMLRequest("itemInstances", keyValues));
        }