Asp.net 在收款卡Bot框架中将默认货币更改为首选货币
我正在尝试使用bot框架C实现一个收据卡,但它一直以美元显示货币。我已尝试将API端点所在的货币从$更改为我想要的货币,但货币仍然没有更改。知道我做得不对吗Asp.net 在收款卡Bot框架中将默认货币更改为首选货币,asp.net,botframework,bots,Asp.net,Botframework,Bots,我正在尝试使用bot框架C实现一个收据卡,但它一直以美元显示货币。我已尝试将API端点所在的货币从$更改为我想要的货币,但货币仍然没有更改。知道我做得不对吗 CardAction pbv = new CardAction() { Value = "Check Status", Type = "imBack" }; ReceiptCard plCard = new ReceiptCard() { Title = "Little Live Fare", Items
CardAction pbv = new CardAction()
{
Value = "Check Status",
Type = "imBack"
};
ReceiptCard plCard = new ReceiptCard()
{
Title = "Little Live Fare",
Items = new List<ReceiptItem>
{
new ReceiptItem("TRIP STATUS",subtitle:status, image: new CardImage(url: img_url)),
},
Total = "500.00",
Tax = "0.00",
Tap = pbv
};
我希望总数显示为KES:200.00,而不是$200.00。
同样的,人们可以定制卡片,并且在收据上不显示税吗 在收据卡中有一个事实属性,该属性列在这些事实中,您可以设置货币类型。货币类型似乎遵循,您也可以找到 我将在下面向您展示我正在使用的代码,但这是它分别在slack和facebook上呈现的方式: Facebook: 松弛: 我还可以通过不包括tax参数来排除显示的tax,正如您在下面的代码中看到的那样:
Activity reply = activity.CreateReply();
reply.Attachments = new List<Attachment>();
var receiptCard = new ReceiptCard
{
Title = "John Doe",
Facts = new List<Fact>
{
new Fact("Order Number", "1234"),
new Fact("Payment Method", "VISA 5555-****"),
new Fact("currency", "KES")
},
Items = new List<ReceiptItem>
{
new ReceiptItem("Data Transfer", price: "KSh 38.45", quantity: "368", image: new CardImage(url: "https://github.com/amido/azure-vector-icons/raw/master/renders/traffic-manager.png")),
new ReceiptItem("App Service", price: "KSh 45.00", quantity: "720", image: new CardImage(url: "https://github.com/amido/azure-vector-icons/raw/master/renders/cloud-service.png")),
},
Total = "90.95",
Buttons = new List<CardAction>
{
new CardAction(
ActionTypes.OpenUrl,
"More information",
"https://account.windowsazure.com/content/6.10.1.38-.8225.160809-1618/aux-pre/images/offer-icon-freetrial.png",
"https://azure.microsoft.com/en-us/pricing/")
}
};
reply.Attachments.Add(receiptCard.ToAttachment());
await context.PostAsync(reply);
您的代码无效,我们甚至不知道您的res对象是什么,您在其中填充您正在谈论的值,因此不可能帮助code updated@NicolasRI表示如果不是金额,还可以在Total和Tax上解析哪些内容。。。比如说包括货币在内的东西?抱歉,这不是那种你会得到帮助的评论。撤回并更新了@NicolasRWhich频道,你想把接收卡发送到哪个频道?非常感谢。这真的很有帮助。货币问题已经解决。关于税收的另一个问题,当你点击收据卡时,facebook仍然会显示税收。同样的,这个解决方案对我也适用……我也注意到了这一点。这似乎完全站在Facebook一边,因为我看不到改变这一点的方法。今天我将进一步探讨这个问题,但从bot代码的角度来看,它似乎超出了我们的控制范围。我在facebook收据模板API调用中没有看到任何改变这一点的东西。是的,它似乎在facebook方面。我已经准备好了电报和传真,收据还可以。。。。在facebook上,除了点击收据查看更多税务显示的详细信息外,这也没问题。
Activity reply = activity.CreateReply();
reply.Attachments = new List<Attachment>();
var receiptCard = new ReceiptCard
{
Title = "John Doe",
Facts = new List<Fact>
{
new Fact("Order Number", "1234"),
new Fact("Payment Method", "VISA 5555-****"),
new Fact("currency", "KES")
},
Items = new List<ReceiptItem>
{
new ReceiptItem("Data Transfer", price: "KSh 38.45", quantity: "368", image: new CardImage(url: "https://github.com/amido/azure-vector-icons/raw/master/renders/traffic-manager.png")),
new ReceiptItem("App Service", price: "KSh 45.00", quantity: "720", image: new CardImage(url: "https://github.com/amido/azure-vector-icons/raw/master/renders/cloud-service.png")),
},
Total = "90.95",
Buttons = new List<CardAction>
{
new CardAction(
ActionTypes.OpenUrl,
"More information",
"https://account.windowsazure.com/content/6.10.1.38-.8225.160809-1618/aux-pre/images/offer-icon-freetrial.png",
"https://azure.microsoft.com/en-us/pricing/")
}
};
reply.Attachments.Add(receiptCard.ToAttachment());
await context.PostAsync(reply);