简体   繁体   English

spree-paypal-express失败,出现“网关错误:转换缺失:en.the_totals_of_the_cart_item_amounts_do_not_match_order_amounts”

[英]spree-paypal-express fails with “Gateway Error: translation missing: en.the_totals_of_the_cart_item_amounts_do_not_match_order_amounts ”

I'm using spree 1-2-stable, and I'm using spree-paypap-express 1-2-stable branch (tried with master too but failed again). 我正在使用spree 1-2-stable,我正在使用spree-paypap-express 1-2-stable分支(尝试使用master但是再次失败)。 When I try to checkout an order and select PayPal express as the payment method it fails with an error: "Gateway Error: translation missing: en.the_totals_of_the_cart_item_amounts_do_not_match_order_amounts" . 当我尝试签出订单并选择PayPal express作为付款方式时,它会失败并显示错误: “网关错误:转换缺失:en.the_totals_of_the_cart_item_amounts_do_not_match_order_amounts” For some reason the order total does not match cart item amounts. 由于某种原因,订单总额与购物车项目金额不匹配。 I spent whole weekend on this and still have no idea why this is happening. 我整个周末都在这上面,但仍然不知道为什么会这样。

The issue only happens if I include shipping with price > 0 (it works if I set the shipping price to 0). 只有当我包含价格> 0的运费时才会出现此问题(如果我将运费设置为0,则会有效)。 As soon as I change the shipping price to be a value >0 or some % it breaks. 一旦我将运费价格更改为> 0或某个%,它就会中断。 I tried with both "Shipment including VAT" true and false - same thing. 我尝试了“包含增值税的运费”是真是假 - 同样的事情。

Any ideas? 有任何想法吗? Is this a bug in ppx or I'm I missing something? 这是ppx中的错误还是我错过了什么?


UPDATE: 12/12/12 更新:12/12/12

Here are the values I'm using to reproduce the problem: I am using VAT (icnluded in the price - 25%), the price of the item I'm trying to purchase is 265 EUR (the currecy does not matter), item quantity is 1 and the shipping is 15EUR (again vat is included in shipping price) this is flat order tax. 以下是我用来重现问题的价值:我使用增值税(价格中只包含25%),我试图购买的商品的价格是265欧元(当前无关紧要),商品数量为1,运费为15EUR(再次增值税包含在运费中)这是固定订单税。

I get the error that order total does not match summed items amount. 我收到订单总数与总计项目金额不匹配的错误。 After some debugging i found that indeed those are different before sending to PayPal. 经过一些调试后,我发现在发送到PayPal之前确实存在差异。

Why are is my total calculated wrong? 为什么我的总计算错了? I'm using the 1-2-stable branch of spree. 我正在使用1-2稳定的狂欢分支。 My gemfile: 我的gemfile:

gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-2-stable'
#gem 'spree_usa_epay'
#gem 'spree_skrill'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-2-stable'
gem 'spree_paypal_express', :github => 'spree/spree_paypal_express', :branch => '1-2-stable'

My real question is how do I recalculate shipping and taxes just before the payment step (after the delivery step) and also how do I override the calculators so that they calculate correctly? 我真正的问题是如何在付款步骤之前(交货步骤之后)重新计算运费和税金,以及如何覆盖计算器以便正确计算?

After lots of debugging I found few bugs with the spree_paypal_express gem. 经过大量的调试后,我发现了一些spree_paypal_express gem的bug。

  1. if the tax is negative (VAT is included in the price and is refunded for non-EU orders) then PayPal rejects the order because of invalid tax 如果税收是负数(增值税包含在价格中并且退还给非欧盟订单),那么PayPal会因为税收无效而拒绝该订单
  2. it turned out that the shipping method in spree_paypal_express is hard-coded. 事实证明,spree_paypal_express中的送货方法是硬编码的。 It always picks up the first inserted in the DB instead of the one selected by the customer (this bug would appear if you have multiple shipping options) 它总是选择插入数据库中的第一个而不是客户选择的数据库(如果您有多个发货选项,则会出现此错误)

those issues combined were causing checkout problems. 这些问题加在一起导致结账问题。

For the first issue i set opts[:tax] = 0 when the tax is negative and for the second implemented logic which gets the selected shipping method (with the corresponding price) instead of the hard-coded one. 对于第一个问题,我在税收为负时设置opts[:tax] = 0 ,对于获得选定的运输方法(具有相应价格)而不是硬编码的第二个实现逻辑设置opts[:tax] = 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM