Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored paymill wrapper, to be compatible with dnx451 and dnxcore50. #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PaymillWrapper.Exceptions
{
Expand All @@ -10,8 +7,8 @@ public class PaymillException : Exception
public PaymillException(string message)
: base(message)
{

}
}
}

}
4 changes: 0 additions & 4 deletions PaymillWrapper/Exceptions/PaymillRequestException.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace PaymillWrapper.Exceptions
{
Expand Down
102 changes: 49 additions & 53 deletions PaymillWrapper/Models/Address.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PaymillWrapper.Utils;
using System;

namespace PaymillWrapper.Models
{
Expand All @@ -16,52 +12,52 @@ namespace PaymillWrapper.Models
///

[JsonConverter(typeof(StringToBaseModelConverter<Address>))]
public class Address {

/// <summary>
/// Name of recipient, max. 128 characters
/// </summary>
///
public String Name;

/// <summary>
/// Street address (incl. street number), max. 100 characters
/// </summary>
///
[DataMember(Name = "street_address")]
public String StreetAddress;

/**
* Addition to street address (e.g. building, floor, or c/o), max. 100 characters
*/
[DataMember(Name = "street_address_addition")]
public String StreetAddressAddition;

/**
* City, max. 40 characters
*/
public String City;

/**
* State or province, max. 40 characters
*/
public String State;

/**
* Country-specific postal code, max. 20 characters
*/
[DataMember(Name = "postal_code")]
public String PostalCode;

/**
* 2-letter country code according to ISO 3166-1 alpha-2
*/
public String Country;
/**
* Contact phone number, max. 20 characters
*/
public String Phone;
public class Address
{

/// <summary>
/// Name of recipient, max. 128 characters
/// </summary>
///
public String Name;

/// <summary>
/// Street address (incl. street number), max. 100 characters
/// </summary>
///
[JsonProperty("street_address")]
public String StreetAddress;

/**
* Addition to street address (e.g. building, floor, or c/o), max. 100 characters
*/
[JsonProperty("street_address_addition")]
public String StreetAddressAddition;

/**
* City, max. 40 characters
*/
public String City;

/**
* State or province, max. 40 characters
*/
public String State;

/**
* Country-specific postal code, max. 20 characters
*/
[JsonProperty("postal_code")]
public String PostalCode;

/**
* 2-letter country code according to ISO 3166-1 alpha-2
*/
public String Country;
/**
* Contact phone number, max. 20 characters
*/
public String Phone;

}

}
}
15 changes: 5 additions & 10 deletions PaymillWrapper/Models/BaseModel.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using PaymillWrapper.Utils;
using System;

namespace PaymillWrapper.Models
{
[DataContract]
public class BaseModel
{

/// <summary>
/// Unique identifier
/// </summary>
[DataMember(Name = "id")]
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// Creation date
/// </summary>
[DataMember(Name = "created_at")]
[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }

/// <summary>
/// Last update
/// </summary>
[DataMember(Name = "updated_at")]
[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }

public class BaseFilter
Expand Down
21 changes: 9 additions & 12 deletions PaymillWrapper/Models/Checksum.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using Newtonsoft.Json;
using PaymillWrapper.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using PaymillWrapper.Utils;
using System.Threading.Tasks;

namespace PaymillWrapper.Models
{
Expand All @@ -19,13 +18,13 @@ namespace PaymillWrapper.Models
[JsonConverter(typeof(StringToBaseModelConverter<Checksum>))]
public class Checksum : BaseModel
{
[DataMember(Name = "type")]
[JsonProperty("type")]
public String Type;

[DataMember(Name = "checksum")]
[JsonProperty("checksum")]
public String Value;

[DataMember(Name = "data")]
[JsonProperty("data")]
public String Data;
public Checksum()
{
Expand All @@ -35,10 +34,8 @@ public Checksum(String id)
Id = id;
}

[DataMember(Name = "app_id")]
[JsonProperty("app_id")]
public String AppId;

}


}
}
23 changes: 10 additions & 13 deletions PaymillWrapper/Models/Client.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using Newtonsoft.Json;
using PaymillWrapper.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using PaymillWrapper.Utils;
using System.Threading.Tasks;

namespace PaymillWrapper.Models
{
Expand All @@ -18,28 +17,28 @@ public class Client : BaseModel
/// <summary>
/// Mail address of this client
/// </summary>
[DataMember(Name = "email"), Updateable(Name = "email")]
[JsonProperty("email"), Updateable(Name = "email")]
public string Email { get; set; }

/// <summary>
/// Additional description for this client
/// </summary>
[DataMember(Name = "description"), Updateable(Name = "description")]
[JsonProperty("description"), Updateable(Name = "description")]
public string Description { get; set; }

/// <summary>
/// List of credit card/direct debit. Please note, that the payment objects might only contain valid ids.
/// </summary>
[DataMember(Name = "payment")]
[JsonProperty("payment")]
public List<Payment> Payments { get; set; }

/// <summary>
/// List suscription-object
/// </summary>
[DataMember(Name = "subscription")]
[JsonProperty("subscription")]
public List<Subscription> Subscriptions { get; set; }

[DataMember(Name = "app_id")]
[JsonProperty("app_id")]
private String appId;

public Client()
Expand Down Expand Up @@ -177,6 +176,4 @@ public Client.Order Desc()
}

}


}
}
14 changes: 6 additions & 8 deletions PaymillWrapper/Models/Fee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace PaymillWrapper.Models
Expand All @@ -28,22 +26,22 @@ public FeeType()
}
}

[DataMember(Name = "type")]
[JsonProperty("type")]
public FeeType Type { get; set; }

[DataMember(Name = "application")]
[JsonProperty("application")]
public String Application { get; set; }

[DataMember(Name = "payment")]
[JsonProperty("payment")]
public String Payment { get; set; }

[DataMember(Name = "amount")]
[JsonProperty("amount")]
public int? Amount { get; set; }

[DataMember(Name = "billed_at")]
[JsonProperty("billed_at")]
public DateTime? BilledAt { get; set; }

[DataMember(Name = "currency")]
[JsonProperty("currency")]
public String Currency { get; set; }
}
}
8 changes: 4 additions & 4 deletions PaymillWrapper/Models/Interval.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PaymillWrapper.Models
Expand All @@ -23,7 +22,7 @@ public static Interval.PeriodWithChargeDay periodWithChargeDay(int interval, Typ
{
return new Interval.PeriodWithChargeDay(interval, unit, null);
}
[Newtonsoft.Json.JsonConverter(typeof(StringToPeriodConverter))]
[Newtonsoft.Json.JsonConverter(typeof(StringToPeriodConverter))]
public sealed class Period
{

Expand Down Expand Up @@ -57,7 +56,7 @@ public override string ToString()
return this.Interval + " " + this.Unit;
}
}
[Newtonsoft.Json.JsonConverter(typeof(StringToPeriodWithChargeDaydConverter))]
[Newtonsoft.Json.JsonConverter(typeof(StringToPeriodWithChargeDaydConverter))]
public sealed class PeriodWithChargeDay
{
public int Interval { get; set; }
Expand Down Expand Up @@ -91,7 +90,8 @@ internal PeriodWithChargeDay(int interval, TypeUnit unit, Weekday weekday)
}


public override string ToString() {
public override string ToString()
{
return (Weekday == null) ? this.Interval + " " + this.Unit : this.Interval + " " + this.Unit + "," + Weekday;
}
}
Expand Down
Loading