From a2ef5b5922edb397aafdab04983f29ae6a61bc88 Mon Sep 17 00:00:00 2001 From: Hardik Shah Date: Sat, 24 Jun 2023 17:08:51 +0530 Subject: [PATCH] Added additional multipass parameters like tag_string, identifier, remote_ip and return_to --- ShopifySharp.Tests/Multipass_Tests.cs | 5 +++-- ShopifySharp/Entities/MultipassRequest.cs | 20 +++++++++++++++++++ .../Services/Multipass/MultipassService.cs | 5 +++-- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 ShopifySharp/Entities/MultipassRequest.cs diff --git a/ShopifySharp.Tests/Multipass_Tests.cs b/ShopifySharp.Tests/Multipass_Tests.cs index 39b6e5a5..50672a11 100644 --- a/ShopifySharp.Tests/Multipass_Tests.cs +++ b/ShopifySharp.Tests/Multipass_Tests.cs @@ -21,7 +21,7 @@ public void Link_Multipass() string url = MultipassService.GetMultipassUrl( Fixture.Create(), Utils.MyShopifyUrl, - Utils.AccessToken + Utils.MultipassSecret ); Assert.True(!string.IsNullOrEmpty(url)); @@ -33,7 +33,7 @@ public class Multipass_Tests_Fixture : IAsyncLifetime { public Guid Guid = Guid.NewGuid(); - public Customer Create() => new Customer() + public MultipassRequest Create() => new MultipassRequest() { Email = Guid.NewGuid().ToString() + "@example.com", CreatedAt = DateTimeOffset.Now, @@ -41,6 +41,7 @@ public class Multipass_Tests_Fixture : IAsyncLifetime LastName = "Doe", VerifiedEmail = true, MultipassIdentifier = Guid.ToString(), + ReturnTo = $"{Utils.MyShopifyUrl}", Addresses = new List
() { new Address() diff --git a/ShopifySharp/Entities/MultipassRequest.cs b/ShopifySharp/Entities/MultipassRequest.cs new file mode 100644 index 00000000..50affffc --- /dev/null +++ b/ShopifySharp/Entities/MultipassRequest.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using System; +using System.Collections.Generic; +using System.Text; + +namespace ShopifySharp +{ + public class MultipassRequest : Customer + { + [JsonProperty("tag_string")] + public string TagString { get; set; } + [JsonProperty("identifier")] + public string Identifier { get; set; } + [JsonProperty("remote_ip")] + public string RemoteIP { get; set; } + [JsonProperty("return_to")] + public string ReturnTo { get; set; } + } +} diff --git a/ShopifySharp/Services/Multipass/MultipassService.cs b/ShopifySharp/Services/Multipass/MultipassService.cs index 541f1309..dbb7f59c 100644 --- a/ShopifySharp/Services/Multipass/MultipassService.cs +++ b/ShopifySharp/Services/Multipass/MultipassService.cs @@ -4,6 +4,7 @@ using System.Security.Cryptography; using System.Text; using Newtonsoft.Json; +using ShopifySharp.Entities; namespace ShopifySharp { @@ -12,8 +13,8 @@ public static class MultipassService private const int FixedKeySize = 16; public static string GetMultipassUrl( - Customer userData, - string shopifyUrl, + MultipassRequest userData, + string shopifyUrl, string multipassSecret ) {