diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs index 69e8e81..a4940e1 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs @@ -39,12 +39,14 @@ public class CardDebitTest : BunqSdkTestBase public void TestOrderNewMaestroCard() { SetUpTestCase(); - + var cardPinAssignment = new CardPinAssignment( - CardPinAssignmentTypePrimary, - PinCode, - BunqContext.UserContext.PrimaryMonetaryAccountBank.Id - ); + CardPinAssignmentTypePrimary + ) + { + PinCode = PinCode, + MonetaryAccountId = BunqContext.UserContext.PrimaryMonetaryAccountBank.Id + }; var allCardPinAssignments = new List {cardPinAssignment}; var cardDebit = CardDebit.Create( GenerateRandomSecondLine(), diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/PaymentChatTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/PaymentChatTest.cs deleted file mode 100644 index f076875..0000000 --- a/BunqSdk.Tests/Model/Generated/Endpoint/PaymentChatTest.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections.Generic; -using Bunq.Sdk.Context; -using Bunq.Sdk.Model.Generated.Endpoint; -using Bunq.Sdk.Model.Generated.Object; -using Xunit; - -namespace Bunq.Sdk.Tests.Model.Generated.Endpoint -{ - /// - /// Tests: - /// Payment - /// PaymentChat - /// ChatMessageText - /// - public class PaymentChatTest : BunqSdkTestBase - { - /// - /// Config values. - /// - private const string MessageText = "test msg send from C# test"; - - /// - /// Tests sending a chat message in a newly created payment. - /// - [Fact] - public void TestSendPaymentChat() - { - SetUpTestCase(); - - var chatId = PaymentChat.Create(CreatePaymentAndGetId()).Value; - - ChatMessageText.Create(chatId, MessageText); - } - - private static int CreatePaymentAndGetId() - { - return Payment.Create( - new Amount(PaymentAmountEur, PaymentCurrency), - GetPointerBravo(), - PaymentDescription - ).Value; - } - } -} diff --git a/BunqSdk.Tests/Model/Generated/Object/NotificationUrlTest.cs b/BunqSdk.Tests/Model/Generated/Object/NotificationUrlTest.cs index 98be1ce..5cd1f50 100644 --- a/BunqSdk.Tests/Model/Generated/Object/NotificationUrlTest.cs +++ b/BunqSdk.Tests/Model/Generated/Object/NotificationUrlTest.cs @@ -118,18 +118,6 @@ public void TestBunqMeTabModel() ); } - [Fact] - public void TestChatMessageAnnouncementModel() - { - ExecuteNotificationUrlTest( - JsonPathChatMessageAnnouncementModel, - typeof(ChatMessage), - GetChatMessage, - GetChatMessageAnnouncement, - typeof(ChatMessageAnnouncement) - ); - } - [Fact] public void TestDraftPaymentModel() { diff --git a/BunqSdk/Context/SessionContext.cs b/BunqSdk/Context/SessionContext.cs index cbab494..9dca1b3 100644 --- a/BunqSdk/Context/SessionContext.cs +++ b/BunqSdk/Context/SessionContext.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using Bunq.Sdk.Exception; using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Endpoint; using Newtonsoft.Json; namespace Bunq.Sdk.Context @@ -15,13 +16,11 @@ public class SessionContext /// Error constatns. /// private const string ErrorCouldNotDetermineUserId = "Could not determine user id."; + private const string ErrorSessionserverUserapikeyIdNull = "sessionServer.UserApiKey.Id != null"; private const string ErrorSessionserverUsercompanyIdNull = "sessionServer.UserCompany.Id != null"; private const string ErrorsessionserverUserpersonIdNull = "sessionServer.UserPerson.Id != null"; - - /// - /// Default assumed value for session timeout. - /// - private const double SESSION_TIMEOUT_DEFAULT = 0.0; + private const string ErrorCouldNotDetermineSessionTimeout = "Could not determine session timeout."; + private const string ErrorSessionTimeoutIsNull = "Session timeout is null."; /// /// Session token returned as a response to POST /session-server. @@ -52,16 +51,24 @@ public SessionContext(SessionServer sessionServer) private static int GetUserId(SessionServer sessionServer) { - if (sessionServer.UserCompany != null && sessionServer.UserPerson == null) + if (sessionServer.UserCompany != null && sessionServer.UserApiKey == null &&sessionServer.UserPerson == null) { Debug.Assert(sessionServer.UserCompany.Id != null, ErrorSessionserverUsercompanyIdNull); + return sessionServer.UserCompany.Id.Value; } - else if (sessionServer.UserPerson != null && sessionServer.UserCompany == null) + else if (sessionServer.UserPerson != null && sessionServer.UserApiKey == null && sessionServer.UserCompany == null) { Debug.Assert(sessionServer.UserPerson.Id != null, ErrorsessionserverUserpersonIdNull); + return sessionServer.UserPerson.Id.Value; } + else if (sessionServer.UserApiKey != null && sessionServer.UserCompany == null && sessionServer.UserPerson == null) + { + Debug.Assert(sessionServer.UserApiKey.Id != null, ErrorSessionserverUserapikeyIdNull); + + return sessionServer.UserApiKey.Id.Value; + } else { throw new BunqException(ErrorCouldNotDetermineUserId); @@ -70,17 +77,55 @@ private static int GetUserId(SessionServer sessionServer) private static double GetSessionTimeout(SessionServer sessionServer) { - if (sessionServer.UserCompany != null && sessionServer.UserCompany.SessionTimeout != null) + if (sessionServer.UserApiKey != null && sessionServer.UserCompany == null && sessionServer.UserPerson == null) + { + return GetSesisonTimeOutForUser(sessionServer.UserApiKey.RequestedByUser.GetReferencedObject()); + } + else if (sessionServer.UserCompany != null && sessionServer.UserApiKey == null && sessionServer.UserPerson == null) { - return (double) sessionServer.UserCompany.SessionTimeout; + return GetSesisonTimeOutForUser(sessionServer.UserCompany); } + else if (sessionServer.UserPerson != null && sessionServer.UserApiKey == null && sessionServer.UserCompany == null) + { + return GetSesisonTimeOutForUser(sessionServer.UserPerson); + } + else + { + throw new BunqException(ErrorCouldNotDetermineSessionTimeout); + } + } + + private static double GetSesisonTimeOutForUser(BunqModel user) + { + int? sessionTimeout; - if (sessionServer.UserPerson != null && sessionServer.UserPerson.SessionTimeout != null) + if (user.GetType() == typeof(UserPerson)) { - return (double) sessionServer.UserPerson.SessionTimeout; + sessionTimeout = ((UserPerson) user).SessionTimeout; } + else if (user.GetType() == typeof(UserCompany)) + { + sessionTimeout = ((UserCompany) user).SessionTimeout; + } + else + { + throw new BunqException(ErrorCouldNotDetermineSessionTimeout); + } + + return GetDoubleFromSessionTimeout(sessionTimeout); + } - return SESSION_TIMEOUT_DEFAULT; + private static double GetDoubleFromSessionTimeout(int? sessionTimeout) + { + if (sessionTimeout == null) + { + throw new BunqException(ErrorSessionTimeoutIsNull); + } + else + { + return (double) sessionTimeout; + } } + } } diff --git a/BunqSdk/Context/UserContext.cs b/BunqSdk/Context/UserContext.cs index 0f0ad94..a549a47 100644 --- a/BunqSdk/Context/UserContext.cs +++ b/BunqSdk/Context/UserContext.cs @@ -20,6 +20,7 @@ public class UserContext public UserPerson UserPerson { get; private set; } public UserCompany UserCompany { get; private set; } + public UserApiKey UserApiKey { get; private set; } public MonetaryAccountBank PrimaryMonetaryAccountBank { @@ -51,6 +52,10 @@ private void SetUser(BunqModel user) { this.UserCompany = (UserCompany) user; } + else if (user.GetType() == typeof(UserApiKey)) + { + this.UserApiKey = (UserApiKey) user; + } else { throw new BunqException(string.Format(ErrorUnexpectedUser, user.GetType())); @@ -74,12 +79,17 @@ public void InitPrimaryMonetaryAccount() public bool IsOnlyUserPersonSet() { - return UserCompany == null && UserPerson != null; + return UserCompany == null && UserApiKey == null && UserPerson != null; } public bool IsOnlyUserCompanySet() { - return UserPerson == null && UserCompany != null; + return UserPerson == null && UserApiKey == null && UserCompany != null; + } + + public bool IsOnlyUserApiKeySet() + { + return UserApiKey == null && UserCompany != null && UserPerson != null; } public void RefreshUserContext() diff --git a/BunqSdk/Json/SessionServerConverter.cs b/BunqSdk/Json/SessionServerConverter.cs index 5a614b8..9719822 100644 --- a/BunqSdk/Json/SessionServerConverter.cs +++ b/BunqSdk/Json/SessionServerConverter.cs @@ -1,4 +1,5 @@ using System; +using Bunq.Sdk.Exception; using Bunq.Sdk.Model.Core; using Bunq.Sdk.Model.Generated.Endpoint; using Newtonsoft.Json; @@ -12,27 +13,43 @@ namespace Bunq.Sdk.Json /// public class SessionServerConverter : JsonConverter { - private const int INDEX_ID = 0; - private const string FIELD_ID = "Id"; + private const string ErrorCouldNotDetermineUser = "Could not determine user."; - private const int INDEX_TOKEN = 1; - private const string FIELD_TOKEN = "Token"; + private const int IndexId = 0; + private const string FieldId = "Id"; - private const int INDEX_USER = 2; - private const string FIELD_USER_COMPANY = "UserCompany"; - private const string FIELD_USER_PERSON = "UserPerson"; + private const int IndexToken = 1; + private const string FieldToken = "Token"; + + private const int IndexUser = 2; + private const string FieldUserApiKey = "UserApiKey"; + private const string FieldUserCompany = "UserCompany"; + private const string FieldUserPerson = "UserPerson"; public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jObjects = JArray.Load(reader); - var id = FetchObject(jObjects[INDEX_ID], FIELD_ID); - var token = FetchObject(jObjects[INDEX_TOKEN], FIELD_TOKEN); - var userBody = jObjects[INDEX_USER]; + var id = FetchObject(jObjects[IndexId], FieldId); + var token = FetchObject(jObjects[IndexToken], FieldToken); + var userBody = jObjects[IndexUser]; - return userBody[FIELD_USER_COMPANY] == null - ? new SessionServer(id, token, FetchObject(userBody, FIELD_USER_PERSON)) - : new SessionServer(id, token, FetchObject(userBody, FIELD_USER_COMPANY)); + if (userBody[FieldUserApiKey] != null) + { + return new SessionServer(id, token, FetchObject(userBody, FieldUserApiKey)); + } + else if (userBody[FieldUserCompany] != null) + { + return new SessionServer(id, token, FetchObject(userBody, FieldUserCompany)); + } + else if (userBody[FieldUserPerson] != null) + { + return new SessionServer(id, token, FetchObject(userBody, FieldUserPerson)); + } + else + { + throw new BunqException(ErrorCouldNotDetermineUser); + } } private static T FetchObject(JToken jToken, string fieldName) diff --git a/BunqSdk/Model/Core/SessionServer.cs b/BunqSdk/Model/Core/SessionServer.cs index 7029832..f0fd4c0 100644 --- a/BunqSdk/Model/Core/SessionServer.cs +++ b/BunqSdk/Model/Core/SessionServer.cs @@ -21,6 +21,7 @@ public class SessionServer : BunqModel public Id Id { get; private set; } public SessionToken SessionToken { get; private set; } + public UserApiKey UserApiKey { get; private set; } public UserCompany UserCompany { get; private set; } public UserPerson UserPerson { get; private set; } @@ -37,6 +38,13 @@ public SessionServer(Id id, SessionToken sessionToken, UserPerson userPerson) SessionToken = sessionToken; UserPerson = userPerson; } + + public SessionServer(Id id, SessionToken sessionToken, UserApiKey userApiKey) + { + Id = id; + SessionToken = sessionToken; + UserApiKey = userApiKey; + } /// /// Create a new session for a DeviceServer. Provide the Installation token diff --git a/BunqSdk/Model/Generated/Endpoint/BillingContractSubscription.cs b/BunqSdk/Model/Generated/Endpoint/BillingContractSubscription.cs index 12b4260..0dbdcde 100644 --- a/BunqSdk/Model/Generated/Endpoint/BillingContractSubscription.cs +++ b/BunqSdk/Model/Generated/Endpoint/BillingContractSubscription.cs @@ -74,6 +74,18 @@ public class BillingContractSubscription : BunqModel [JsonProperty(PropertyName = "subscription_type")] public string SubscriptionType { get; set; } + /// + /// The subscription status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// The subscription substatus. + /// + [JsonProperty(PropertyName = "sub_status")] + public string SubStatus { get; set; } + /// /// /// The subscription type of the user. Can be one of PERSON_LIGHT_V1, PERSON_MORE_V1, PERSON_FREE_V1, PERSON_PREMIUM_V1, COMPANY_V1, or COMPANY_V2. @@ -152,6 +164,16 @@ public override bool IsAllFieldNull() return false; } + if (this.Status != null) + { + return false; + } + + if (this.SubStatus != null) + { + return false; + } + return true; } diff --git a/BunqSdk/Model/Generated/Endpoint/Card.cs b/BunqSdk/Model/Generated/Endpoint/Card.cs index 9f25b8a..387ee99 100644 --- a/BunqSdk/Model/Generated/Endpoint/Card.cs +++ b/BunqSdk/Model/Generated/Endpoint/Card.cs @@ -34,7 +34,6 @@ public class Card : BunqModel public const string FIELD_LIMIT = "limit"; public const string FIELD_MAG_STRIPE_PERMISSION = "mag_stripe_permission"; public const string FIELD_COUNTRY_PERMISSION = "country_permission"; - public const string FIELD_MONETARY_ACCOUNT_CURRENT_ID = "monetary_account_current_id"; public const string FIELD_PIN_CODE_ASSIGNMENT = "pin_code_assignment"; public const string FIELD_MONETARY_ACCOUNT_ID_FALLBACK = "monetary_account_id_fallback"; @@ -186,14 +185,12 @@ public class Card : BunqModel /// The limits to define for the card, among CARD_LIMIT_CONTACTLESS, CARD_LIMIT_ATM, CARD_LIMIT_DIPPING and CARD_LIMIT_POS_ICC (e.g. 25 EUR for CARD_LIMIT_CONTACTLESS). All the limits must be provided on update. /// Whether or not it is allowed to use the mag stripe for the card. /// The countries for which to grant (temporary) permissions to use the card. - /// The ID of the monetary account that card transactions will use. /// Array of Types, PINs, account IDs assigned to the card. /// ID of the MA to be used as fallback for this card if insufficient balance. Fallback account is removed if not supplied. public static BunqResponse Update(int cardId, string pinCode = null, string activationCode = null, string status = null, List limit = null, CardMagStripePermission magStripePermission = null, - List countryPermission = null, int? monetaryAccountCurrentId = null, - List pinCodeAssignment = null, int? monetaryAccountIdFallback = null, - IDictionary customHeaders = null) + List countryPermission = null, List pinCodeAssignment = null, + int? monetaryAccountIdFallback = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); @@ -207,7 +204,6 @@ public static BunqResponse Update(int cardId, string pinCode = null, strin {FIELD_LIMIT, limit}, {FIELD_MAG_STRIPE_PERMISSION, magStripePermission}, {FIELD_COUNTRY_PERMISSION, countryPermission}, - {FIELD_MONETARY_ACCOUNT_CURRENT_ID, monetaryAccountCurrentId}, {FIELD_PIN_CODE_ASSIGNMENT, pinCodeAssignment}, {FIELD_MONETARY_ACCOUNT_ID_FALLBACK, monetaryAccountIdFallback}, }; diff --git a/BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs b/BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs index 5b35f7d..c9c30e1 100644 --- a/BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs +++ b/BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs @@ -21,8 +21,14 @@ public class CardGeneratedCvc2 : BunqModel protected const string ENDPOINT_URL_CREATE = "user/{0}/card/{1}/generated-cvc2"; protected const string ENDPOINT_URL_READ = "user/{0}/card/{1}/generated-cvc2/{2}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/card/{1}/generated-cvc2/{2}"; protected const string ENDPOINT_URL_LISTING = "user/{0}/card/{1}/generated-cvc2"; + /// + /// Field constants. + /// + public const string FIELD_TYPE = "type"; + /// /// Object type. /// @@ -46,6 +52,12 @@ public class CardGeneratedCvc2 : BunqModel [JsonProperty(PropertyName = "updated")] public string Updated { get; set; } + /// + /// The type of generated cvc2. Can be STATIC or GENERATED. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + /// /// The cvc2 code. /// @@ -67,7 +79,9 @@ public class CardGeneratedCvc2 : BunqModel /// /// Generate a new CVC2 code for a card. /// - public static BunqResponse Create(int cardId, IDictionary customHeaders = null) + /// The type of generated cvc2. Can be STATIC or GENERATED. + public static BunqResponse Create(int cardId, string type = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); @@ -75,6 +89,7 @@ public static BunqResponse Create(int cardId, IDictionary c var requestMap = new Dictionary { + {FIELD_TYPE, type}, }; var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); @@ -101,6 +116,30 @@ public static BunqResponse Get(int cardId, int cardGeneratedC return FromJson(responseRaw, OBJECT_TYPE_GET); } + /// + /// + /// The type of generated cvc2. Can be STATIC or GENERATED. + public static BunqResponse Update(int cardId, int cardGeneratedCvc2Id, string type = null, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_TYPE, type}, + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + requestBytes = SecurityUtils.Encrypt(GetApiContext(), requestBytes, customHeaders); + var responseRaw = + apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), cardId, cardGeneratedCvc2Id), + requestBytes, customHeaders); + + return ProcessForId(responseRaw); + } + /// /// Get all generated CVC2 codes for a card. /// @@ -137,6 +176,11 @@ public override bool IsAllFieldNull() return false; } + if (this.Type != null) + { + return false; + } + if (this.Cvc2 != null) { return false; diff --git a/BunqSdk/Model/Generated/Endpoint/CardPinChange.cs b/BunqSdk/Model/Generated/Endpoint/CardPinChange.cs deleted file mode 100644 index e64a906..0000000 --- a/BunqSdk/Model/Generated/Endpoint/CardPinChange.cs +++ /dev/null @@ -1,141 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Object; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// View for the pin change. - /// - public class CardPinChange : BunqModel - { - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_LISTING = "user/{0}/card/{1}/pin-change"; - - protected const string ENDPOINT_URL_READ = "user/{0}/card/{1}/pin-change/{2}"; - - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "CardPinChange"; - - /// - /// The id of the pin change. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// The label of the card. - /// - [JsonProperty(PropertyName = "label_card")] - public LabelCard LabelCard { get; set; } - - /// - /// The monetary account this card was ordered on and the label user that owns the card. - /// - [JsonProperty(PropertyName = "label_monetary_account_current")] - public MonetaryAccountReference LabelMonetaryAccountCurrent { get; set; } - - /// - /// The request date of the pin change. - /// - [JsonProperty(PropertyName = "time_request")] - public string TimeRequest { get; set; } - - /// - /// The acceptance date of the pin change. - /// - [JsonProperty(PropertyName = "time_accept")] - public string TimeAccept { get; set; } - - /// - /// The status of the pin change request, PIN_UPDATE_REQUESTED or PIN_UPDATE_ACCEPTED - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// - public static BunqResponse> List(int cardId, IDictionary urlParams = null, - IDictionary customHeaders = null) - { - if (urlParams == null) urlParams = new Dictionary(); - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), cardId), urlParams, - customHeaders); - - return FromJsonList(responseRaw, OBJECT_TYPE_GET); - } - - /// - /// - public static BunqResponse Get(int cardId, int cardPinChangeId, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = - apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), cardId, cardPinChangeId), - new Dictionary(), customHeaders); - - return FromJson(responseRaw, OBJECT_TYPE_GET); - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - if (this.LabelCard != null) - { - return false; - } - - if (this.LabelMonetaryAccountCurrent != null) - { - return false; - } - - if (this.TimeRequest != null) - { - return false; - } - - if (this.TimeAccept != null) - { - return false; - } - - if (this.Status != null) - { - return false; - } - - return true; - } - - /// - /// - public static CardPinChange CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CardReplace.cs b/BunqSdk/Model/Generated/Endpoint/CardReplace.cs index dd7cbcd..7093850 100644 --- a/BunqSdk/Model/Generated/Endpoint/CardReplace.cs +++ b/BunqSdk/Model/Generated/Endpoint/CardReplace.cs @@ -26,8 +26,9 @@ public class CardReplace : BunqModel /// /// Field constants. /// - public const string FIELD_PIN_CODE = "pin_code"; + public const string FIELD_NAME_ON_CARD = "name_on_card"; + public const string FIELD_PIN_CODE = "pin_code"; public const string FIELD_SECOND_LINE = "second_line"; @@ -40,10 +41,11 @@ public class CardReplace : BunqModel /// /// Request a card replacement. /// + /// The user's name as it will be on the card. Check 'card-name' for the available card names for a user. /// The plaintext pin code. Requests require encryption to be enabled. /// The second line on the card. - public static BunqResponse Create(int cardId, string pinCode = null, string secondLine = null, - IDictionary customHeaders = null) + public static BunqResponse Create(int cardId, string nameOnCard = null, string pinCode = null, + string secondLine = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); @@ -51,6 +53,7 @@ public static BunqResponse Create(int cardId, string pinCode = null, string var requestMap = new Dictionary { + {FIELD_NAME_ON_CARD, nameOnCard}, {FIELD_PIN_CODE, pinCode}, {FIELD_SECOND_LINE, secondLine}, }; diff --git a/BunqSdk/Model/Generated/Endpoint/CardResult.cs b/BunqSdk/Model/Generated/Endpoint/CardResult.cs deleted file mode 100644 index e1c5d4a..0000000 --- a/BunqSdk/Model/Generated/Endpoint/CardResult.cs +++ /dev/null @@ -1,254 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Object; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Endpoint for Card result requests (failed and successful transactions). - /// - public class CardResult : BunqModel - { - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/card-result/{2}"; - - protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/card-result"; - - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "CardResult"; - - /// - /// The id of the monetary account this card result links to. - /// - [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; set; } - - /// - /// The id of the card this card result links to. - /// - [JsonProperty(PropertyName = "card_id")] - public int? CardId { get; set; } - - /// - /// The original amount of the message. - /// - [JsonProperty(PropertyName = "amount_original")] - public Amount AmountOriginal { get; set; } - - /// - /// The final amount of the message to be booked to the account. - /// - [JsonProperty(PropertyName = "amount_final")] - public Amount AmountFinal { get; set; } - - /// - /// Why the transaction was denied, if it was denied, or just ALLOWED. - /// - [JsonProperty(PropertyName = "decision")] - public string Decision { get; set; } - - /// - /// Empty if allowed, otherwise a textual explanation of why it was denied. - /// - [JsonProperty(PropertyName = "decision_description")] - public string DecisionDescription { get; set; } - - /// - /// Empty if allowed, otherwise a textual explanation of why it was denied in user's language. - /// - [JsonProperty(PropertyName = "decision_description_translated")] - public string DecisionDescriptionTranslated { get; set; } - - /// - /// The description for this transaction to display. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// The type of message that this card result is created for. - /// - [JsonProperty(PropertyName = "message_type")] - public string MessageType { get; set; } - - /// - /// The way the cardholder was authorised to the POS or ATM. - /// - [JsonProperty(PropertyName = "authorisation_type")] - public string AuthorisationType { get; set; } - - /// - /// The city where the message originates from. - /// - [JsonProperty(PropertyName = "city")] - public string City { get; set; } - - /// - /// The monetary account label of the account that this result is created for. - /// - [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; set; } - - /// - /// The monetary account label of the counterparty. - /// - [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; set; } - - /// - /// The label of the card. - /// - [JsonProperty(PropertyName = "label_card")] - public LabelCard LabelCard { get; set; } - - /// - /// The status of the reservation if the transaction is a reservation. - /// - [JsonProperty(PropertyName = "reservation_status")] - public string ReservationStatus { get; set; } - - /// - /// The moment the reservation will expire. - /// - [JsonProperty(PropertyName = "reservation_expiry_time")] - public string ReservationExpiryTime { get; set; } - - /// - /// - public static BunqResponse Get(int cardResultId, int? monetaryAccountId = null, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = - apiClient.Get( - string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), - cardResultId), new Dictionary(), customHeaders); - - return FromJson(responseRaw, OBJECT_TYPE_GET); - } - - /// - /// - public static BunqResponse> List(int? monetaryAccountId = null, - IDictionary urlParams = null, IDictionary customHeaders = null) - { - if (urlParams == null) urlParams = new Dictionary(); - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = - apiClient.Get( - string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), - DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); - - return FromJsonList(responseRaw, OBJECT_TYPE_GET); - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.MonetaryAccountId != null) - { - return false; - } - - if (this.CardId != null) - { - return false; - } - - if (this.AmountOriginal != null) - { - return false; - } - - if (this.AmountFinal != null) - { - return false; - } - - if (this.Decision != null) - { - return false; - } - - if (this.DecisionDescription != null) - { - return false; - } - - if (this.DecisionDescriptionTranslated != null) - { - return false; - } - - if (this.Description != null) - { - return false; - } - - if (this.MessageType != null) - { - return false; - } - - if (this.AuthorisationType != null) - { - return false; - } - - if (this.City != null) - { - return false; - } - - if (this.Alias != null) - { - return false; - } - - if (this.CounterpartyAlias != null) - { - return false; - } - - if (this.LabelCard != null) - { - return false; - } - - if (this.ReservationStatus != null) - { - return false; - } - - if (this.ReservationExpiryTime != null) - { - return false; - } - - return true; - } - - /// - /// - public static CardResult CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatConversation.cs b/BunqSdk/Model/Generated/Endpoint/ChatConversation.cs deleted file mode 100644 index 147e65e..0000000 --- a/BunqSdk/Model/Generated/Endpoint/ChatConversation.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Exception; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Manages user's conversations. - /// - public class ChatConversation : BunqModel, IAnchorObjectInterface - { - /// - /// Error constants. - /// - private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_LISTING = "user/{0}/chat-conversation"; - - protected const string ENDPOINT_URL_READ = "user/{0}/chat-conversation/{1}"; - - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "ChatConversation"; - - /// - /// - [JsonProperty(PropertyName = "SupportConversationExternal")] - public ChatConversationSupportExternal SupportConversationExternal { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatConversationReference")] - public ChatConversationReference ChatConversationReference { get; set; } - - /// - /// - public static BunqResponse> List(IDictionary urlParams = null, - IDictionary customHeaders = null) - { - if (urlParams == null) urlParams = new Dictionary(); - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, - customHeaders); - - return FromJsonList(responseRaw); - } - - /// - /// - public static BunqResponse Get(int chatConversationId, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), chatConversationId), - new Dictionary(), customHeaders); - - return FromJson(responseRaw); - } - - - /// - /// - public BunqModel GetReferencedObject() - { - if (this.SupportConversationExternal != null) - { - return this.SupportConversationExternal; - } - - if (this.ChatConversationReference != null) - { - return this.ChatConversationReference; - } - - throw new BunqException(ERROR_NULL_FIELDS); - } - - /// - /// - public override bool IsAllFieldNull() - { - if (this.SupportConversationExternal != null) - { - return false; - } - - if (this.ChatConversationReference != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatConversation CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessage.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessage.cs index 2b38e87..bed3108 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessage.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatMessage.cs @@ -1,108 +1,18 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Exception; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; using Bunq.Sdk.Model.Core; using Newtonsoft.Json; using System.Collections.Generic; -using System.Text; -using System; namespace Bunq.Sdk.Model.Generated.Endpoint { /// /// Endpoint for retrieving the messages that are part of a conversation. /// - public class ChatMessage : BunqModel, IAnchorObjectInterface + public class ChatMessage : BunqModel { - /// - /// Error constants. - /// - private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_LISTING = "user/{0}/chat-conversation/{1}/message"; - - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "ChatMessage"; - - /// - /// - [JsonProperty(PropertyName = "ChatMessageAnnouncement")] - public ChatMessageAnnouncement ChatMessageAnnouncement { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatMessageStatus")] - public ChatMessageStatus ChatMessageStatus { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatMessageUser")] - public ChatMessageUser ChatMessageUser { get; set; } - - /// - /// Get all the messages that are part of a specific conversation. - /// - public static BunqResponse> List(int chatConversationId, - IDictionary urlParams = null, IDictionary customHeaders = null) - { - if (urlParams == null) urlParams = new Dictionary(); - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), chatConversationId), - urlParams, customHeaders); - - return FromJsonList(responseRaw); - } - - - /// - /// - public BunqModel GetReferencedObject() - { - if (this.ChatMessageAnnouncement != null) - { - return this.ChatMessageAnnouncement; - } - - if (this.ChatMessageStatus != null) - { - return this.ChatMessageStatus; - } - - if (this.ChatMessageUser != null) - { - return this.ChatMessageUser; - } - - throw new BunqException(ERROR_NULL_FIELDS); - } - /// /// public override bool IsAllFieldNull() { - if (this.ChatMessageAnnouncement != null) - { - return false; - } - - if (this.ChatMessageStatus != null) - { - return false; - } - - if (this.ChatMessageUser != null) - { - return false; - } - return true; } diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageAnnouncement.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageAnnouncement.cs deleted file mode 100644 index 28b6738..0000000 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageAnnouncement.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Object; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Endpoint for retrieving the messages that are part of a conversation. - /// - public class ChatMessageAnnouncement : BunqModel - { - /// - /// The id of the message. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// The timestamp when the message was created. - /// - [JsonProperty(PropertyName = "created")] - public string Created { get; set; } - - /// - /// The timestamp when the message was last updated. - /// - [JsonProperty(PropertyName = "updated")] - public string Updated { get; set; } - - /// - /// The id of the conversation this message belongs to. - /// - [JsonProperty(PropertyName = "conversation_id")] - public int? ConversationId { get; set; } - - /// - /// The user who initiated the action that caused this message to appear. - /// - [JsonProperty(PropertyName = "creator")] - public LabelUser Creator { get; set; } - - /// - /// The content of this message. - /// - [JsonProperty(PropertyName = "content")] - public ChatMessageContent Content { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - if (this.Created != null) - { - return false; - } - - if (this.Updated != null) - { - return false; - } - - if (this.ConversationId != null) - { - return false; - } - - if (this.Creator != null) - { - return false; - } - - if (this.Content != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageAnnouncement CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageAttachment.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageAttachment.cs deleted file mode 100644 index 0708335..0000000 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageAttachment.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Object; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Create new messages holding file attachments. - /// - public class ChatMessageAttachment : BunqModel - { - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_CREATE = "user/{0}/chat-conversation/{1}/message-attachment"; - - /// - /// Field constants. - /// - public const string FIELD_ATTACHMENT = "attachment"; - - - /// - /// The id of the newly created chat message. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// Create a new message holding a file attachment to a specific conversation. - /// - /// The attachment contained in this message. - public static BunqResponse Create(int chatConversationId, BunqId attachment, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_ATTACHMENT, attachment}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), chatConversationId), - requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageAttachment CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageStatus.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageStatus.cs deleted file mode 100644 index b94ca3e..0000000 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageStatus.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Object; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Endpoint for retrieving the messages that are part of a conversation. - /// - public class ChatMessageStatus : BunqModel - { - /// - /// The id of the message. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// The timestamp when the message was created. - /// - [JsonProperty(PropertyName = "created")] - public string Created { get; set; } - - /// - /// The timestamp when the message was last updated. - /// - [JsonProperty(PropertyName = "updated")] - public string Updated { get; set; } - - /// - /// The id of the conversation this message belongs to. - /// - [JsonProperty(PropertyName = "conversation_id")] - public int? ConversationId { get; set; } - - /// - /// The user who initiated the action that caused this message to appear. - /// - [JsonProperty(PropertyName = "creator")] - public LabelUser Creator { get; set; } - - /// - /// The content of this message. - /// - [JsonProperty(PropertyName = "content")] - public ChatMessageContent Content { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - if (this.Created != null) - { - return false; - } - - if (this.Updated != null) - { - return false; - } - - if (this.ConversationId != null) - { - return false; - } - - if (this.Creator != null) - { - return false; - } - - if (this.Content != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageStatus CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageText.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageText.cs deleted file mode 100644 index d242df5..0000000 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageText.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Endpoint for the type of chat message that carries text. - /// - public class ChatMessageText : BunqModel - { - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_CREATE = "user/{0}/chat-conversation/{1}/message-text"; - - /// - /// Field constants. - /// - public const string FIELD_TEXT = "text"; - - - /// - /// The id of the newly created chat message. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// Add a new text message to a specific conversation. - /// - /// The textual content of this message. Cannot be empty. - public static BunqResponse Create(int chatConversationId, string text, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_TEXT, text}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), chatConversationId), - requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageText CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageUser.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageUser.cs deleted file mode 100644 index ee3d33c..0000000 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageUser.cs +++ /dev/null @@ -1,105 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Object; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Endpoint for retrieving the messages that are part of a conversation. - /// - public class ChatMessageUser : BunqModel - { - /// - /// The id of the message. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// The timestamp when the message was created. - /// - [JsonProperty(PropertyName = "created")] - public string Created { get; set; } - - /// - /// The timestamp when the message was last updated. - /// - [JsonProperty(PropertyName = "updated")] - public string Updated { get; set; } - - /// - /// The id of the conversation this message belongs to. - /// - [JsonProperty(PropertyName = "conversation_id")] - public int? ConversationId { get; set; } - - /// - /// The user who initiated the action that caused this message to appear. - /// - [JsonProperty(PropertyName = "creator")] - public LabelUser Creator { get; set; } - - /// - /// The user displayed as the sender of this message. - /// - [JsonProperty(PropertyName = "displayed_sender")] - public LabelUser DisplayedSender { get; set; } - - /// - /// The content of this message. - /// - [JsonProperty(PropertyName = "content")] - public ChatMessageContent Content { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - if (this.Created != null) - { - return false; - } - - if (this.Updated != null) - { - return false; - } - - if (this.ConversationId != null) - { - return false; - } - - if (this.Creator != null) - { - return false; - } - - if (this.DisplayedSender != null) - { - return false; - } - - if (this.Content != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageUser CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Customer.cs b/BunqSdk/Model/Generated/Endpoint/Customer.cs index b39f7e7..1022c29 100644 --- a/BunqSdk/Model/Generated/Endpoint/Customer.cs +++ b/BunqSdk/Model/Generated/Endpoint/Customer.cs @@ -27,6 +27,8 @@ public class Customer : BunqModel /// public const string FIELD_BILLING_ACCOUNT_ID = "billing_account_id"; + public const string FIELD_INVOICE_NOTIFICATION_PREFERENCE = "invoice_notification_preference"; + /// /// Object type. /// @@ -87,8 +89,9 @@ public static BunqResponse Get(int customerId, IDictionary /// /// The primary billing account account's id. + /// The preferred notification type for invoices public static BunqResponse Update(int customerId, string billingAccountId = null, - IDictionary customHeaders = null) + string invoiceNotificationPreference = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); @@ -97,6 +100,7 @@ public static BunqResponse Update(int customerId, string billingAccountId = var requestMap = new Dictionary { {FIELD_BILLING_ACCOUNT_ID, billingAccountId}, + {FIELD_INVOICE_NOTIFICATION_PREFERENCE, invoiceNotificationPreference}, }; var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); diff --git a/BunqSdk/Model/Generated/Endpoint/CustomerStatementExport.cs b/BunqSdk/Model/Generated/Endpoint/CustomerStatementExport.cs index 4923b69..011311f 100644 --- a/BunqSdk/Model/Generated/Endpoint/CustomerStatementExport.cs +++ b/BunqSdk/Model/Generated/Endpoint/CustomerStatementExport.cs @@ -37,7 +37,7 @@ public class CustomerStatementExport : BunqModel /// /// Object type. /// - private const string OBJECT_TYPE_GET = "CustomerStatementExport"; + private const string OBJECT_TYPE_GET = "CustomerStatement"; /// /// The id of the customer statement model. diff --git a/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverview.cs b/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverview.cs index 04b2c38..dfb61d9 100644 --- a/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverview.cs +++ b/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverview.cs @@ -22,6 +22,7 @@ public class ExportAnnualOverview : BunqModel protected const string ENDPOINT_URL_CREATE = "user/{0}/export-annual-overview"; protected const string ENDPOINT_URL_READ = "user/{0}/export-annual-overview/{1}"; + protected const string ENDPOINT_URL_DELETE = "user/{0}/export-annual-overview/{1}"; protected const string ENDPOINT_URL_LISTING = "user/{0}/export-annual-overview"; /// @@ -101,6 +102,21 @@ public static BunqResponse Get(int exportAnnualOverviewId, return FromJson(responseRaw, OBJECT_TYPE_GET); } + /// + /// + public static BunqResponse Delete(int exportAnnualOverviewId, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), exportAnnualOverviewId), + customHeaders); + + return new BunqResponse(null, responseRaw.Headers); + } + /// /// List all the annual overviews for a user. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MasterCardAction.cs b/BunqSdk/Model/Generated/Endpoint/MasterCardAction.cs index 74f5ee5..3b476a8 100644 --- a/BunqSdk/Model/Generated/Endpoint/MasterCardAction.cs +++ b/BunqSdk/Model/Generated/Endpoint/MasterCardAction.cs @@ -178,6 +178,13 @@ public class MasterCardAction : BunqModel [JsonProperty(PropertyName = "secure_code_id")] public int? SecureCodeId { get; set; } + /// + /// The ID of the wallet provider as defined by MasterCard. 420 = bunq Android app with Tap&Pay; 103 = Apple + /// Pay. + /// + [JsonProperty(PropertyName = "wallet_provider_id")] + public string WalletProviderId { get; set; } + /// /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch /// @@ -347,6 +354,11 @@ public override bool IsAllFieldNull() return false; } + if (this.WalletProviderId != null) + { + return false; + } + if (this.RequestReferenceSplitTheBill != null) { return false; diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJoint.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJoint.cs index a5d92b6..bac6e06 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJoint.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJoint.cs @@ -1,7 +1,12 @@ +using Bunq.Sdk.Context; +using Bunq.Sdk.Http; +using Bunq.Sdk.Json; using Bunq.Sdk.Model.Core; using Bunq.Sdk.Model.Generated.Object; using Newtonsoft.Json; using System.Collections.Generic; +using System.Text; +using System; namespace Bunq.Sdk.Model.Generated.Endpoint { @@ -10,6 +15,15 @@ namespace Bunq.Sdk.Model.Generated.Endpoint /// public class MonetaryAccountJoint : BunqModel { + /// + /// Endpoint constants. + /// + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account-joint"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account-joint/{1}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account-joint/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account-joint"; + /// /// Field constants. /// @@ -28,6 +42,10 @@ public class MonetaryAccountJoint : BunqModel public const string FIELD_NOTIFICATION_FILTERS = "notification_filters"; public const string FIELD_SETTING = "setting"; + /// + /// Object type. + /// + private const string OBJECT_TYPE_GET = "MonetaryAccountJoint"; /// /// The id of the MonetaryAccountJoint. @@ -160,6 +178,125 @@ public class MonetaryAccountJoint : BunqModel [JsonProperty(PropertyName = "setting")] public MonetaryAccountSetting Setting { get; set; } + /// + /// + /// The currency of the MonetaryAccountJoint as an ISO 4217 formatted currency code. + /// The users the account will be joint with. + /// The description of the MonetaryAccountJoint. Defaults to 'bunq account'. + /// The daily spending limit Amount of the MonetaryAccountJoint. Defaults to 1000 EUR. Currency must match the MonetaryAccountJoint's currency. Limited to 10000 EUR. + /// The maximum Amount the MonetaryAccountJoint can be 'in the red'. Must be 0 EUR or omitted. + /// The Aliases to add to MonetaryAccountJoint. Must all be confirmed first. Can mostly be ignored. + /// The UUID of the Avatar of the MonetaryAccountJoint. + /// The status of the MonetaryAccountJoint. Ignored in POST requests (always set to ACTIVE) can be CANCELLED or PENDING_REOPEN in PUT requests to cancel (close) or reopen the MonetaryAccountJoint. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The sub-status of the MonetaryAccountJoint providing extra information regarding the status. Should be ignored for POST requests. In case of PUT requests with status CANCELLED it can only be REDEMPTION_VOLUNTARY, while with status PENDING_REOPEN it can only be NONE. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The reason for voluntarily cancelling (closing) the MonetaryAccountJoint, can only be OTHER. Should only be specified if updating the status to CANCELLED. + /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountJoint. Can be any user provided message. Should only be specified if updating the status to CANCELLED. + /// The types of notifications that will result in a push notification or URL callback for this MonetaryAccountJoint. + /// The settings of the MonetaryAccountJoint. + public static BunqResponse Create(string currency, List allCoOwner, string description = null, + Amount dailyLimit = null, Amount overdraftLimit = null, List alias = null, + string avatarUuid = null, string status = null, string subStatus = null, string reason = null, + string reasonDescription = null, List notificationFilters = null, + MonetaryAccountSetting setting = null, IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_CURRENCY, currency}, + {FIELD_DESCRIPTION, description}, + {FIELD_DAILY_LIMIT, dailyLimit}, + {FIELD_OVERDRAFT_LIMIT, overdraftLimit}, + {FIELD_ALIAS, alias}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_REASON, reason}, + {FIELD_REASON_DESCRIPTION, reasonDescription}, + {FIELD_ALL_CO_OWNER, allCoOwner}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + {FIELD_SETTING, setting}, + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + + return ProcessForId(responseRaw); + } + + /// + /// + public static BunqResponse Get(int monetaryAccountJointId, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), monetaryAccountJointId), + new Dictionary(), customHeaders); + + return FromJson(responseRaw, OBJECT_TYPE_GET); + } + + /// + /// + /// The description of the MonetaryAccountJoint. Defaults to 'bunq account'. + /// The daily spending limit Amount of the MonetaryAccountJoint. Defaults to 1000 EUR. Currency must match the MonetaryAccountJoint's currency. Limited to 10000 EUR. + /// The UUID of the Avatar of the MonetaryAccountJoint. + /// The status of the MonetaryAccountJoint. Ignored in POST requests (always set to ACTIVE) can be CANCELLED or PENDING_REOPEN in PUT requests to cancel (close) or reopen the MonetaryAccountJoint. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The sub-status of the MonetaryAccountJoint providing extra information regarding the status. Should be ignored for POST requests. In case of PUT requests with status CANCELLED it can only be REDEMPTION_VOLUNTARY, while with status PENDING_REOPEN it can only be NONE. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The reason for voluntarily cancelling (closing) the MonetaryAccountJoint, can only be OTHER. Should only be specified if updating the status to CANCELLED. + /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountJoint. Can be any user provided message. Should only be specified if updating the status to CANCELLED. + /// The types of notifications that will result in a push notification or URL callback for this MonetaryAccountJoint. + /// The settings of the MonetaryAccountJoint. + public static BunqResponse Update(int monetaryAccountJointId, string description = null, + Amount dailyLimit = null, string avatarUuid = null, string status = null, string subStatus = null, + string reason = null, string reasonDescription = null, List notificationFilters = null, + MonetaryAccountSetting setting = null, IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_DESCRIPTION, description}, + {FIELD_DAILY_LIMIT, dailyLimit}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_REASON, reason}, + {FIELD_REASON_DESCRIPTION, reasonDescription}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + {FIELD_SETTING, setting}, + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + var responseRaw = + apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), monetaryAccountJointId), + requestBytes, customHeaders); + + return ProcessForId(responseRaw); + } + + /// + /// + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) + { + if (urlParams == null) urlParams = new Dictionary(); + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + + return FromJsonList(responseRaw, OBJECT_TYPE_GET); + } + /// /// diff --git a/BunqSdk/Model/Generated/Endpoint/PaymentChat.cs b/BunqSdk/Model/Generated/Endpoint/PaymentChat.cs deleted file mode 100644 index 9155f31..0000000 --- a/BunqSdk/Model/Generated/Endpoint/PaymentChat.cs +++ /dev/null @@ -1,162 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Manage the chat connected to a payment. - /// - public class PaymentChat : BunqModel - { - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/payment/{2}/chat"; - - protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/payment/{2}/chat/{3}"; - protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/payment/{2}/chat"; - - /// - /// Field constants. - /// - public const string FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id"; - - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "ChatConversationPayment"; - - /// - /// The id of the chat conversation. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// The timestamp when the chat was created. - /// - [JsonProperty(PropertyName = "created")] - public string Created { get; set; } - - /// - /// The timestamp when the chat was last updated. - /// - [JsonProperty(PropertyName = "updated")] - public string Updated { get; set; } - - /// - /// The total number of unread messages in this conversation. - /// - [JsonProperty(PropertyName = "unread_message_count")] - public int? UnreadMessageCount { get; set; } - - /// - /// Create a chat for a specific payment. - /// - /// The id of the last read message. - public static BunqResponse Create(int paymentId, int? monetaryAccountId = null, - int? lastReadMessageId = null, IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = - apiClient.Post( - string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), - paymentId), requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - /// - /// Update the last read message in the chat of a specific payment. - /// - /// The id of the last read message. - public static BunqResponse Update(int paymentId, int paymentChatId, int? monetaryAccountId = null, - int? lastReadMessageId = null, IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = - apiClient.Put( - string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), - paymentId, paymentChatId), requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - /// - /// Get the chat for a specific payment. - /// - public static BunqResponse> List(int paymentId, int? monetaryAccountId = null, - IDictionary urlParams = null, IDictionary customHeaders = null) - { - if (urlParams == null) urlParams = new Dictionary(); - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = - apiClient.Get( - string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), - DetermineMonetaryAccountId(monetaryAccountId), paymentId), urlParams, customHeaders); - - return FromJsonList(responseRaw, OBJECT_TYPE_GET); - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - if (this.Created != null) - { - return false; - } - - if (this.Updated != null) - { - return false; - } - - if (this.UnreadMessageCount != null) - { - return false; - } - - return true; - } - - /// - /// - public static PaymentChat CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/PromotionDisplay.cs b/BunqSdk/Model/Generated/Endpoint/PromotionDisplay.cs deleted file mode 100644 index 06d29e7..0000000 --- a/BunqSdk/Model/Generated/Endpoint/PromotionDisplay.cs +++ /dev/null @@ -1,130 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Object; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// The public endpoint for retrieving and updating a promotion display model. - /// - public class PromotionDisplay : BunqModel - { - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_READ = "user/{0}/promotion-display/{1}"; - - protected const string ENDPOINT_URL_UPDATE = "user/{0}/promotion-display/{1}"; - - /// - /// Field constants. - /// - public const string FIELD_STATUS = "status"; - - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "PromotionDisplay"; - - /// - /// The id of the promotion. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// The alias of the user you received the promotion from. - /// - [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; set; } - - /// - /// The event description of the promotion appearing on time line. - /// - [JsonProperty(PropertyName = "event_description")] - public string EventDescription { get; set; } - - /// - /// The status of the promotion. (CREATED, CLAIMED, EXPIRED, DISCARDED) - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// - public static BunqResponse Get(int promotionDisplayId, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), promotionDisplayId), - new Dictionary(), customHeaders); - - return FromJson(responseRaw, OBJECT_TYPE_GET); - } - - /// - /// - /// The status of the promotion. User can set it to discarded. - public static BunqResponse Update(int promotionDisplayId, string status = null, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_STATUS, status}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), promotionDisplayId), - requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - if (this.CounterpartyAlias != null) - { - return false; - } - - if (this.EventDescription != null) - { - return false; - } - - if (this.Status != null) - { - return false; - } - - return true; - } - - /// - /// - public static PromotionDisplay CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/RequestInquiryChat.cs b/BunqSdk/Model/Generated/Endpoint/RequestInquiryChat.cs deleted file mode 100644 index bbc0d97..0000000 --- a/BunqSdk/Model/Generated/Endpoint/RequestInquiryChat.cs +++ /dev/null @@ -1,166 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Manage the chat connected to a request inquiry. In the same way a request inquiry and a request response are - /// created together, so that each side of the interaction can work on a different object, also a request inquiry - /// chat and a request response chat are created at the same time. See 'request-response-chat' for the chat endpoint - /// for the responding user. - /// - public class RequestInquiryChat : BunqModel - { - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat"; - - protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat/{3}"; - protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat"; - - /// - /// Field constants. - /// - public const string FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id"; - - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "RequestInquiryChat"; - - /// - /// The id of the newly created chat conversation. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// The timestamp when the chat was created. - /// - [JsonProperty(PropertyName = "created")] - public string Created { get; set; } - - /// - /// The timestamp when the chat was last updated. - /// - [JsonProperty(PropertyName = "updated")] - public string Updated { get; set; } - - /// - /// The total number of messages in this conversation. - /// - [JsonProperty(PropertyName = "unread_message_count")] - public int? UnreadMessageCount { get; set; } - - /// - /// Create a chat for a specific request inquiry. - /// - /// The id of the last read message. - public static BunqResponse Create(int requestInquiryId, int? monetaryAccountId = null, - int? lastReadMessageId = null, IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = - apiClient.Post( - string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), - requestInquiryId), requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - /// - /// Update the last read message in the chat of a specific request inquiry. - /// - /// The id of the last read message. - public static BunqResponse Update(int requestInquiryId, int requestInquiryChatId, - int? monetaryAccountId = null, int? lastReadMessageId = null, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = - apiClient.Put( - string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), - requestInquiryId, requestInquiryChatId), requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - /// - /// Get the chat for a specific request inquiry. - /// - public static BunqResponse> List(int requestInquiryId, int? monetaryAccountId = null, - IDictionary urlParams = null, IDictionary customHeaders = null) - { - if (urlParams == null) urlParams = new Dictionary(); - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = - apiClient.Get( - string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), - DetermineMonetaryAccountId(monetaryAccountId), requestInquiryId), urlParams, customHeaders); - - return FromJsonList(responseRaw, OBJECT_TYPE_GET); - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - if (this.Created != null) - { - return false; - } - - if (this.Updated != null) - { - return false; - } - - if (this.UnreadMessageCount != null) - { - return false; - } - - return true; - } - - /// - /// - public static RequestInquiryChat CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/RequestResponseChat.cs b/BunqSdk/Model/Generated/Endpoint/RequestResponseChat.cs deleted file mode 100644 index 8ce57d9..0000000 --- a/BunqSdk/Model/Generated/Endpoint/RequestResponseChat.cs +++ /dev/null @@ -1,166 +0,0 @@ -using Bunq.Sdk.Context; -using Bunq.Sdk.Http; -using Bunq.Sdk.Json; -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Text; -using System; - -namespace Bunq.Sdk.Model.Generated.Endpoint -{ - /// - /// Manage the chat connected to a request response. In the same way a request inquiry and a request response are - /// created together, so that each side of the interaction can work on a different object, also a request inquiry - /// chat and a request response chat are created at the same time. See 'request-inquiry-chat' for the chat endpoint - /// for the inquiring user. - /// - public class RequestResponseChat : BunqModel - { - /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-response/{2}/chat"; - - protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-response/{2}/chat/{3}"; - protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-response/{2}/chat"; - - /// - /// Field constants. - /// - public const string FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id"; - - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "RequestResponseChat"; - - /// - /// The id of the newly created chat conversation. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// The timestamp when the chat was created. - /// - [JsonProperty(PropertyName = "created")] - public string Created { get; set; } - - /// - /// The timestamp when the chat was last updated. - /// - [JsonProperty(PropertyName = "updated")] - public string Updated { get; set; } - - /// - /// The total number of messages in this conversation. - /// - [JsonProperty(PropertyName = "unread_message_count")] - public int? UnreadMessageCount { get; set; } - - /// - /// Create a chat for a specific request response. - /// - /// The id of the last read message. - public static BunqResponse Create(int requestResponseId, int? monetaryAccountId = null, - int? lastReadMessageId = null, IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = - apiClient.Post( - string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), - requestResponseId), requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - /// - /// Update the last read message in the chat of a specific request response. - /// - /// The id of the last read message. - public static BunqResponse Update(int requestResponseId, int requestResponseChatId, - int? monetaryAccountId = null, int? lastReadMessageId = null, - IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - - var requestMap = new Dictionary - { - {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, - }; - - var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = - apiClient.Put( - string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), - requestResponseId, requestResponseChatId), requestBytes, customHeaders); - - return ProcessForId(responseRaw); - } - - /// - /// Get the chat for a specific request response. - /// - public static BunqResponse> List(int requestResponseId, int? monetaryAccountId = null, - IDictionary urlParams = null, IDictionary customHeaders = null) - { - if (urlParams == null) urlParams = new Dictionary(); - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = - apiClient.Get( - string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), - DetermineMonetaryAccountId(monetaryAccountId), requestResponseId), urlParams, customHeaders); - - return FromJsonList(responseRaw, OBJECT_TYPE_GET); - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Id != null) - { - return false; - } - - if (this.Created != null) - { - return false; - } - - if (this.Updated != null) - { - return false; - } - - if (this.UnreadMessageCount != null) - { - return false; - } - - return true; - } - - /// - /// - public static RequestResponseChat CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Tab.cs b/BunqSdk/Model/Generated/Endpoint/Tab.cs index e80eeba..c2630ce 100644 --- a/BunqSdk/Model/Generated/Endpoint/Tab.cs +++ b/BunqSdk/Model/Generated/Endpoint/Tab.cs @@ -1,8 +1,8 @@ using Bunq.Sdk.Context; +using Bunq.Sdk.Exception; using Bunq.Sdk.Http; using Bunq.Sdk.Json; using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Object; using Newtonsoft.Json; using System.Collections.Generic; using System.Text; @@ -11,123 +11,104 @@ namespace Bunq.Sdk.Model.Generated.Endpoint { /// - /// Used to read a single publicly visible tab. + /// Once your CashRegister has been activated you can use it to create Tabs. A Tab is a template for a payment. In + /// contrast to requests a Tab is not pointed towards a specific user. Any user can pay the Tab as long as it is + /// made visible by you. The creation of a Tab happens with /tab-usage-single or /tab-usage-multiple. A + /// TabUsageSingle is a Tab that can be paid once. A TabUsageMultiple is a Tab that can be paid multiple times by + /// different users. /// - public class Tab : BunqModel + public class Tab : BunqModel, IAnchorObjectInterface { /// - /// Endpoint constants. - /// - protected const string ENDPOINT_URL_READ = "tab/{0}"; - - /// - /// Object type. + /// Error constants. /// - private const string OBJECT_TYPE_GET = "Tab"; + private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; /// - /// The uuid of the tab. + /// Endpoint constants. /// - [JsonProperty(PropertyName = "uuid")] - public string Uuid { get; set; } + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}"; - /// - /// The label of the party that owns this tab. - /// - [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; set; } + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/tab"; /// - /// The avatar of this tab. + /// Object type. /// - [JsonProperty(PropertyName = "avatar")] - public string Avatar { get; set; } + private const string OBJECT_TYPE_GET = "Tab"; /// - /// The reference of the tab, as defined by the owner. /// - [JsonProperty(PropertyName = "reference")] - public string Reference { get; set; } + [JsonProperty(PropertyName = "TabUsageSingle")] + public TabUsageSingle TabUsageSingle { get; set; } /// - /// The short description of the tab. /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } + [JsonProperty(PropertyName = "TabUsageMultiple")] + public TabUsageMultiple TabUsageMultiple { get; set; } /// - /// The status of the tab. + /// Get a specific tab. This returns a TabUsageSingle or TabUsageMultiple. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + public static BunqResponse Get(int cashRegisterId, string tabUuid, int? monetaryAccountId = null, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); - /// - /// The moment when this tab expires. - /// - [JsonProperty(PropertyName = "expiration")] - public string Expiration { get; set; } + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUuid), new Dictionary(), customHeaders); - /// - /// The total amount of the tab. - /// - [JsonProperty(PropertyName = "amount_total")] - public Amount AmountTotal { get; set; } + return FromJson(responseRaw); + } /// - /// Get a publicly visible tab. + /// Get a collection of tabs. /// - public static BunqResponse Get(string tabUuid, IDictionary customHeaders = null) + public static BunqResponse> List(int cashRegisterId, int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { + if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); var apiClient = new ApiClient(GetApiContext()); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, tabUuid), new Dictionary(), - customHeaders); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), cashRegisterId), urlParams, customHeaders); - return FromJson(responseRaw, OBJECT_TYPE_GET); + return FromJsonList(responseRaw); } /// /// - public override bool IsAllFieldNull() + public BunqModel GetReferencedObject() { - if (this.Uuid != null) - { - return false; - } - - if (this.Alias != null) + if (this.TabUsageSingle != null) { - return false; + return this.TabUsageSingle; } - if (this.Avatar != null) + if (this.TabUsageMultiple != null) { - return false; + return this.TabUsageMultiple; } - if (this.Reference != null) - { - return false; - } - - if (this.Description != null) - { - return false; - } - - if (this.Status != null) - { - return false; - } + throw new BunqException(ERROR_NULL_FIELDS); + } - if (this.Expiration != null) + /// + /// + public override bool IsAllFieldNull() + { + if (this.TabUsageSingle != null) { return false; } - if (this.AmountTotal != null) + if (this.TabUsageMultiple != null) { return false; } diff --git a/BunqSdk/Model/Generated/Endpoint/TokenQrRequestIdeal.cs b/BunqSdk/Model/Generated/Endpoint/TokenQrRequestIdeal.cs index 14e9eb7..7ef1510 100644 --- a/BunqSdk/Model/Generated/Endpoint/TokenQrRequestIdeal.cs +++ b/BunqSdk/Model/Generated/Endpoint/TokenQrRequestIdeal.cs @@ -12,10 +12,9 @@ namespace Bunq.Sdk.Model.Generated.Endpoint { /// /// Using this call you create a request for payment from an external token provided with an ideal transaction. Make - /// sure your iDEAL payments are compliant with the iDEAL standards, by following the following manual: https://www.bunq.com/files/media/legal/en/20170315_ideal_standards_en.pdf. - /// It's very important to keep these points in mind when you are using the endpoint to make iDEAL payments from - /// your application. + /// sure your iDEAL payments are compliant with the iDEAL standards, by following the following manual: + /// https://www.bunq.com/terms-idealstandards. It's very important to keep these points in mind when you are using + /// the endpoint to make iDEAL payments from your application. /// public class TokenQrRequestIdeal : BunqModel { diff --git a/BunqSdk/Model/Generated/Endpoint/User.cs b/BunqSdk/Model/Generated/Endpoint/User.cs index 3b1cae8..07a0495 100644 --- a/BunqSdk/Model/Generated/Endpoint/User.cs +++ b/BunqSdk/Model/Generated/Endpoint/User.cs @@ -48,6 +48,11 @@ public class User : BunqModel, IAnchorObjectInterface [JsonProperty(PropertyName = "UserCompany")] public UserCompany UserCompany { get; set; } + /// + /// + [JsonProperty(PropertyName = "UserApiKey")] + public UserApiKey UserApiKey { get; set; } + /// /// Get a specific user. /// @@ -97,6 +102,11 @@ public BunqModel GetReferencedObject() return this.UserCompany; } + if (this.UserApiKey != null) + { + return this.UserApiKey; + } + throw new BunqException(ERROR_NULL_FIELDS); } @@ -119,6 +129,11 @@ public override bool IsAllFieldNull() return false; } + if (this.UserApiKey != null) + { + return false; + } + return true; } diff --git a/BunqSdk/Model/Generated/Endpoint/ChatConversationSupportExternal.cs b/BunqSdk/Model/Generated/Endpoint/UserApiKey.cs similarity index 55% rename from BunqSdk/Model/Generated/Endpoint/ChatConversationSupportExternal.cs rename to BunqSdk/Model/Generated/Endpoint/UserApiKey.cs index 6beddb2..c0bedad 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatConversationSupportExternal.cs +++ b/BunqSdk/Model/Generated/Endpoint/UserApiKey.cs @@ -1,37 +1,44 @@ using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; using Newtonsoft.Json; using System.Collections.Generic; namespace Bunq.Sdk.Model.Generated.Endpoint { /// - /// Manages user's support conversation. + /// Used to view OAuth request detais in events. /// - public class ChatConversationSupportExternal : BunqModel + public class UserApiKey : BunqModel { /// - /// The id of this conversation. + /// The id of the user. /// [JsonProperty(PropertyName = "id")] public int? Id { get; set; } /// - /// The timestamp of the support conversation's creation. + /// The timestamp of the user object's creation. /// [JsonProperty(PropertyName = "created")] public string Created { get; set; } /// - /// The timestamp of the support conversation's last update. + /// The timestamp of the user object's last update. /// [JsonProperty(PropertyName = "updated")] public string Updated { get; set; } /// - /// The last message posted to this conversation if any. + /// The user who requested access. /// - [JsonProperty(PropertyName = "last_message")] - public ChatMessage LastMessage { get; set; } + [JsonProperty(PropertyName = "requested_by_user")] + public UserApiKeyAnchoredUser RequestedByUser { get; set; } + + /// + /// The user who granted access. + /// + [JsonProperty(PropertyName = "granted_by_user")] + public UserApiKeyAnchoredUser GrantedByUser { get; set; } /// @@ -53,7 +60,12 @@ public override bool IsAllFieldNull() return false; } - if (this.LastMessage != null) + if (this.RequestedByUser != null) + { + return false; + } + + if (this.GrantedByUser != null) { return false; } @@ -63,9 +75,9 @@ public override bool IsAllFieldNull() /// /// - public static ChatConversationSupportExternal CreateFromJsonString(string json) + public static UserApiKey CreateFromJsonString(string json) { - return BunqModel.CreateFromJsonString(json); + return BunqModel.CreateFromJsonString(json); } } } \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/WhitelistResult.cs b/BunqSdk/Model/Generated/Endpoint/WhitelistResult.cs index 347b1a5..3245cb8 100644 --- a/BunqSdk/Model/Generated/Endpoint/WhitelistResult.cs +++ b/BunqSdk/Model/Generated/Endpoint/WhitelistResult.cs @@ -28,6 +28,12 @@ public class WhitelistResult : BunqModel [JsonProperty(PropertyName = "status")] public string Status { get; set; } + /// + /// The message when the whitelist result has failed due to user error. + /// + [JsonProperty(PropertyName = "error_message")] + public List ErrorMessage { get; set; } + /// /// The corresponding whitelist. /// @@ -38,7 +44,7 @@ public class WhitelistResult : BunqModel /// The details of the external object the event was created for. /// [JsonProperty(PropertyName = "object")] - public BunqModel Object { get; set; } + public WhitelistResultViewAnchoredObject Object { get; set; } /// /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch @@ -66,6 +72,11 @@ public override bool IsAllFieldNull() return false; } + if (this.ErrorMessage != null) + { + return false; + } + if (this.Whitelist != null) { return false; diff --git a/BunqSdk/Model/Generated/Object/Address.cs b/BunqSdk/Model/Generated/Object/Address.cs index ae8e720..1f61f24 100644 --- a/BunqSdk/Model/Generated/Object/Address.cs +++ b/BunqSdk/Model/Generated/Object/Address.cs @@ -13,43 +13,43 @@ public class Address : BunqModel /// [JsonProperty(PropertyName = "street")] public string Street { get; set; } - + /// /// The house number. /// [JsonProperty(PropertyName = "house_number")] public string HouseNumber { get; set; } - + /// /// The PO box. /// [JsonProperty(PropertyName = "po_box")] public string PoBox { get; set; } - + /// /// The postal code. /// [JsonProperty(PropertyName = "postal_code")] public string PostalCode { get; set; } - + /// /// The city. /// [JsonProperty(PropertyName = "city")] public string City { get; set; } - + /// /// The country as an ISO 3166-1 alpha-2 country code.. /// [JsonProperty(PropertyName = "country")] public string Country { get; set; } - + /// /// The province according to local standard. /// [JsonProperty(PropertyName = "province")] public string Province { get; set; } - + public Address(string street, string houseNumber, string postalCode, string city, string country) { Street = street; @@ -58,8 +58,8 @@ public Address(string street, string houseNumber, string postalCode, string city City = city; Country = country; } - - + + /// /// public override bool IsAllFieldNull() @@ -68,40 +68,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.HouseNumber != null) { return false; } - + if (this.PoBox != null) { return false; } - + if (this.PostalCode != null) { return false; } - + if (this.City != null) { return false; } - + if (this.Country != null) { return false; } - + if (this.Province != null) { return false; } - + return true; } - + /// /// public static Address CreateFromJsonString(string json) @@ -109,4 +109,4 @@ public static Address CreateFromJsonString(string json) return BunqModel.CreateFromJsonString
(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/AnchoredObject.cs b/BunqSdk/Model/Generated/Object/AnchoredObject.cs deleted file mode 100644 index a45c193..0000000 --- a/BunqSdk/Model/Generated/Object/AnchoredObject.cs +++ /dev/null @@ -1,311 +0,0 @@ -using Bunq.Sdk.Exception; -using Bunq.Sdk.Model.Core; -using Bunq.Sdk.Model.Generated.Endpoint; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class AnchoredObject : BunqModel, IAnchorObjectInterface - { - /// - /// Error constants. - /// - private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - - /// - /// - [JsonProperty(PropertyName = "CardDebit")] - public CardDebit CardDebit { get; set; } - - /// - /// - [JsonProperty(PropertyName = "CardPinChange")] - public CardPinChange CardPinChange { get; set; } - - /// - /// - [JsonProperty(PropertyName = "CardResult")] - public CardResult CardResult { get; set; } - - /// - /// - [JsonProperty(PropertyName = "DraftPayment")] - public DraftPayment DraftPayment { get; set; } - - /// - /// - [JsonProperty(PropertyName = "IdealMerchantTransaction")] - public IdealMerchantTransaction IdealMerchantTransaction { get; set; } - - /// - /// - [JsonProperty(PropertyName = "Invoice")] - public Invoice Invoice { get; set; } - - /// - /// - [JsonProperty(PropertyName = "Payment")] - public Payment Payment { get; set; } - - /// - /// - [JsonProperty(PropertyName = "PaymentBatch")] - public PaymentBatch PaymentBatch { get; set; } - - /// - /// - [JsonProperty(PropertyName = "PromotionDisplay")] - public PromotionDisplay PromotionDisplay { get; set; } - - /// - /// - [JsonProperty(PropertyName = "RequestInquiryBatch")] - public RequestInquiryBatch RequestInquiryBatch { get; set; } - - /// - /// - [JsonProperty(PropertyName = "RequestInquiry")] - public RequestInquiry RequestInquiry { get; set; } - - /// - /// - [JsonProperty(PropertyName = "RequestResponse")] - public RequestResponse RequestResponse { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ScheduledPaymentBatch")] - public SchedulePaymentBatch ScheduledPaymentBatch { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ScheduledPayment")] - public SchedulePayment ScheduledPayment { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ScheduledInstance")] - public ScheduleInstance ScheduledInstance { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ShareInviteBankInquiry")] - public ShareInviteBankInquiry ShareInviteBankInquiry { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ShareInviteBankResponse")] - public ShareInviteBankResponse ShareInviteBankResponse { get; set; } - - /// - /// - [JsonProperty(PropertyName = "UserCredentialPasswordIp")] - public UserCredentialPasswordIp UserCredentialPasswordIp { get; set; } - - - /// - /// - public BunqModel GetReferencedObject() - { - if (this.CardDebit != null) - { - return this.CardDebit; - } - - if (this.CardPinChange != null) - { - return this.CardPinChange; - } - - if (this.CardResult != null) - { - return this.CardResult; - } - - if (this.DraftPayment != null) - { - return this.DraftPayment; - } - - if (this.IdealMerchantTransaction != null) - { - return this.IdealMerchantTransaction; - } - - if (this.Invoice != null) - { - return this.Invoice; - } - - if (this.Payment != null) - { - return this.Payment; - } - - if (this.PaymentBatch != null) - { - return this.PaymentBatch; - } - - if (this.PromotionDisplay != null) - { - return this.PromotionDisplay; - } - - if (this.RequestInquiryBatch != null) - { - return this.RequestInquiryBatch; - } - - if (this.RequestInquiry != null) - { - return this.RequestInquiry; - } - - if (this.RequestResponse != null) - { - return this.RequestResponse; - } - - if (this.ScheduledPaymentBatch != null) - { - return this.ScheduledPaymentBatch; - } - - if (this.ScheduledPayment != null) - { - return this.ScheduledPayment; - } - - if (this.ScheduledInstance != null) - { - return this.ScheduledInstance; - } - - if (this.ShareInviteBankInquiry != null) - { - return this.ShareInviteBankInquiry; - } - - if (this.ShareInviteBankResponse != null) - { - return this.ShareInviteBankResponse; - } - - if (this.UserCredentialPasswordIp != null) - { - return this.UserCredentialPasswordIp; - } - - throw new BunqException(ERROR_NULL_FIELDS); - } - - /// - /// - public override bool IsAllFieldNull() - { - if (this.CardDebit != null) - { - return false; - } - - if (this.CardPinChange != null) - { - return false; - } - - if (this.CardResult != null) - { - return false; - } - - if (this.DraftPayment != null) - { - return false; - } - - if (this.IdealMerchantTransaction != null) - { - return false; - } - - if (this.Invoice != null) - { - return false; - } - - if (this.Payment != null) - { - return false; - } - - if (this.PaymentBatch != null) - { - return false; - } - - if (this.PromotionDisplay != null) - { - return false; - } - - if (this.RequestInquiryBatch != null) - { - return false; - } - - if (this.RequestInquiry != null) - { - return false; - } - - if (this.RequestResponse != null) - { - return false; - } - - if (this.ScheduledPaymentBatch != null) - { - return false; - } - - if (this.ScheduledPayment != null) - { - return false; - } - - if (this.ScheduledInstance != null) - { - return false; - } - - if (this.ShareInviteBankInquiry != null) - { - return false; - } - - if (this.ShareInviteBankResponse != null) - { - return false; - } - - if (this.UserCredentialPasswordIp != null) - { - return false; - } - - return true; - } - - /// - /// - public static AnchoredObject CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/CardPinAssignment.cs b/BunqSdk/Model/Generated/Object/CardPinAssignment.cs index dc40968..10a3551 100644 --- a/BunqSdk/Model/Generated/Object/CardPinAssignment.cs +++ b/BunqSdk/Model/Generated/Object/CardPinAssignment.cs @@ -26,11 +26,9 @@ public class CardPinAssignment : BunqModel [JsonProperty(PropertyName = "monetary_account_id")] public int? MonetaryAccountId { get; set; } - public CardPinAssignment(string type, string pinCode, int? monetaryAccountId) + public CardPinAssignment(string type) { Type = type; - PinCode = pinCode; - MonetaryAccountId = monetaryAccountId; } diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContent.cs b/BunqSdk/Model/Generated/Object/ChatMessageContent.cs deleted file mode 100644 index b469d3b..0000000 --- a/BunqSdk/Model/Generated/Object/ChatMessageContent.cs +++ /dev/null @@ -1,145 +0,0 @@ -using Bunq.Sdk.Exception; -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class ChatMessageContent : BunqModel, IAnchorObjectInterface - { - /// - /// Error constants. - /// - private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - - /// - /// - [JsonProperty(PropertyName = "ChatMessageContentAnchorEvent")] - public ChatMessageContentAnchorEvent ChatMessageContentAnchorEvent { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatMessageContentAttachment")] - public ChatMessageContentAttachment ChatMessageContentAttachment { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatMessageContentGeolocation")] - public ChatMessageContentGeolocation ChatMessageContentGeolocation { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatMessageContentStatusConversationTitle")] - public ChatMessageContentStatusConversationTitle ChatMessageContentStatusConversationTitle { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatMessageContentStatusConversation")] - public ChatMessageContentStatusConversation ChatMessageContentStatusConversation { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatMessageContentStatusMembership")] - public ChatMessageContentStatusMembership ChatMessageContentStatusMembership { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ChatMessageContentText")] - public ChatMessageContentText ChatMessageContentText { get; set; } - - - /// - /// - public BunqModel GetReferencedObject() - { - if (this.ChatMessageContentAnchorEvent != null) - { - return this.ChatMessageContentAnchorEvent; - } - - if (this.ChatMessageContentAttachment != null) - { - return this.ChatMessageContentAttachment; - } - - if (this.ChatMessageContentGeolocation != null) - { - return this.ChatMessageContentGeolocation; - } - - if (this.ChatMessageContentStatusConversationTitle != null) - { - return this.ChatMessageContentStatusConversationTitle; - } - - if (this.ChatMessageContentStatusConversation != null) - { - return this.ChatMessageContentStatusConversation; - } - - if (this.ChatMessageContentStatusMembership != null) - { - return this.ChatMessageContentStatusMembership; - } - - if (this.ChatMessageContentText != null) - { - return this.ChatMessageContentText; - } - - throw new BunqException(ERROR_NULL_FIELDS); - } - - /// - /// - public override bool IsAllFieldNull() - { - if (this.ChatMessageContentAnchorEvent != null) - { - return false; - } - - if (this.ChatMessageContentAttachment != null) - { - return false; - } - - if (this.ChatMessageContentGeolocation != null) - { - return false; - } - - if (this.ChatMessageContentStatusConversationTitle != null) - { - return false; - } - - if (this.ChatMessageContentStatusConversation != null) - { - return false; - } - - if (this.ChatMessageContentStatusMembership != null) - { - return false; - } - - if (this.ChatMessageContentText != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageContent CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentAnchorEvent.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentAnchorEvent.cs deleted file mode 100644 index b151485..0000000 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentAnchorEvent.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class ChatMessageContentAnchorEvent : BunqModel - { - /// - /// An anchored object. Can be one of: CardDebit, CardPinChange, CardResult, DraftPayment, - /// IdealMerchantTransaction, Invoice, Payment, PaymentBatch, PromotionDisplay, RequestInquiryBatch, - /// RequestInquiry, RequestResponse, ScheduledPaymentBatch, ScheduledPayment, ScheduledRequestInquiryBatch, - /// ScheduledRequestInquiry, ScheduledInstance, ShareInviteBankInquiry, ShareInviteBankResponse, - /// UserCredentialPasswordIp - /// - [JsonProperty(PropertyName = "anchored_object")] - public AnchoredObject AnchoredObject { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.AnchoredObject != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageContentAnchorEvent CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentAttachment.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentAttachment.cs deleted file mode 100644 index 3fbce1c..0000000 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentAttachment.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class ChatMessageContentAttachment : BunqModel - { - /// - /// An attachment. - /// - [JsonProperty(PropertyName = "attachment")] - public Attachment Attachment { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Attachment != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageContentAttachment CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentGeolocation.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentGeolocation.cs deleted file mode 100644 index 10113ca..0000000 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentGeolocation.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class ChatMessageContentGeolocation : BunqModel - { - /// - /// A geolocation, using WGS 84 coordinates. - /// - [JsonProperty(PropertyName = "geolocation")] - public Geolocation Geolocation { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Geolocation != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageContentGeolocation CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversation.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversation.cs deleted file mode 100644 index ccde762..0000000 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversation.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class ChatMessageContentStatusConversation : BunqModel - { - /// - /// Action which occurred over a conversation. Always CONVERSATION_CREATED - /// - [JsonProperty(PropertyName = "action")] - public string Action { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Action != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageContentStatusConversation CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversationTitle.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversationTitle.cs deleted file mode 100644 index c989bae..0000000 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversationTitle.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class ChatMessageContentStatusConversationTitle : BunqModel - { - /// - /// The new title of a conversation. - /// - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Title != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageContentStatusConversationTitle CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusMembership.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusMembership.cs deleted file mode 100644 index 097cc20..0000000 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusMembership.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class ChatMessageContentStatusMembership : BunqModel - { - /// - /// Action which occurred over a member. Could be MEMBER_ADDED or MEMBER_REMOVED - /// - [JsonProperty(PropertyName = "action")] - public string Action { get; set; } - - /// - /// The member over which the action has occurred. - /// - [JsonProperty(PropertyName = "member")] - public LabelUser Member { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Action != null) - { - return false; - } - - if (this.Member != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageContentStatusMembership CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentText.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentText.cs deleted file mode 100644 index 6ebfd95..0000000 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentText.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class ChatMessageContentText : BunqModel - { - /// - /// The text of the message. - /// - [JsonProperty(PropertyName = "text")] - public string Text { get; set; } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.Text != null) - { - return false; - } - - return true; - } - - /// - /// - public static ChatMessageContentText CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/CoOwner.cs b/BunqSdk/Model/Generated/Object/CoOwner.cs index 58b7f93..2315fa1 100644 --- a/BunqSdk/Model/Generated/Object/CoOwner.cs +++ b/BunqSdk/Model/Generated/Object/CoOwner.cs @@ -12,7 +12,7 @@ public class CoOwner : BunqModel /// The Alias of the co-owner. ///
[JsonProperty(PropertyName = "alias")] - public List Alias { get; set; } + public LabelUser Alias { get; set; } /// /// Can be: ACCEPTED, REJECTED, PENDING or REVOKED @@ -20,12 +20,6 @@ public class CoOwner : BunqModel [JsonProperty(PropertyName = "status")] public string Status { get; set; } - public CoOwner(List alias) - { - Alias = alias; - } - - /// /// public override bool IsAllFieldNull() diff --git a/BunqSdk/Model/Generated/Object/DraftShareInviteBankEntry.cs b/BunqSdk/Model/Generated/Object/DraftShareInviteBankEntry.cs deleted file mode 100644 index 94901a2..0000000 --- a/BunqSdk/Model/Generated/Object/DraftShareInviteBankEntry.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Bunq.Sdk.Model.Core; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Bunq.Sdk.Model.Generated.Object -{ - /// - /// - public class DraftShareInviteBankEntry : BunqModel - { - /// - /// The share details. Only one of these objects is returned. - /// - [JsonProperty(PropertyName = "share_detail")] - public ShareDetail ShareDetail { get; set; } - - /// - /// The start date of this share. - /// - [JsonProperty(PropertyName = "start_date")] - public string StartDate { get; set; } - - /// - /// The expiration date of this share. - /// - [JsonProperty(PropertyName = "end_date")] - public string EndDate { get; set; } - - public DraftShareInviteBankEntry(ShareDetail shareDetail) - { - ShareDetail = shareDetail; - } - - - /// - /// - public override bool IsAllFieldNull() - { - if (this.ShareDetail != null) - { - return false; - } - - if (this.StartDate != null) - { - return false; - } - - if (this.EndDate != null) - { - return false; - } - - return true; - } - - /// - /// - public static DraftShareInviteBankEntry CreateFromJsonString(string json) - { - return BunqModel.CreateFromJsonString(json); - } - } -} diff --git a/BunqSdk/Model/Generated/Object/UserApiKeyAnchoredUser.cs b/BunqSdk/Model/Generated/Object/UserApiKeyAnchoredUser.cs new file mode 100644 index 0000000..e38308a --- /dev/null +++ b/BunqSdk/Model/Generated/Object/UserApiKeyAnchoredUser.cs @@ -0,0 +1,71 @@ +using Bunq.Sdk.Exception; +using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Endpoint; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Bunq.Sdk.Model.Generated.Object +{ + /// + /// + public class UserApiKeyAnchoredUser : BunqModel, IAnchorObjectInterface + { + /// + /// Error constants. + /// + private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; + + + /// + /// + [JsonProperty(PropertyName = "UserPerson")] + public UserPerson UserPerson { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UserCompany")] + public UserCompany UserCompany { get; set; } + + + /// + /// + public BunqModel GetReferencedObject() + { + if (this.UserPerson != null) + { + return this.UserPerson; + } + + if (this.UserCompany != null) + { + return this.UserCompany; + } + + throw new BunqException(ERROR_NULL_FIELDS); + } + + /// + /// + public override bool IsAllFieldNull() + { + if (this.UserPerson != null) + { + return false; + } + + if (this.UserCompany != null) + { + return false; + } + + return true; + } + + /// + /// + public static UserApiKeyAnchoredUser CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatConversationReference.cs b/BunqSdk/Model/Generated/Object/WhitelistResultViewAnchoredObject.cs similarity index 50% rename from BunqSdk/Model/Generated/Endpoint/ChatConversationReference.cs rename to BunqSdk/Model/Generated/Object/WhitelistResultViewAnchoredObject.cs index 2ca38fd..9b1ef92 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatConversationReference.cs +++ b/BunqSdk/Model/Generated/Object/WhitelistResultViewAnchoredObject.cs @@ -1,31 +1,31 @@ using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Endpoint; using Newtonsoft.Json; using System.Collections.Generic; -namespace Bunq.Sdk.Model.Generated.Endpoint +namespace Bunq.Sdk.Model.Generated.Object { /// - /// Represents conversation references. /// - public class ChatConversationReference : BunqModel + public class WhitelistResultViewAnchoredObject : BunqModel { /// - /// The id of this conversation. + /// The ID of the whitelist entry. /// [JsonProperty(PropertyName = "id")] public int? Id { get; set; } /// - /// The timestamp the conversation reference was created. + /// The RequestResponse object /// - [JsonProperty(PropertyName = "created")] - public string Created { get; set; } + [JsonProperty(PropertyName = "requestResponse")] + public RequestResponse RequestResponse { get; set; } /// - /// The timestamp the conversation reference was last updated. + /// The DraftPayment object /// - [JsonProperty(PropertyName = "updated")] - public string Updated { get; set; } + [JsonProperty(PropertyName = "draftPayment")] + public DraftPayment DraftPayment { get; set; } /// @@ -37,12 +37,12 @@ public override bool IsAllFieldNull() return false; } - if (this.Created != null) + if (this.RequestResponse != null) { return false; } - if (this.Updated != null) + if (this.DraftPayment != null) { return false; } @@ -52,9 +52,9 @@ public override bool IsAllFieldNull() /// /// - public static ChatConversationReference CreateFromJsonString(string json) + public static WhitelistResultViewAnchoredObject CreateFromJsonString(string json) { - return BunqModel.CreateFromJsonString(json); + return BunqModel.CreateFromJsonString(json); } } } \ No newline at end of file