|
|
@@ -28,6 +28,8 @@ namespace BulkPrintingAPI.Controllers
|
|
28
|
28
|
|
|
29
|
29
|
[Required]
|
|
30
|
30
|
public string CustomerReference { get; set; }
|
|
|
31
|
+
|
|
|
32
|
+ public Guid? OrderGuid { get; set; }
|
|
31
|
33
|
};
|
|
32
|
34
|
|
|
33
|
35
|
private readonly ILogger _logger;
|
|
|
@@ -98,6 +100,15 @@ namespace BulkPrintingAPI.Controllers
|
|
98
|
100
|
return BadRequest(ModelState);
|
|
99
|
101
|
}
|
|
100
|
102
|
|
|
|
103
|
+ if (order.OrderGuid.HasValue)
|
|
|
104
|
+ {
|
|
|
105
|
+ var batch = await _context.Batches.SingleOrDefaultAsync(b => b.OrderGuid == order.OrderGuid.Value);
|
|
|
106
|
+ if (batch != null)
|
|
|
107
|
+ {
|
|
|
108
|
+ return BadRequest(new { error = "Duplicate OrderGuid" });
|
|
|
109
|
+ }
|
|
|
110
|
+ }
|
|
|
111
|
+
|
|
101
|
112
|
var credentials = await Utils.GetLoginCredentialsFromRequestAsync(HttpContext, _context);
|
|
102
|
113
|
var catalogue = await Utils.GetProductCatalogueAsync(_clientFactory, _logger, _cache,
|
|
103
|
114
|
credentials, false);
|
|
|
@@ -109,7 +120,7 @@ namespace BulkPrintingAPI.Controllers
|
|
109
|
120
|
}
|
|
110
|
121
|
|
|
111
|
122
|
var orderResponse = await MAX.Utils.PlaceOrderAsync(_clientFactory, _logger,
|
|
112
|
|
- credentials, product, order.Quantity, order.CustomerReference,
|
|
|
123
|
+ credentials, product, order.Quantity, order.CustomerReference, order.OrderGuid,
|
|
113
|
124
|
Utils.AesDecryptBytes(credentials.Vendor.EncryptedVoucherKey,
|
|
114
|
125
|
_dataEncryptionOptions.DefaultKey));
|
|
115
|
126
|
|