Ejemplo n.º 1
0
        private static void TestGetBillInfo_OnRequest(FakeClient sender, FakeClientRequestEventArgs args)
        {
            var billResponse = sender.ObjectMapper.ReadValue <BillResponse>(args.ResponseData.Body);

            Assert.AreEqual(1, args.Counter, "One request");
            Assert.AreEqual("GET", args.Method, "Equal method");
            Assert.AreEqual(BillPaymentsClient.BillsUrl + billResponse.BillId, args.Url, "Equal url");
            Assert.AreEqual("Bearer " + Config.MerchantSecretKey, args.Headers["Authorization"],
                            "Authorization bearer");
            Assert.AreEqual("application/json", args.Headers["Accept"], "Accept bearer");
            Assert.IsNull(args.EntityOpt, "No body request");
        }
Ejemplo n.º 2
0
        private static void TestRefundBill_OnRequest(FakeClient sender, FakeClientRequestEventArgs args)
        {
            var refundResponse    = sender.ObjectMapper.ReadValue <RefundResponse>(args.ResponseData.Body);
            var refundBillRequest = sender.ObjectMapper.ReadValue <RefundBillRequest>(args.EntityOpt);

            Assert.AreEqual(1, args.Counter, "One request");
            Assert.AreEqual("PUT", args.Method, "Equal method");
            Assert.AreEqual(
                BillPaymentsClient.BillsUrl + Config.BillIdForRefundTest + "/refunds/" + refundResponse.RefundId,
                args.Url, "Equal url");
            Assert.AreEqual("Bearer " + Config.MerchantSecretKey, args.Headers["Authorization"],
                            "Authorization bearer");
            Assert.AreEqual("application/json", args.Headers["Accept"], "Accept bearer");
            Assert.AreEqual("application/json", args.Headers["Content-Type"], "Content type bearer");
            Assert.AreEqual(refundResponse.Amount.ValueDecimal, refundBillRequest.Amount.ValueDecimal,
                            "Same amount value");
            Assert.AreEqual(refundResponse.Amount.CurrencyEnum, refundBillRequest.Amount.CurrencyEnum,
                            "Same amount currency");
        }
Ejemplo n.º 3
0
        private static void TestCreateBill_OnRequest(FakeClient sender, FakeClientRequestEventArgs args)
        {
            var billResponse      = sender.ObjectMapper.ReadValue <BillResponse>(args.ResponseData.Body);
            var createBillRequest = sender.ObjectMapper.ReadValue <CreateBillRequest>(args.EntityOpt);

            Assert.AreEqual(1, args.Counter, "One request");
            Assert.AreEqual("PUT", args.Method, "Equal method");
            Assert.AreEqual(BillPaymentsClient.BillsUrl + billResponse.BillId, args.Url, "Equal url");
            Assert.AreEqual("Bearer " + Config.MerchantSecretKey, args.Headers["Authorization"],
                            "Authorization bearer");
            Assert.AreEqual("application/json", args.Headers["Accept"], "Accept bearer");
            Assert.AreEqual("application/json", args.Headers["Content-Type"], "Content type bearer");
            Assert.AreEqual(billResponse.Amount.ValueDecimal, createBillRequest.Amount.ValueDecimal,
                            "Same amount value");
            Assert.AreEqual(billResponse.Amount.CurrencyEnum, createBillRequest.Amount.CurrencyEnum,
                            "Same amount currency");
            Assert.AreEqual(billResponse.Comment, createBillRequest.Comment, "Same amount currency");
            Assert.AreEqual(billResponse.ExpirationDateTime, createBillRequest.ExpirationDateTime,
                            "Same expiration dateTime");
            Assert.AreEqual(billResponse.Customer.Email, createBillRequest.Customer.Email, "Same email");
            Assert.AreEqual(billResponse.Customer.Account, createBillRequest.Customer.Account, "Same account");
            Assert.AreEqual(billResponse.Customer.Phone, createBillRequest.Customer.Phone, "Same phone");
        }