为什么Payments.valid.first.source对于Spree :: Order返回nil的某些原因?

问题描述 投票:0回答:1

Spree电子商务3.3.0Rails 5.1Ruby 2.5.7

我正在尝试取消为订单付款的选择。在Spree :: OrdersController中,我正在使用:

payments.valid.first&.source

请注意,付款是Spree :: Payment ::信用卡的阵列-不是Spree :: Payment :: Check。

ruby-on-rails-5 spree
1个回答
0
投票

这完全取决于您使用的支付网关。即使它是基于CC的支付网关,也有一些不能将CC作为Spree的来源。

[Spree中的每种付款方式都有一种称为source_required?https://github.com/spree/spree/blob/a01ffd29b73f75cb234fcf5d368fb23553acf4d1/core/app/models/spree/payment_method.rb#L49]的方法>

您应检查使用的那个是否返回true

© www.soinside.com 2019 - 2024. All rights reserved.