/// <summary> /// Update a draft share invite. When sending status CANCELLED it is possible to cancel the draft share invite. /// </summary> /// <param name="status">The status of the draft share invite. Can be CANCELLED (the user cancels the draft share before it's used).</param> /// <param name="expiration">The moment when this draft share invite expires.</param> /// <param name="draftShareSettings">The draft share invite details.</param> public static BunqResponse <int> Update(int draftShareInviteBankId, string status = null, string expiration = null, DraftShareInviteEntry draftShareSettings = null, IDictionary <string, string> customHeaders = null) { if (customHeaders == null) { customHeaders = new Dictionary <string, string>(); } var apiClient = new ApiClient(GetApiContext()); var requestMap = new Dictionary <string, object> { { FIELD_STATUS, status }, { FIELD_EXPIRATION, expiration }, { FIELD_DRAFT_SHARE_SETTINGS, draftShareSettings }, }; var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), draftShareInviteBankId), requestBytes, customHeaders); return(ProcessForId(responseRaw)); }
private static int GetShareInviteId() { var currentDate = DateTime.UtcNow.Date; var addTime = new TimeSpan(TIME_UNIT_AMOUNT_ZERO, TIME_UNIT_AMOUNT_ONE, TIME_UNIT_AMOUNT_ZERO); var expirationTime = currentDate.Add(addTime).ToString(FORMAT_DATE); var draftShareInviteEntry = new DraftShareInviteEntry(new ShareDetail { Payment = new ShareDetailPayment(true, true, true, true) }); return(DraftShareInviteBank.Create(expirationTime, draftShareInviteEntry).Value); }
private static int GetShareInviteId() { var currentDate = DateTime.UtcNow.Date; var addTime = new TimeSpan(TimeUnitAmountZero, TimeUnitAmountOne, TimeUnitAmountZero); var expirationTime = currentDate.Add(addTime).ToString(FormatDate); var draftShareInviteEntry = new DraftShareInviteEntry( new ShareDetail { Payment = new ShareDetailPayment(true, true, true, true) } ); return(DraftShareInviteBank.Create(expirationTime, draftShareInviteEntry).Value); }