Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add support for file_link_data #1598

Merged
merged 1 commit into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Stripe.net/Services/Files/FileCreateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ public class FileCreateOptions : BaseOptions
[JsonProperty("file")]
public Stream File { get; set; }

/// <summary>
/// Optional parameters to automatically create a <see cref="FileLink"/> for the newly
/// created file.
/// </summary>
[JsonProperty("file_link_data")]
public FileLinkDataOptions FileLinkData { get; set; }

/// <summary>
/// REQUIRED. The purpose of the uploaded file. Possible values are <c>business_logo</c>,
/// <c>customer_signature</c>, <c>dispute_evidence</c>, <c>identity_document</c>,
Expand Down
31 changes: 31 additions & 0 deletions src/Stripe.net/Services/Files/FileLinkDataOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;

public class FileLinkDataOptions : BaseOptions
{
/// <summary>
/// Set this to <c>true</c> to create a file link for the newly created file. Creating a
/// link is only possible when the file’s purpose is one of the following:
/// <c>business_icon</c>, <c>business_logo</c>, <c>customer_signature</c>,
/// <c>dispute_evidence</c>, <c>pci_document</c>, or <c>tax_document_user_upload</c>.
/// </summary>
[JsonProperty("create")]
public bool? Create { get; set; }

/// <summary>
/// A future timestamp after which the link will no longer be usable.
/// </summary>
[JsonProperty("expires_at")]
public DateTime? ExpiresAt { get; set; }

/// <summary>
/// Set of key-value pairs that you can attach to an object. This can be useful for storing
/// additional information about the object in a structured format.
/// </summary>
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
}
}
9 changes: 9 additions & 0 deletions src/StripeTests/Services/Files/FileServiceTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace StripeTests
{
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Reflection;
Expand All @@ -25,6 +26,14 @@ public FileServiceTest(MockHttpClientFixture mockHttpClientFixture)
this.createOptions = new FileCreateOptions
{
File = typeof(FileServiceTest).GetTypeInfo().Assembly.GetManifestResourceStream(FileName),
FileLinkData = new FileLinkDataOptions
{
Create = true,
Metadata = new Dictionary<string, string>
{
{ "key", "value" },
},
},
Purpose = FilePurpose.BusinessLogo,
};

Expand Down