| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- using System.Text;
- using System.Threading.Tasks;
- using SinochemCloudClient.Models;
- namespace SinochemCloudClient.Legacy
- {
- public class Payment : MessagingBase
- {
- private PaymentResponse response;
- public Payment(string url) : base(url)
- {
- }
- public override ResponseBase Response
- {
- get
- {
- return response;
- }
- }
- public override void SendRequest(RequestBase request)
- {
- PaymentRequest paymentRequest = request as PaymentRequest;
- if (paymentRequest == null)
- {
- throw new Exception("invalid request type, should be Type PaymentRequest");
- }
- HttpResponseMessage httpResponse = client.PostAsJsonAsync(url, paymentRequest).Result;
- httpResponse.EnsureSuccessStatusCode();
- response = httpResponse.Content.ReadAsAsync<PaymentResponse>().Result;
- }
- }
- }
|