Skip to content

Commit

Permalink
Add support for file_link_data (#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe committed May 26, 2019
1 parent 810f567 commit 28c78f4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
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

0 comments on commit 28c78f4

Please sign in to comment.