|
|
@ -1,4 +1,5 @@ |
|
|
|
using BBWYB.Common.Http; |
|
|
|
using BBWYB.Common.Models; |
|
|
|
using com.alibaba.openapi.client; |
|
|
|
using com.alibaba.openapi.client.entity; |
|
|
|
using com.alibaba.openapi.client.policy; |
|
|
@ -74,10 +75,12 @@ namespace SDKAdapter.PurchasePlatform.Client |
|
|
|
{ |
|
|
|
result = client.NewRequest(_request, reqPolicy); |
|
|
|
if (result.Value<bool>("success") != true) |
|
|
|
throw new Exception(result.Value<string>("errorMsg")); |
|
|
|
throw new BusinessException(result.Value<string>("errorMsg")); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
if (ex.Message.Contains("通道") && ex.Message.Contains("不能使用")) |
|
|
|
throw new BusinessException(ex.Message); |
|
|
|
throw; |
|
|
|
} |
|
|
|
|
|
|
@ -87,10 +90,10 @@ namespace SDKAdapter.PurchasePlatform.Client |
|
|
|
foreach (var orderPreviewJToken in orderPreviewResuslt) |
|
|
|
{ |
|
|
|
if (orderPreviewJToken["tradeModelList"] == null) |
|
|
|
throw new Exception("当前交易不可通过API下单,请使用1688网页交易 [交易模式列表为空]"); |
|
|
|
throw new BusinessException("当前交易不可通过API下单,请使用1688网页交易 [交易模式列表为空]"); |
|
|
|
var tradeModeJArray = ((JArray)orderPreviewJToken["tradeModelList"]).Where(tradeJToken => tradeJToken.Value<bool>("opSupport")); |
|
|
|
if (tradeModeJArray.Count() == 0) |
|
|
|
throw new Exception("当前交易不可通过API下单,请使用1688网页交易 [没有支持开放平台下单的交易模式]"); |
|
|
|
throw new BusinessException("当前交易不可通过API下单,请使用1688网页交易 [没有支持开放平台下单的交易模式]"); |
|
|
|
|
|
|
|
if (intersectTradeModeList.Count() == 0) |
|
|
|
intersectTradeModeList.AddRange(tradeModeJArray); |
|
|
@ -99,7 +102,7 @@ namespace SDKAdapter.PurchasePlatform.Client |
|
|
|
} |
|
|
|
|
|
|
|
if (intersectTradeModeList.Count() == 0) |
|
|
|
throw new Exception("当前交易不可通过API下单,请使用1688网页交易 [多个拆单之间没有相同的交易模式]"); |
|
|
|
throw new BusinessException("当前交易不可通过API下单,请使用1688网页交易 [多个拆单之间没有相同的交易模式]"); |
|
|
|
return new PP_PreviewOrderResponse() |
|
|
|
{ |
|
|
|
FreightAmount = orderPreviewResuslt.Sum(jt => jt.Value<decimal>("sumCarriage")) / 100M, |
|
|
@ -164,7 +167,7 @@ namespace SDKAdapter.PurchasePlatform.Client |
|
|
|
var result = client.NewRequest(_request, reqPolicy); |
|
|
|
if (result.Value<bool>("success") != true) |
|
|
|
{ |
|
|
|
throw new Exception(result.ToString()); |
|
|
|
throw new BusinessException(result.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
var totalSuccessAmount = result["result"].Value<long>("totalSuccessAmount") / 100M; //采购单总金额,单位分
|
|
|
|