예제 #1
0
        public static Purchases CreateSampleEftPurchase()
        {
            long accountNumber = LongRandom(100000000, 9999999999);

            return(Purchases.Builder()
                   .MerchantRefNum(Guid.NewGuid().ToString())
                   .Amount(9999)
                   .Eft()
                   .AccountHolderName("XYZ Company")
                   .AccountNumber(accountNumber.ToString())
                   .TransitNumber("22446")
                   .InstitutionId("001")
                   .Done()
                   .CustomerIp("192.0.126.101")
                   .Profile()
                   .FirstName("John")
                   .LastName("Smith")
                   .Email("*****@*****.**")
                   .Done()
                   .BillingDetails()
                   .Street("100 Queen Street West")
                   .City("Los Angeles")
                   .State("CA")
                   .Country("US")
                   .Zip("90210")
                   .Phone("3102649010")
                   .Done()
                   .Build());
        }
예제 #2
0
        public static Purchases CreateSampleAchPurchase()
        {
            long accountNumber = LongRandom(1000, 99999999999999999);

            return(Purchases.Builder()
                   .MerchantRefNum(Guid.NewGuid().ToString())
                   .Amount(9999)
                   .Ach()
                   .AccountType("CHECKING")
                   .AccountNumber(accountNumber.ToString())
                   .AccountHolderName("XYZ Business")
                   .RoutingNumber("122000661")
                   .PayMethod("WEB")
                   .Done()
                   .CustomerIp("192.0.126.101")
                   .Profile()
                   .FirstName("John")
                   .LastName("Smith")
                   .Email("*****@*****.**")
                   .Done()
                   .BillingDetails()
                   .Street("100 Queen Street West")
                   .City("Los Angeles")
                   .State("CA")
                   .Country("US")
                   .Zip("90210")
                   .Phone("3102649010")
                   .Done()
                   .Build());
        }
        private Request GetInternal(Purchases purchase)
        {
            purchase.SetRequiredFields(new List <string> {
                GlobalConstants.Id,
            });
            purchase.CheckRequiredFields();
            purchase.SetOptionalFields(new List <string> {
                GlobalConstants.Ach,
                GlobalConstants.Bacs,
                GlobalConstants.Eft,
                GlobalConstants.Sepa,
            });

            return(new Request(
                       method: RequestType.Get,
                       uri: PrepareUri(_client.Account() + "/purchases/" + purchase.Id()),
                       body: purchase
                       ));
        }
예제 #4
0
        /// <summary>
        /// Create get
        /// </summary>
        /// <param name="get">get</param>
        /// <returns>Purchases</returns>
        public Purchases Get(Purchases purchase)
        {
            purchase.SetRequiredFields(new List <string> {
                GlobalConstants.Id,
            });
            purchase.CheckRequiredFields();
            purchase.SetOptionalFields(new List <string> {
                GlobalConstants.Ach,
                GlobalConstants.Bacs,
                GlobalConstants.Eft,
                GlobalConstants.Sepa,
            });

            Request request = new Request(
                method: RequestType.Get,
                uri: PrepareUri(_client.Account() + "/purchases/" + purchase.Id()),
                body: purchase
                );
            dynamic response = _client.ProcessRequest(request);

            return(new Purchases(response));
        }
예제 #5
0
        /// <summary>
        /// Create get
        /// </summary>
        /// <param name="get">get</param>
        /// <returns>Purchases</returns>
        public Purchases get(Purchases purchase)
        {
            purchase.setRequiredFields(new List <string> {
                DirectDebitConstants.id,
            });
            purchase.checkRequiredFields();
            purchase.setOptionalFields(new List <string> {
                DirectDebitConstants.ach,
                DirectDebitConstants.bacs,
                DirectDebitConstants.eft,
                DirectDebitConstants.sepa,
            });

            Request request = new Request(
                method: RequestType.GET,
                uri: this.prepareURI(client.account() + "/purchases/" + purchase.id()),
                body: purchase
                );
            dynamic response = this.client.processRequest(request);

            return(new Purchases(response));
        }
예제 #6
0
        /// <summary>
        /// Get matching Purchases
        /// </summary>
        /// <param name="purchases"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public Pagerator <Purchases> GetPurchase(Purchases purchases = null, Filter filter = null)
        {
            Dictionary <String, String> queryStr = new Dictionary <String, String>();

            if (purchases != null && !String.IsNullOrWhiteSpace(purchases.MerchantRefNum()))
            {
                queryStr.Add("merchantRefNum", purchases.MerchantRefNum());
            }
            if (filter != null)
            {
                if (filter.Limit != null)
                {
                    queryStr.Add("limit", filter.Limit.ToString());
                }
                if (filter.Offset != null)
                {
                    queryStr.Add("offset", filter.Offset.ToString());
                }
                if (!String.IsNullOrWhiteSpace(filter.StartDate))
                {
                    queryStr.Add("startDate", filter.StartDate);
                }
                if (!String.IsNullOrWhiteSpace(filter.EndDate))
                {
                    queryStr.Add("endDate", filter.EndDate);
                }
            }

            Request request = new Request(
                method: RequestType.Get,
                uri: PrepareUri(_client.Account() + "/purchases"),
                queryString: queryStr
                );

            dynamic response = _client.ProcessRequest(request);

            return(new Pagerator <Purchases>(_client, typeof(Purchases), response));
        }
 private Request SubmitInternal(Purchases purchases)
 {
     purchases.SetRequiredFields(new List <string> {
         GlobalConstants.MerchantRefNum,
         GlobalConstants.Amount,
     });
     purchases.CheckRequiredFields();
     purchases.SetOptionalFields(new List <string> {
         GlobalConstants.CustomerIp,
         GlobalConstants.DupCheck,
         GlobalConstants.Ach,
         GlobalConstants.Bacs,
         GlobalConstants.Eft,
         GlobalConstants.Sepa,
         GlobalConstants.BillingDetails,
         GlobalConstants.Profile
     });
     return(new Request(
                method: RequestType.Post,
                uri: PrepareUri(_client.Account() + "/purchases"),
                body: purchases
                ));
 }