예제 #1
0
        public async Task <CardLinkUrl> CreateLink(string cardId, string continueUrl, string cancelUrl, string callbackUrl, bool framed)
        {
            var form = new List <KeyValuePair <string, string> >();

            if (continueUrl != null)
            {
                form.Add(new KeyValuePair <string, string>("continueurl", continueUrl));
            }

            if (cancelUrl != null)
            {
                form.Add(new KeyValuePair <string, string>("cancelurl", cancelUrl));
            }

            if (callbackUrl != null)
            {
                form.Add(new KeyValuePair <string, string>("callbackurl", callbackUrl));
            }

            if (framed)
            {
                form.Add(new KeyValuePair <string, string>("framed", "true"));
            }

            var request = await PutForm(Endpoints.CardsLink(cardId), form).ConfigureAwait(false);

            var response = await request.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <CardLinkUrl>(response));
        }
예제 #2
0
 /// <summary>
 /// Deletes a saved card link
 /// </summary>
 /// <param name="cardId"></param>
 /// <returns></returns>
 public Task <bool> DeleteLink(string cardId) => Delete(Endpoints.CardsLink(cardId));
예제 #3
0
        public async Task <CardLinkUrl> CreateLink(string cardId, string continueUrl, string cancelUrl, string callbackUrl, bool framed, int?agreementId, string language, string acquirer, string paymentMethods, int?brandingId, Dictionary <string, string> brandingConfig)
        {
            var form = new List <KeyValuePair <string, string> >();

            if (continueUrl != null)
            {
                form.Add(new KeyValuePair <string, string>("continueurl", continueUrl));
            }

            if (cancelUrl != null)
            {
                form.Add(new KeyValuePair <string, string>("cancelurl", cancelUrl));
            }

            if (callbackUrl != null)
            {
                form.Add(new KeyValuePair <string, string>("callbackurl", callbackUrl));
            }

            if (framed)
            {
                form.Add(new KeyValuePair <string, string>("framed", "true"));
            }

            if (agreementId != null)
            {
                form.Add(new KeyValuePair <string, string>("agreement_id", agreementId.ToString()));
            }

            if (language != null)
            {
                form.Add(new KeyValuePair <string, string>("language", language));
            }

            if (acquirer != null)
            {
                form.Add(new KeyValuePair <string, string>("acquirer", acquirer));
            }

            if (paymentMethods != null)
            {
                form.Add(new KeyValuePair <string, string>("payment_methods", paymentMethods));
            }

            if (brandingId != null)
            {
                form.Add(new KeyValuePair <string, string>("branding_id", brandingId.ToString()));
            }

            if (brandingConfig != null)
            {
                throw new NotImplementedException("This feature is not implemented");
                //form.Add(new KeyValuePair<string, string>("branding_config", ));
            }

            //google_analytics_tracking_id Send events to Google Analytics form    string      false
            //google_analytics_client_id Send events to Google Analytics form    string      false

            var request = await PutForm(Endpoints.CardsLink(cardId), form).ConfigureAwait(false);

            var response = await request.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <CardLinkUrl>(response));
        }