예제 #1
0
        public void PayoutCreateAndGetTest()
        {
            try
            {
                var apiContext = TestingUtil.GetApiContext();
                this.RecordConnectionDetails();

                var payout = PayoutTest.GetPayout();
                var payoutSenderBatchId = "batch_" + System.Guid.NewGuid().ToString().Substring(0, 8);
                payout.sender_batch_header.sender_batch_id = payoutSenderBatchId;
                var createdPayout = payout.Create(apiContext, false);
                this.RecordConnectionDetails();

                Assert.IsNotNull(createdPayout);
                Assert.IsTrue(!string.IsNullOrEmpty(createdPayout.batch_header.payout_batch_id));
                Assert.AreEqual(payoutSenderBatchId, createdPayout.batch_header.sender_batch_header.sender_batch_id);

                var payoutBatchId   = createdPayout.batch_header.payout_batch_id;
                var retrievedPayout = Payout.Get(apiContext, payoutBatchId);
                this.RecordConnectionDetails();

                Assert.IsNotNull(payout);
                Assert.AreEqual(payoutBatchId, retrievedPayout.batch_header.payout_batch_id);
            }
            catch (ConnectionException)
            {
                this.RecordConnectionDetails(false);
                throw;
            }
        }
예제 #2
0
        public void PayoutItemDetailsCancelTest()
        {
            try
            {
                // Create a single synchronous payout with an invalid email address.
                // This will cause the status to be marked as 'UNCLAIMED', allowing
                // us to cancel the payout.
                var payoutBatch = PayoutTest.CreateSingleSynchronousPayoutBatch();

                Assert.IsNotNull(payoutBatch);
                Assert.IsNotNull(payoutBatch.items);
                Assert.IsTrue(payoutBatch.items.Count > 0);

                var payoutItem = payoutBatch.items[0];

                if (payoutItem.transaction_status == PayoutTransactionStatus.UNCLAIMED)
                {
                    var payoutItemDetails = PayoutItem.Cancel(TestingUtil.GetApiContext(), payoutItem.payout_item_id);

                    Assert.IsNotNull(payoutItemDetails);
                    Assert.AreEqual(PayoutTransactionStatus.RETURNED, payoutItemDetails.transaction_status);
                }
            }
            catch (ConnectionException ex)
            {
                TestingUtil.WriteConnectionExceptionDetails(ex);
                throw;
            }
        }
예제 #3
0
        public void PayoutCreateTest()
        {
            var payout = PayoutTest.GetPayout();
            var payoutSenderBatchId = "batch_" + System.Guid.NewGuid().ToString().Substring(0, 8);

            payout.sender_batch_header.sender_batch_id = payoutSenderBatchId;
            var createdPayout = payout.Create(TestingUtil.GetApiContext(), false);

            Assert.IsNotNull(createdPayout);
            Assert.IsTrue(!string.IsNullOrEmpty(createdPayout.batch_header.payout_batch_id));
            Assert.AreEqual(payoutSenderBatchId, createdPayout.batch_header.sender_batch_header.sender_batch_id);
        }