Exemplo n.º 1
0
        public string NewMerchantUrl(string redirectUri, Merchant merchant = null, string state = null)
        {
            var request = new ManageMerchantRequest
            {
                ClientId     = GoCardless.AccountDetails.AppId,
                RedirectUri  = redirectUri,
                ResponseType = "code",
                Scope        = "manage_merchant",
                Merchant     = merchant,
                State        = state
            };

            return(GoCardless.BaseUrl + "/oauth/authorize?" + request.ToQueryString());
        }
        public string NewMerchantUrl(string redirectUri, Merchant merchant = null, string state = null)
        {
            var request = new ManageMerchantRequest
                           {
                               ClientId = GoCardless.AccountDetails.AppId,
                               RedirectUri = redirectUri,
                               ResponseType = "code",
                               Scope = "manage_merchant",
                               Merchant = merchant,
                               State = state
                           };

            return GoCardless.BaseUrl + "/oauth/authorize?" + request.ToQueryString();
        }
Exemplo n.º 3
0
        public void ToHashtableTests()
        {
            var subscription = new SubscriptionRequest("merchant123", 2m, 1, "month")
                                   {
                                       User = new UserRequest
                                                  {
                                                      FirstName = "Tim",
                                                      Email = "*****@*****.**"
                                                  }
                                   };
            var subscriptionHash = subscription.ToHashParams();
            Assert.AreEqual(2m, subscriptionHash["amount"].Single());
            Assert.AreEqual("merchant123", subscriptionHash["merchant_id"].Single());
            Assert.AreEqual("Tim", subscriptionHash["user[first_name]"].Single());
            Assert.AreEqual("*****@*****.**", subscriptionHash["user[email]"].Single());

            var manageMerchant = new ManageMerchantRequest
                                   {
                                       Merchant = new Merchant
                                                      {
                                                          Name = "Mike the Merchant",
                                                          BillingAddress1 = "Flat 1",
                                                          BillingAddress2 = "200 High St",
                                                          BillingTown = "Townville",
                                                          BillingCounty = "Countyshire",
                                                          BillingPostcode = "N1 1AB",
                                                          User = new User
                                                                     {
                                                                         FirstName = "Mike",
                                                                         LastName = "Merchant",
                                                                         Email = "*****@*****.**",
                                                                     }
                                                      }
                                   };
            var manageMerchantHash = manageMerchant.ToHashParams();
            Assert.AreEqual("Mike the Merchant", manageMerchantHash["merchant[name]"].Single());
            Assert.AreEqual("Flat 1", manageMerchantHash["merchant[billing_address1]"].Single());
            Assert.AreEqual("200 High St", manageMerchantHash["merchant[billing_address2]"].Single());
            Assert.AreEqual("Townville", manageMerchantHash["merchant[billing_town]"].Single());
            Assert.AreEqual("Countyshire", manageMerchantHash["merchant[billing_county]"].Single());
            Assert.AreEqual("N1 1AB", manageMerchantHash["merchant[billing_postcode]"].Single());
            Assert.AreEqual("Mike", manageMerchantHash["merchant[user][first_name]"].Single());
            Assert.AreEqual("Merchant", manageMerchantHash["merchant[user][last_name]"].Single());
            Assert.AreEqual("*****@*****.**", manageMerchantHash["merchant[user][email]"].Single());
        }