Closed rramsden closed 8 years ago
@shioyama Think you could take a look? This just fixes the views in spree admin. There are a few other bugs related to "capturing" and "voiding" payments which I'll look into now.
@camelmasa's going to have a look at it.
@rramsden > This just fixes the views in spree admin
I confirmed that. Yes, that was fixed now. Please continue to investigate for fix other bugs.
@rramsden I checked that failed payment's prepaid number will be blank.
Related those bugs :question: I don't know that.
@camelmasa is that a bug or a feature? haha
I'm getting an error about a missing method with_public_profile
in Spree::Konbini
on the new payments page, maybe my setup is different, just posting here for now:
I'm not really sure maybe our setups are different, but when I started working on this I had to mess around with the reusable_sources
method which is called in the payment form here. I'm not sure how it would render without doing something about that because reusable_sources calls sources_by_order
which assumes there is a scope with_payment_profile
on the source (which does not exist for alternative payment methods). I had to add something there to get this view to render correctly for me.
Maybe my setup was different, are you testing with enable_customer_profiles
on or off? I'll keep digging.
So I find that if I add these scopes + method to all Komoju payment methods (other than credit card) the issue is gone:
scope :with_payment_profile, -> {}
scope :default, -> {}
def reusable_sources
[]
end
And actually about the latter method Spree mentions in a comment in the code that this should be overridden for custom gateways, so this makes sense, but I still don't understand how you guys didn't see it. Maybe our versions of spree or something are different? I'm running 3-0-stable (from the github branch), maybe that's the difference.
Confirmed that I see the error with 3.0.4 as well, fixed with the method added.
I also find that clicking "capture" on say a konbini payment does try to go to the gateway to capture it, but since there is no capture
method on the activemerchant gateway it errors and falls through to capture(stream)
in activesupport.
But actually I also see that when I create the konbini payment from the admin it does create it on Komoju, see below:
I can't capture it because of the issue above but that should just be a matter of aliasing capture
to purchase
or something in the konbini gateway. Not sure why we're seeing different things...
So adding a method capture
to the am gateway allows you to capture a konbini payment that has been authorized on komoju:
def capture(money, payment, options = {})
Response.new(true, "force captured")
end
Of course this does not mark the payment as captured on Komoju because we have no endpoint for doing that (normally it would only be captured when the customer actually pays, and in this case nobody has actually paid). So not sure if we actually want to allow this, but it does seem to work for me as expected.
Actually I think we can just return false
from can_capture?
for all asynchronous methods (konbini, bank transfer, payeasy), since you should not be able to capture them manually from spree anywhere (just through the callback, which uses payment.complete!
which is not affected by can_capture?
). That way the capture buttons will not show for those payment methods and we don't have to worry about it.
We can also get rid of the void buttons for these payment methods by changing can_void?
to just return false
always.
@shioyama thanks I was also thinking of just returning can_capture?
since we can't capture directly from spree (they should be captured in Komoju). I will also set can_void?
to false since out gateway doesn't support authorization/voiding.
@rramsden actually also just redefining actions
to remove those should do it I think.
@shioyama I've removed void
and capture
actions from alternative payments
Thanks!
This pull requests adds missing source views for CreditCard, Konbini, BankTransfer, WebMoney, and PayEasy. I've managed to recycle the checkout forms used when creating payments in the spree admin dashboard.
A few bugs I found and fixed when adding these forms:
frontend.js
. I've inlined the Javascript to be included with the webmoney partial nowcan_capture?
was callingexpires_at
which the webmoney tables doesn't have because its a synchronous payment method.TODO