public static Uri GetUrlWithQueryString(this Uri uri, PaymentExpand paymentExpand)
        {
            var paymentExpandQueryString = GetExpandQueryString <PaymentExpand>(paymentExpand);
            var url = !string.IsNullOrWhiteSpace(paymentExpandQueryString)
                ? new Uri(uri.OriginalString + paymentExpandQueryString, UriKind.RelativeOrAbsolute)
                : uri;

            return(url);
        }
Exemplo n.º 2
0
        public async Task <IVippsPaymentReponse> Create(VippsPaymentRequest paymentRequest,
                                                        PaymentExpand paymentExpand = PaymentExpand.None)
        {
            var url = new Uri("/psp/vipps/payments", UriKind.Relative).GetUrlWithQueryString(paymentExpand);

            var requestDto = new VippsPaymentRequestDto(paymentRequest);

            var paymentResponse = await HttpClient.PostAsJsonAsync <VippsPaymentResponseDto>(url, requestDto);

            return(new VippsPaymentResponse(paymentResponse, HttpClient));
        }
Exemplo n.º 3
0
        public async Task <IMobilePayPaymentResponse> Create(MobilePayPaymentRequest paymentRequest,
                                                             PaymentExpand paymentExpand = PaymentExpand.None)
        {
            var url = new Uri("/psp/mobilepay/payments", UriKind.Relative).GetUrlWithQueryString(paymentExpand);

            var requestDto = new MobilePayPaymentRequestDto(paymentRequest);

            var mobilepaymentResponseDto = await HttpClient.PostAsJsonAsync <MobilePayPaymentResponseDto>(url, requestDto);

            return(new MobilePayPaymentResponse(mobilepaymentResponseDto, HttpClient));
        }
Exemplo n.º 4
0
        public async Task <IVippsPaymentReponse> Get(Uri id, PaymentExpand paymentExpand = PaymentExpand.None)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            Uri url = id.GetUrlWithQueryString(paymentExpand);

            var paymentResponseContainer = await HttpClient.GetAsJsonAsync <VippsPaymentResponseDto>(url);

            return(new VippsPaymentResponse(paymentResponseContainer, HttpClient));
        }
Exemplo n.º 5
0
        public async Task <IMobilePayPaymentResponse> Get(Uri id, PaymentExpand paymentExpand = PaymentExpand.None)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            Uri url = id.GetUrlWithQueryString(paymentExpand);

            var mobilepaymentResponseDto = await HttpClient.GetAsJsonAsync <MobilePayPaymentResponseDto>(url);

            return(new MobilePayPaymentResponse(mobilepaymentResponseDto, HttpClient));
        }
Exemplo n.º 6
0
        public async Task <IInvoicePaymentResponse> Get(Uri id, PaymentExpand paymentExpand = PaymentExpand.None)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            var url = id.GetUrlWithQueryString(paymentExpand);

            var paymentResponse = await HttpClient.GetAsJsonAsync <InvoicePaymentResponseDto>(url);

            return(new InvoicePaymentResponse(paymentResponse, HttpClient));
        }
        public async Task <ITrustlyPaymentResponse> Create(TrustlyPaymentRequest paymentRequest, PaymentExpand paymentExpand)
        {
            var url = new Uri("/psp/trustly/payments", UriKind.Relative).GetUrlWithQueryString(paymentExpand);

            var requestDto = new TrustlyPaymentRequestDto(paymentRequest);

            var paymentResponse = await HttpClient.PostAsJsonAsync <TrustlyPaymentResponseDto>(url, requestDto);

            return(new TrustlyPaymentResponse(paymentResponse, HttpClient));
        }
Exemplo n.º 8
0
        public async Task <ICardPaymentVerifyResponse> Create(CardPaymentVerifyRequest paymentRequest, PaymentExpand paymentExpand = PaymentExpand.All)
        {
            var url = new Uri("/psp/creditcard/payments", UriKind.Relative).GetUrlWithQueryString(paymentExpand);

            var requestDto = new CardPaymentVerifyRequestDto(paymentRequest);

            var cardPaymentResponseDto = await HttpClient.PostAsJsonAsync <CardPaymentVerifyResponseDto>(url.GetUrlWithQueryString(paymentExpand), requestDto);

            return(new CardPaymentVerifyResponse(cardPaymentResponseDto));
        }