Пример #1
0
 public async Task CancelSubscription(string subscriptionCode)
 {
     await _httpHelper.CallApi <string>(new ApiRequest()
     {
         Method   = HttpMethod.Put,
         Resource = $"{ApiConstants.PreApprovals}/{subscriptionCode}/{ApiConstants.Cancel}",
         Accept   = PagseguroAccept.JsonV3
     });
 }
 public async Task Update(UpdatePaymentMethodRequest updatePaymentMethodRequest)
 {
     var resource = $"{ApiConstants.PreApprovals}/{updatePaymentMethodRequest.SubscriptionCode}/{ApiConstants.PaymentMethod}";
     await _httpHelper.CallApi <string>(new ApiRequest()
     {
         Method   = HttpMethod.Put,
         Resource = resource,
         Body     = updatePaymentMethodRequest.PaymentMethod.ToBodyPayload(updatePaymentMethodRequest.SenderHash),
         Accept   = PagseguroAccept.JsonV3
     });
 }
Пример #3
0
        public async Task <string> NewSession()
        {
            var xmlResponse = await _httpHelper.CallApi(new ApiRequest()
            {
                Method      = HttpMethod.Post,
                Resource    = ApiConstants.Sessions,
                JsonContent = false,
            });

            var xmldoc = new XmlDocument();

            xmldoc.LoadXml(xmlResponse);
            var sessionElement = xmldoc.GetElementsByTagName("session");

            return(sessionElement[0].InnerText);
        }