示例#1
0
        public void Should_get_error_on_invoiceInquiry_check_because_invoice_not_payd()
        {
            GapClient gapClient = new GapClient(Token);
            Invoice   invoice   = new Invoice()
            {
                ChatId      = ChatId,
                Amount      = 20_000,
                Currency    = Currency.USD,
                Description = "no comment"
            };

            PostResult invoiceResult = gapClient.Invoice(invoice).Result;

            InvoiceVerfication invoiceVerfication = new InvoiceVerfication()
            {
                ChatId = ChatId,
                RefId  = invoiceResult.Id
            };

            PostResult <InvoiceVerficationResult> verificationResult = gapClient.InvoiceVerification(invoiceVerfication).Result;


            verificationResult.Id.Should().BeNull();
            verificationResult.ErrorMessage.Should().BeNull();
            verificationResult.StatusCode.Should().Be(200);
            verificationResult.Data.Status.Should().Be(InvoiceStatus.Error);
        }
示例#2
0
        public async Task <PostResult <InvoiceVerficationResult> > PaymentVerification(InvoiceVerfication invoice)
        {
            List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("chat_id", invoice.ChatId),
                new KeyValuePair <string, string>("ref_id", invoice.RefId),
            };

            FormUrlEncodedContent content = new FormUrlEncodedContent(parameters);

            HttpResponseMessage response = await _client.PostAsync(baseUrl + "payment/verify", content);

            PostResult <InvoiceVerficationResult> postResult = await GetResult <InvoiceVerficationResult>(response);

            return(postResult);
        }