Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find gift card for auth code when capturing in admin #31

Open
joeswann opened this issue Nov 21, 2016 · 2 comments
Open

Could not find gift card for auth code when capturing in admin #31

joeswann opened this issue Nov 21, 2016 · 2 comments

Comments

@joeswann
Copy link

Me again sorry. Still very unfamiliar with this code so could be very far off the mark with this.

What I am seeing

  • When attempting to capture payment during 'checkout' state I get Could not find gift card for auth code: 23-GC-20161121031428191325 for action: capture
  • I am also seeing the payment as not captured when setting Auto capture to true under payment settings and doing a partial payment. This may be by design as auto_capture may assume a full payment and therefore run after the payment step completes?

So steps to recreate the first issue should be

  • Spree 3.1
  • Create a new gift card in admin
  • Add item to cart, proceed through checkout
  • Apply Gift Card using the payment step
  • Attempt to 'capture' payment in admin before proceeding

Notes:

  • The error is generated by app/models/spree/payment_method/gift_card.rb#91
  • The error appears to be happening because it's attempting to find (capture) a GiftCardTransaction with the authorization code that doesn't exist (the code does exist on the GiftCard though)
  • The transaction is not generated when adding the gift_card because Spree::Order::GiftCard.add_gift_card_payments only generates a payment (with an auth code attached)

The reason I am trying to capture/auto capture is in order to have a correct remaining total (outstanding_total) to send to an offsite payment method when using a gift card for a partial sale.

@joeswann
Copy link
Author

Update on this - I'm actually updating better_spree_paypal_express to take other (pending) payments into account when calculating it's totals.

I'm still not sure if it should be possible to capture the gift card before finalising payment though.

@pikender
Copy link

pikender commented Feb 1, 2017

@joeswann Have you found the solution to above or took some other workaround ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants