コード例 #1
0
        public void TestGet()
        {
            var res = Refund.Get(1);

            Trace.Write(res.ToJson());
            Assert.AreEqual(1, res.Id);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpContext CurrContext = HttpContext.Current;

            try
            {
                // ### Api Context
                // Pass in a `APIContext` object to authenticate
                // the call and to send a unique request id
                // (that ensures idempotency). The SDK generates
                // a request id if you do not pass one explicitly.
                // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext..
                APIContext apiContext = Configuration.GetAPIContext();

                // ### Refund
                // Pass an APIContext and the ID of the refunded
                // transaction
                Refund refund = Refund.Get(apiContext, "7B165985YD577493B");
                CurrContext.Items.Add("ResponseJson", JObject.Parse(refund.ConvertToJson()).ToString(Formatting.Indented));
            }
            catch (PayPal.Exception.PayPalException ex)
            {
                CurrContext.Items.Add("Error", ex.Message);
            }
            Server.Transfer("~/Response.aspx");
        }
コード例 #3
0
 public void RefundIdTest()
 {
     try
     {
         var pay             = PaymentTest.CreatePaymentAuthorization();
         var authorizationId = pay.transactions[0].related_resources[0].authorization.id;
         var authorization   = Authorization.Get(TestingUtil.GetApiContext(), authorizationId);
         var cap             = new Capture();
         var amt             = new Amount();
         amt.total    = "1";
         amt.currency = "USD";
         cap.amount   = amt;
         var response     = authorization.Capture(TestingUtil.GetApiContext(), cap);
         var fund         = new Refund();
         var refundAmount = new Amount();
         refundAmount.total    = "1";
         refundAmount.currency = "USD";
         fund.amount           = refundAmount;
         var responseRefund  = response.Refund(TestingUtil.GetApiContext(), fund);
         var retrievedRefund = Refund.Get(TestingUtil.GetApiContext(), responseRefund.id);
         Assert.AreEqual(responseRefund.id, retrievedRefund.id);
     }
     catch (ConnectionException ex)
     {
         TestingUtil.WriteConnectionExceptionDetails(ex);
         throw;
     }
 }
コード例 #4
0
        protected override void RunSample()
        {
            // ### Api Context
            // Pass in a `APIContext` object to authenticate
            // the call and to send a unique request id
            // (that ensures idempotency). The SDK generates
            // a request id if you do not pass one explicitly.
            // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext.
            var apiContext = Configuration.GetAPIContext();

            // ### Refund
            // Pass an APIContext and the ID of the refunded
            // transaction
            var refundId = "7B165985YD577493B";

            #region Track Workflow
            //--------------------
            this.flow.AddNewRequest("Get refund details", description: "ID: " + refundId);
            //--------------------
            #endregion

            var refund = Refund.Get(apiContext, refundId);

            #region Track Workflow
            //--------------------
            this.flow.RecordResponse(refund);
            //--------------------
            #endregion
        }
コード例 #5
0
        public void RefundIdTest()
        {
            try
            {
                var apiContext = TestingUtil.GetApiContext();
                this.RecordConnectionDetails();

                var pay = PaymentTest.CreatePaymentAuthorization(apiContext);
                this.RecordConnectionDetails();

                Assert.IsNotNull(pay);
                Assert.IsNotNull(pay.transactions);
                Assert.IsTrue(pay.transactions.Count > 0);
                var transaction = pay.transactions[0];

                Assert.IsNotNull(transaction.related_resources);
                Assert.IsTrue(transaction.related_resources.Count > 0);

                var resource = transaction.related_resources[0];
                Assert.IsNotNull(resource.authorization);

                var authorization = Authorization.Get(apiContext, resource.authorization.id);
                this.RecordConnectionDetails();

                var cap = new Capture
                {
                    amount = new Amount
                    {
                        total    = "1",
                        currency = "USD"
                    }
                };
                var response = authorization.Capture(apiContext, cap);
                this.RecordConnectionDetails();

                var fund = new Refund
                {
                    amount = new Amount
                    {
                        total    = "1",
                        currency = "USD"
                    }
                };

                apiContext.ResetRequestId();
                var responseRefund = response.Refund(apiContext, fund);
                this.RecordConnectionDetails();

                var retrievedRefund = Refund.Get(apiContext, responseRefund.id);
                this.RecordConnectionDetails();

                Assert.AreEqual(responseRefund.id, retrievedRefund.id);
            }
            catch (ConnectionException)
            {
                this.RecordConnectionDetails(false);
                throw;
            }
        }
コード例 #6
0
 public void GetRefundNullIdTest()
 {
     try
     {
         Refund retrievedRefund = Refund.Get(AccessToken, null);
     }
     catch (System.ArgumentNullException exe)
     {
         Assert.IsNotNull(exe);
     }
 }
コード例 #7
0
        public void RefundIdTest()
        {
            Payment       pay             = GetPayment();
            string        authorizationId = pay.transactions[0].related_resources[0].authorization.id;
            Authorization authorization   = Authorization.Get(UnitTestUtil.GetApiContext(), authorizationId);
            Capture       cap             = new Capture();
            Amount        amt             = new Amount();

            amt.total    = "1";
            amt.currency = "USD";
            cap.amount   = amt;
            Capture response     = authorization.Capture(UnitTestUtil.GetApiContext(), cap);
            Refund  fund         = new Refund();
            Amount  refundAmount = new Amount();

            refundAmount.total    = "1";
            refundAmount.currency = "USD";
            fund.amount           = refundAmount;
            Refund responseRefund  = response.Refund(UnitTestUtil.GetApiContext(), fund);
            Refund retrievedRefund = Refund.Get(UnitTestUtil.GetApiContext(), responseRefund.id);

            Assert.AreEqual(responseRefund.id, retrievedRefund.id);
        }
コード例 #8
0
        public void GetRefundTest()
        {
            Payment       payment         = GetPaymentObject(AccessToken);
            string        authorizationId = payment.transactions[0].related_resources[0].authorization.id;
            Authorization authorization   = Authorization.Get(AccessToken, authorizationId);
            Capture       capture         = new Capture();
            Amount        amount          = new Amount();

            amount.total    = "1";
            amount.currency = "USD";
            capture.amount  = amount;
            Capture response = authorization.Capture(AccessToken, capture);
            Refund  refund   = new Refund();
            Amount  rAmount  = new Amount();

            rAmount.total    = "1";
            rAmount.currency = "USD";
            refund.amount    = rAmount;
            Refund responseRefund  = response.Refund(AccessToken, refund);
            Refund retrievedRefund = Refund.Get(AccessToken, responseRefund.id);

            Assert.AreEqual(responseRefund.id, retrievedRefund.id);
        }
コード例 #9
0
        public void RefundIdTest()
        {
            var pay             = PaymentTest.CreatePaymentAuthorization();
            var authorizationId = pay.transactions[0].related_resources[0].authorization.id;
            var authorization   = Authorization.Get(UnitTestUtil.GetApiContext(), authorizationId);
            var cap             = new Capture();
            var amt             = new Amount();

            amt.total    = "1";
            amt.currency = "USD";
            cap.amount   = amt;
            var response     = authorization.Capture(UnitTestUtil.GetApiContext(), cap);
            var fund         = new Refund();
            var refundAmount = new Amount();

            refundAmount.total    = "1";
            refundAmount.currency = "USD";
            fund.amount           = refundAmount;
            var responseRefund  = response.Refund(UnitTestUtil.GetApiContext(), fund);
            var retrievedRefund = Refund.Get(UnitTestUtil.GetApiContext(), responseRefund.id);

            Assert.AreEqual(responseRefund.id, retrievedRefund.id);
        }
コード例 #10
0
        public void execute()
        {
            Refund refund = Refund.Get(apiContext, transactionPaypalID);

            ZDatabaseManager.editTransactionState(transactionDBID, "Reversed");
        }
コード例 #11
0
 public void RefundNullIdTest()
 {
     TestingUtil.AssertThrownException <System.ArgumentNullException>(() => Refund.Get(new APIContext("token"), null));
 }
コード例 #12
0
 public void NullRefundIdTest()
 {
     UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => Refund.Get(UnitTestUtil.GetApiContext(), null));
 }
コード例 #13
0
ファイル: RefundTest.cs プロジェクト: iljafiers/FotoLab
 public void NullRefundIdTest()
 {
     Refund fund = Refund.Get(AccessToken, null);
 }