Skip to content

Commit acf3a10

Browse files
authored
Merge branch 'umbraco:main' into main
2 parents cdc57b9 + ff40d47 commit acf3a10

File tree

16 files changed

+129
-43
lines changed

16 files changed

+129
-43
lines changed

src/Umbraco.Cms.Integrations.Commerce.Shopify/App_Plugins/UmbracoCms.Integrations/Commerce/Shopify/js/productPickerSettings.controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@
6262

6363
function validateOAuthSetup() {
6464
umbracoCmsIntegrationsCommerceShopifyResource.validateAccessToken().then(function (response) {
65-
6665
vm.oauthSetup = {
67-
isConnected: response.isValid,
66+
isValid: response.isValid,
67+
isConnected: response.isConnected,
6868
isAccessTokenExpired: response.isExpired,
69-
isAccessTokenValid: response.isValid
69+
isAccessTokenValid: response.isConnected
7070
}
7171

7272
if (vm.oauthSetup.isConnected === true && vm.oauthSetup.isAccessTokenValid === true) {

src/Umbraco.Cms.Integrations.Commerce.Shopify/Controllers/ProductsController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public ProductsController(IShopifyService apiService, AuthorizationImplementatio
5050
}
5151

5252
[HttpGet]
53-
public EditorSettings CheckConfiguration() => _apiService.GetApiConfiguration();
53+
public async Task<EditorSettings> CheckConfiguration() => await _apiService.GetApiConfiguration();
5454

5555
[HttpGet]
5656
public string GetAuthorizationUrl() => _authorizationService.GetAuthorizationUrl();

src/Umbraco.Cms.Integrations.Commerce.Shopify/Editors/ShopifyProductPickerValueConverter.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public override object ConvertSourceToIntermediate(IPublishedElement owner, IPub
3838
if (source == null) return null;
3939

4040
return source.ToString()
41-
.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries)
41+
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
4242
.Select(long.Parse)
4343
.ToArray();
4444
}
@@ -60,7 +60,20 @@ public override object ConvertIntermediateToObject(IPublishedElement owner, IPub
6060
Id = p.Id,
6161
Title = p.Title,
6262
Body = p.Body,
63-
Image = p.Image?.Src
63+
Image = p.Image?.Src,
64+
Tags = p.Tags,
65+
ProductType = p.ProductType,
66+
PublishedScope = p.PublishedScope,
67+
Status = p.Status,
68+
Variants = from v in p.Variants
69+
select new VariantViewModel
70+
{
71+
InventoryQuantity = v.InventoryQuantity,
72+
Position = v.Position,
73+
Price = v.Price,
74+
Sku = v.Sku,
75+
Taxable = v.Taxable
76+
}
6477
};
6578

6679
return products.ToList();

src/Umbraco.Cms.Integrations.Commerce.Shopify/Models/Dtos/ProductDto.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
using System.Collections.Generic;
2-
3-
using Newtonsoft.Json;
1+
using Newtonsoft.Json;
2+
using System.Collections.Generic;
43

54
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
65
{
@@ -29,6 +28,12 @@ public class ProductDto
2928

3029
[JsonProperty("image")]
3130
public ProductImageDto Image { get; set; }
31+
32+
[JsonProperty("product_type")]
33+
public string ProductType { get; set; }
34+
35+
[JsonProperty("published_scope")]
36+
public string PublishedScope { get; set; }
3237
}
3338

3439

src/Umbraco.Cms.Integrations.Commerce.Shopify/Models/Dtos/ProductVariantDto.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@ public class ProductVariantDto
1818

1919
[JsonProperty("inventory_quantity")]
2020
public int InventoryQuantity { get; set; }
21+
22+
[JsonProperty("taxable")]
23+
public bool Taxable { get; set; }
24+
2125
}
2226
}

src/Umbraco.Cms.Integrations.Commerce.Shopify/Models/EditorSettings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ public EditorSettings()
1212
[JsonProperty("isValid")]
1313
public bool IsValid { get; set; }
1414

15+
[JsonProperty("isConnected")]
16+
public bool IsConnected { get; set; }
17+
1518
[JsonProperty("type")]
1619
public ConfigurationType Type { get; set; }
1720
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11

2+
using System.Collections.Generic;
3+
24
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.ViewModels
35
{
46
public class ProductViewModel
57
{
68
public long Id { get; set; }
7-
89
public string Title { get; set; }
9-
1010
public string Body { get; set; }
1111

1212
public string Image { get; set; }
13+
public string ProductType { get; set; }
14+
public string Tags { get; set; }
15+
public string Status { get; set; }
16+
public string PublishedScope { get; set; }
17+
public IEnumerable<VariantViewModel> Variants { get; set; }
1318
}
1419
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+

2+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.ViewModels
3+
{
4+
public class VariantViewModel
5+
{
6+
public string Price { get; set; }
7+
public string Sku { get; set; }
8+
public int Position { get; set; }
9+
public int InventoryQuantity { get; set; }
10+
public bool Taxable { get; set; }
11+
12+
}
13+
}

src/Umbraco.Cms.Integrations.Commerce.Shopify/Services/BaseAuthorizationService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public class BaseAuthorizationService
1616
protected const string ShopifyAuthorizationUrl = "https://{0}.myshopify.com/admin/oauth/authorize" +
1717
"?client_id={1}" +
1818
"&redirect_uri={2}" +
19-
"&scope=read_products" +
20-
"&grant_options[]=value";
19+
"&scope=read_products";
2120

2221
public BaseAuthorizationService(ITokenService tokenService)
2322
{

src/Umbraco.Cms.Integrations.Commerce.Shopify/Services/IShopifyService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Umbraco.Cms.Integrations.Commerce.Shopify.Services
77
{
88
public interface IShopifyService
99
{
10-
EditorSettings GetApiConfiguration();
10+
Task<EditorSettings> GetApiConfiguration();
1111

1212
Task<ResponseDto<ProductsListDto>> ValidateAccessToken();
1313

0 commit comments

Comments
 (0)