Skip to content

Commit

Permalink
Merge branch 'master' of github.com:paymill/paymill-net
Browse files Browse the repository at this point in the history
  • Loading branch information
l0ck3 committed Jun 4, 2015
2 parents 5738d7c + d81b26e commit 11c2685
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 42 deletions.
4 changes: 2 additions & 2 deletions PaymillWrapper/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// Puede especificar todos los valores o establecer como predeterminados los números de compilación y de revisión
// mediante el carácter '*', como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.1.2")]
[assembly: AssemblyFileVersion("0.3.1.2")]
[assembly: AssemblyVersion("0.3.2.0")]
[assembly: AssemblyFileVersion("0.3.2.0")]
1 change: 1 addition & 0 deletions PaymillWrapper/Service/AbstractService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ private static Task<String> readReponseMessage(HttpResponseMessage response)
{
throw new PaymillException(exc.Message);
}
// For .Net 4.0 use the code bellow
/* return Task.Run(() =>
{
return String.Empty;
Expand Down
10 changes: 5 additions & 5 deletions PaymillWrapper/Service/SubscriptionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public SubscriptionService(HttpClient client, string apiUrl)
/// <param name="the subscription"></param>
// <returns>the subscription.</returns>

public async Task<Subscription> CreateAsync(PaymillWrapper.Models.Subscription.Creator creator, String mandateReference = null)
public async Task<Subscription> CreateAsync(PaymillWrapper.Models.Subscription.Creator creator)
{
return await CreateAsync(creator.Payment, creator.Client, creator.Offer, creator.Amount, creator.Currency, creator.Interval,
creator.StartAt, creator.Name, creator.PeriodOfValidity, mandateReference);
creator.StartAt, creator.Name, creator.PeriodOfValidity, null);
}
/// <summary>
/// This function creates a <see cref="Subscription" /> between a <see cref="Client" /> and an <see cref="Offer" />. A <see cref="Client" /> can have several
Expand Down Expand Up @@ -90,7 +90,7 @@ public async Task<Subscription> CreateAsync(PaymillWrapper.Models.Subscription.C
/// <returns>the subscription.</returns>
///
public async Task<Subscription> CreateAsync(Payment payment, Client client, Offer offer, int? amount, String currency, Interval.PeriodWithChargeDay interval, DateTime? startAt,
String name, Interval.Period periodOfValidity, String mandateReference = null)
String name, Interval.Period periodOfValidity, String mandateReference)
{

if (offer == null && (amount == null || currency == null || interval == null))
Expand Down Expand Up @@ -170,9 +170,9 @@ public async Task<Subscription> CreateAsync(Payment payment, Client client, Offe
/// <returns>the subscription</returns>
///
public async Task<Subscription> CreateAsync(String paymentId, String clientId, String offerId, int? amount, String currency, Interval.PeriodWithChargeDay interval,
DateTime? startAt, String name, Interval.Period periodOfValidity, String mandateReference = null)
DateTime? startAt, String name, Interval.Period periodOfValidity)
{
return await CreateAsync(new Payment(paymentId), new Client(clientId), new Offer(offerId), amount, currency, interval, startAt, name, periodOfValidity, mandateReference);
return await CreateAsync(new Payment(paymentId), new Client(clientId), new Offer(offerId), amount, currency, interval, startAt, name, periodOfValidity, null);
}

/// <summary>
Expand Down
56 changes: 28 additions & 28 deletions PaymillWrapper/Service/TransactionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public TransactionService(HttpClient client, string apiUrl)
/// <param name="amount"> Amount (in cents) which will be charged.</param>
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithTokenAsync(String token, int amount, String currency, String mandateReference = null)
public async Task<Transaction> CreateWithTokenAsync(String token, int amount, String currency)
{
return await CreateWithTokenAndFeeAsync(token, amount, currency, null, null, mandateReference);
return await CreateWithTokenAndFeeAsync(token, amount, currency, null, null, null);
}

/// <summary>
Expand All @@ -35,9 +35,9 @@ public async Task<Transaction> CreateWithTokenAsync(String token, int amount, St
/// <param name="currency"> ISO 4217 formatted currency code.</param>
/// <param name="description">A short description for the transaction.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithTokenAsync(String token, int amount, String currency, String description, String mandateReference = null)
public async Task<Transaction> CreateWithTokenAsync(String token, int amount, String currency, String description)
{
return await CreateWithTokenAndFeeAsync(token, amount, currency, description, null, mandateReference);
return await CreateWithTokenAndFeeAsync(token, amount, currency, description, null, null);
}

/// <summary>
Expand All @@ -48,9 +48,9 @@ public async Task<Transaction> CreateWithTokenAsync(String token, int amount, St
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <param name="fee">A Fee</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithTokenAndFeeAsync(String token, int amount, String currency, Fee fee, String mandateReference = null)
public async Task<Transaction> CreateWithTokenAndFeeAsync(String token, int amount, String currency, Fee fee)
{
return await CreateWithTokenAndFeeAsync(token, amount, currency, null, fee, mandateReference);
return await CreateWithTokenAndFeeAsync(token, amount, currency, null, fee, null);
}

/// <summary>
Expand All @@ -63,7 +63,7 @@ public async Task<Transaction> CreateWithTokenAndFeeAsync(String token, int amou
/// <param name="fee">A Fee</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithTokenAndFeeAsync(String token, int amount,
String currency, String description, Fee fee, String mandateReference = null)
String currency, String description, Fee fee, String mandateReference)
{
ValidationUtils.ValidatesToken(token);
ValidationUtils.ValidatesAmount(amount);
Expand Down Expand Up @@ -92,9 +92,9 @@ public async Task<Transaction> CreateWithTokenAndFeeAsync(String token, int amou
/// <param name="amount">Amount (in cents) which will be charged.</param>
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPaymentAsync(Payment payment, int amount, String currency, String mandateReference = null)
public async Task<Transaction> CreateWithPaymentAsync(Payment payment, int amount, String currency)
{
return await CreateWithPaymentAsync(payment, amount, currency, null, mandateReference);
return await CreateWithPaymentAsync(payment, amount, currency, null, null);
}

/// <summary>
Expand All @@ -104,9 +104,9 @@ public async Task<Transaction> CreateWithPaymentAsync(Payment payment, int amoun
/// <param name="amount">Amount (in cents) which will be charged.</param>
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPaymentAsync(String paymentId, int amount, String currency, String mandateReference = null)
public async Task<Transaction> CreateWithPaymentAsync(String paymentId, int amount, String currency)
{
return await CreateWithPaymentAsync(new Payment(paymentId), amount, currency, null, mandateReference);
return await CreateWithPaymentAsync(new Payment(paymentId), amount, currency, null, null);
}

/// <summary>
Expand All @@ -117,7 +117,7 @@ public async Task<Transaction> CreateWithPaymentAsync(String paymentId, int amou
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <param name="description">The description.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPaymentAsync(Payment payment, int amount, String currency, String description, String mandateReference = null)
public async Task<Transaction> CreateWithPaymentAsync(Payment payment, int amount, String currency, String description, String mandateReference)
{
ValidationUtils.ValidatesPayment(payment);
ValidationUtils.ValidatesAmount(amount);
Expand All @@ -142,9 +142,9 @@ public async Task<Transaction> CreateWithPaymentAsync(Payment payment, int amoun
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <param name="description">The description.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPaymentAsync(String paymentId, int amount, String currency, String description, String mandateReference = null)
public async Task<Transaction> CreateWithPaymentAsync(String paymentId, int amount, String currency, String description)
{
return await CreateWithPaymentAsync(new Payment(paymentId), amount, currency, description, mandateReference);
return await CreateWithPaymentAsync(new Payment(paymentId), amount, currency, description, null);
}

/// <summary>
Expand All @@ -155,9 +155,9 @@ public async Task<Transaction> CreateWithPaymentAsync(String paymentId, int amou
/// <param name="amount">Amount (in cents) which will be charged.</param>
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPaymentAndClientAsync(Payment payment, Client client, int amount, String currency, String mandateReference = null)
public async Task<Transaction> CreateWithPaymentAndClientAsync(Payment payment, Client client, int amount, String currency)
{
return await CreateWithPaymentAndClientAsync(payment, client, amount, currency, null, mandateReference);
return await CreateWithPaymentAndClientAsync(payment, client, amount, currency, null, null);
}

/// <summary>
Expand All @@ -168,9 +168,9 @@ public async Task<Transaction> CreateWithPaymentAndClientAsync(Payment payment,
/// <param name="amount">Amount (in cents) which will be charged.</param>
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPaymentAndClientAsync(String paymentId, String clientId, int amount, String currency, String mandateReference = null)
public async Task<Transaction> CreateWithPaymentAndClientAsync(String paymentId, String clientId, int amount, String currency)
{
return await CreateWithPaymentAndClientAsync(paymentId, clientId, amount, currency, null, mandateReference);
return await CreateWithPaymentAndClientAsync(paymentId, clientId, amount, currency, null);
}

/// <summary>
Expand All @@ -182,7 +182,7 @@ public async Task<Transaction> CreateWithPaymentAndClientAsync(String paymentId,
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <param name="description">The description.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPaymentAndClientAsync(Payment payment, Client client, int amount, String currency, String description, String mandateReference = null)
public async Task<Transaction> CreateWithPaymentAndClientAsync(Payment payment, Client client, int amount, String currency, String description, String mandateReference)
{
ValidationUtils.ValidatesPayment(payment);
ValidationUtils.ValidatesClient(client);
Expand Down Expand Up @@ -212,9 +212,9 @@ public async Task<Transaction> CreateWithPaymentAndClientAsync(Payment payment,
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <param name="description">The description.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPaymentAndClientAsync(String paymentId, String clientId, int amount, String currency, String description, String mandateReference = null)
public async Task<Transaction> CreateWithPaymentAndClientAsync(String paymentId, String clientId, int amount, String currency, String description)
{
return await CreateWithPaymentAndClientAsync(new Payment(paymentId), new Client(clientId), amount, currency, mandateReference);
return await CreateWithPaymentAndClientAsync(new Payment(paymentId), new Client(clientId), amount, currency);
}

/// <summary>
Expand All @@ -224,9 +224,9 @@ public async Task<Transaction> CreateWithPaymentAndClientAsync(String paymentId,
/// <param name="amount">Amount (in cents) which will be charged.</param>
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPreauthorizationAsync(Preauthorization preauthorization, int amount, String currency, String mandateReference = null)
public async Task<Transaction> CreateWithPreauthorizationAsync(Preauthorization preauthorization, int amount, String currency)
{
return await CreateWithPreauthorizationAsync(preauthorization.Id, amount, currency, null, mandateReference);
return await CreateWithPreauthorizationAsync(preauthorization.Id, amount, currency, null, null);
}

/// <summary>
Expand All @@ -236,9 +236,9 @@ public async Task<Transaction> CreateWithPreauthorizationAsync(Preauthorization
/// <param name="amount">Amount (in cents) which will be charged.</param>
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPreauthorizationAsync(String preauthorizationId, int amount, String currency, String mandateReference = null)
public async Task<Transaction> CreateWithPreauthorizationAsync(String preauthorizationId, int amount, String currency)
{
return await CreateWithPreauthorizationAsync(preauthorizationId, amount, currency, null, mandateReference);
return await CreateWithPreauthorizationAsync(preauthorizationId, amount, currency, null, null);
}

/// <summary>
Expand All @@ -249,9 +249,9 @@ public async Task<Transaction> CreateWithPreauthorizationAsync(String preauthori
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <param name="description">The description.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPreauthorizationAsync(Preauthorization preauthorization, int amount, String currency, String description, String mandateReference = null)
public async Task<Transaction> CreateWithPreauthorizationAsync(Preauthorization preauthorization, int amount, String currency, String description)
{
return await CreateWithPreauthorizationAsync(preauthorization.Id, amount, currency, description, mandateReference);
return await CreateWithPreauthorizationAsync(preauthorization.Id, amount, currency, description, null);
}

/// <summary>
Expand All @@ -262,7 +262,7 @@ public async Task<Transaction> CreateWithPreauthorizationAsync(Preauthorization
/// <param name="currency">ISO 4217 formatted currency code.</param>
/// <param name="description">The description.</param>
/// <returns>Transaction object indicating whether a the call was successful or not.</returns>
public async Task<Transaction> CreateWithPreauthorizationAsync(String preauthorizationId, int amount, String currency, String description, String mandateReference = null)
public async Task<Transaction> CreateWithPreauthorizationAsync(String preauthorizationId, int amount, String currency, String description, String mandateReference)
{
ValidationUtils.ValidatesId(preauthorizationId);
ValidationUtils.ValidatesAmount(amount);
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ Because all methods of Wrapper for the PAYMILL API is asynchronous. To catch rea

## Changelog

### 3.2.0
+ Added Mandate Reference to Transaction and Subscription
+ Made the Payment Property Updatable in Subscription

### 3.1.2
+ Implemented StringToBaseModelConverter to support custom serialization.

Expand Down
4 changes: 2 additions & 2 deletions UnitTest/Net/TestSubscriptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void TestCreateWithPaymentAndOfferAndMandateReference()
{
Payment payment = _paymill.PaymentService.CreateWithTokenAsync(testToken).Result;
Offer offer = _paymill.OfferService.CreateAsync(2223, "EUR", Interval.period(1, Interval.TypeUnit.WEEK), "Offer No Trial").Result;
Subscription subscription = _paymill.SubscriptionService.CreateAsync(Subscription.Create(payment, offer), "DE1234TEST").Result;
Subscription subscription = _paymill.SubscriptionService.CreateAsync(Subscription.Create(payment, offer)).Result;
Assert.IsNotNull(subscription);
Assert.IsNotNull(subscription.Client);
Assert.AreEqual(subscription.Payment.Id, payment.Id);
Expand Down Expand Up @@ -102,7 +102,7 @@ public void TestCreateWithoutOfferAndAmount_ShouldFail()
{
Client client = _paymill.ClientService.CreateWithEmailAsync("[email protected]").Result;
Payment payment = _paymill.PaymentService.CreateWithTokenAndClientAsync(testToken, client).Result;
_paymill.SubscriptionService.CreateAsync(payment, client, null, null, null, null, null, null, null).Wait();
_paymill.SubscriptionService.CreateAsync(payment, client, null, null, null, null, null, null, null, "DE1234TEST").Wait();
}
[TestMethod]
public void TestCreateWithPaymentAndClient_WithOfferWithoutTrial_shouldReturnSubscriptionWithNullTrialStartAndNullTrialEnd()
Expand Down
Loading

0 comments on commit 11c2685

Please sign in to comment.