Closed niceking closed 1 year ago
I am not the maintainer but I have been working with this extension a lot, right now I did a checkout using a guest in both the frontend and backend and it just works (using master branch). What version you are using and what is the stack trace you are seeing ?.
[39] pry(main)> Spree::Order.last.user
Spree::Order Load (0.7ms) SELECT "spree_orders".* FROM "spree_orders" ORDER BY "spree_orders"."id" DESC LIMIT 1
=> nil
[40] pry(main)> Spree::Order.last.payments.first.source.gateway_payment_profile_id
Spree::Order Load (0.6ms) SELECT "spree_orders".* FROM "spree_orders" ORDER BY "spree_orders"."id" DESC LIMIT 1
Spree::Payment Load (0.3ms) SELECT "spree_payments".* FROM "spree_payments" WHERE "spree_payments"."order_id" = $1 ORDER BY "spree_payments"."created_at" ASC LIMIT 1 [["order_id", 3]]
Spree::CreditCard Load (0.3ms) SELECT "spree_credit_cards".* FROM "spree_credit_cards" WHERE "spree_credit_cards"."id" = $1 LIMIT 1 [["id", 3]]
=> "992s6g"
[41] pry(main)> Spree::Order.last.payments.first.source.user_id
Spree::Order Load (0.6ms) SELECT "spree_orders".* FROM "spree_orders" ORDER BY "spree_orders"."id" DESC LIMIT 1
Spree::Payment Load (0.3ms) SELECT "spree_payments".* FROM "spree_payments" WHERE "spree_payments"."order_id" = $1 ORDER BY "spree_payments"."created_at" ASC LIMIT 1 [["order_id", 3]]
Spree::CreditCard Load (0.3ms) SELECT "spree_credit_cards".* FROM "spree_credit_cards" WHERE "spree_credit_cards"."id" = $1 LIMIT 1 [["id", 3]]
=> nil
A customer profile id is always created without regard that customer is a user or guest
I think you are using an older version that does not have this bug fix from this commit: https://github.com/solidusio/solidus_braintree/commit/d67fccab20d7f5f7dadf1162348563bc3e5432eb
Ahhh yes I'm using the latest gem release so this change hasn't come through yet. Doesn't that mean that the customer profile is always created then, if it's enabled? Is that intended behaviour if the user is checking out as a guest?
@niceking did you ever get your questions answered about this issue?
When using the braintree integration in the admin backend, it tries (and fails) to create a customer profile when checking out as guest, as there is no user attached to the order. Is this intended behaviour?