public void AdjustSubscriptionBalance()
 {
     var charge = new ChargeRequest
     {
         Amount = 0.50m,
         Memo = "test charge"
     };
     _gateway.Subscription.AdjustSubscriptionBalance(_testData.SubscriptionId.ToString(), "false", charge);
 }
        public void Refund()
        {
            var charge = new ChargeRequest
            {
                Amount = 100.50m,
                Memo = "test charge"
            };
            _gateway.Subscription.AddChargeToSubscription(_testData.SubscriptionId.ToString(), charge);

            var transactions = _gateway.Transaction.GetTransactionsForSubscription(_testData.SubscriptionId.ToString());
            Assert.IsNotNull(transactions);
            Assert.Greater(transactions.Count, 0);

            charge = new ChargeRequest
            {
                Amount = 50.25m,
                Memo = "test charge"
            };

            TransactionResponse tr = _gateway.Subscription.Refund(_testData.SubscriptionId.ToString(), charge, transactions[0].Id.ToString());
            Assert.IsNotNull(tr);
            Assert.AreEqual(charge.Amount, tr.Amount);
        }
        public void AddChargeToSubscription()
        {
            var charge = new ChargeRequest
            {
                Amount = 100.53m,
                Memo = "test charge"
            };

            TransactionResponse tr = _gateway.Subscription.AddChargeToSubscription(_testData.SubscriptionId.ToString(), charge);
            Assert.IsNotNull(tr);
            Assert.AreEqual(charge.Amount, tr.Amount);
        }
 /// <summary>
 /// Adding an adjustment to a subscription will either increase or decrease the balance of the subscription.
 /// The customer's credit card will not be affected.
 /// </summary>
 /// <param name="subscriptionId">The subscription id.</param>
 /// <param name="isAmountAbsolute">if true then the subscription balance will be set to the amount passed as parameter
 /// if false then the subscription balance will be increased or decreased with the given amount(positive or negative)</param>
 /// <param name="charge">The charge.</param>
 public void AdjustSubscriptionBalance(string subscriptionId, string isAmountAbsolute, ChargeRequest charge)
 {
     _service.Put<ChargeRequest>(string.Format("{0}/adjustbalance/{1}/{2}", _gatewayURL, subscriptionId, isAmountAbsolute), charge);
 }
 /// <summary>
 /// Refunds a transaction
 /// </summary>
 public TransactionResponse Refund(string subscriptionId, ChargeRequest charge, string transactionId)
 {
     return _service.Put<ChargeRequest, TransactionResponse>(string.Format("{0}/refund/{1}/{2}", _gatewayURL, subscriptionId, transactionId), charge);
 }
 /// <summary>
 /// Adding a charge to a subscription causes the customer's credit card to be charged immediately
 /// for the amount you enter.
 /// If the charging of the credit card fails, we'll let you know and the customer's balance will not be affected.
 /// (But, you will be able to see a failed payment in the history).
 /// Note: This will not use any existing balance credits.
 /// </summary>
 public TransactionResponse AddChargeToSubscription(string subscriptionId, ChargeRequest charge)
 {
     return _service.Put<ChargeRequest, TransactionResponse>(string.Format("{0}/charge/{1}", _gatewayURL, subscriptionId), charge);
 }