You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a customer return and choose a reimbursement of type "Store Credit".
Perform the reimbursement.
Expected behavior
A StoreCredit should be created (table spree_store_credits) and linked to from Reimbursement::Credit (table spree_reimbursement_credits).
Actual behavior
The StoreCredit creation fails without generating any error.
There is no line added to the spree_store_credits table.
The creditable_id column in the spree_reimbursement_credits table is nil.
Explanation
The StoreCredit creation is made in Spree::ReimbursementType::ReimbursementHelpers #create_creditable method.
def create_creditable(reimbursement, unpaid_amount)
Spree::Reimbursement::Credit.default_creditable_class.new(
user: reimbursement.order.user,
amount: unpaid_amount,
category: Spree::StoreCreditCategory.reimbursement_category(reimbursement),
created_by: Spree::StoreCredit.default_created_by,
memo: "Refund for uncreditable payments on order #{reimbursement.order.number}",
currency: reimbursement.order.currency
)
end
This method uses Spree::StoreCredit.default_created_by to retrieve the user creating the store credit.
class << self
def default_created_by
Spree.user_class.find_by(email: DEFAULT_CREATED_BY_EMAIL)
end
end
The DEFAULT_CREATED_BY constant is hidden in the Spree::StoreCredit class and equals to [email protected].
If there is no such user, the StoreCredit creation fails.
Solution
Retrieve the actual logged in user or move the DEFAULT_CREATED_BY_EMAIL to a preference settings.
System configuration
Solidus Version: v2.6.0.rc1
Extensions in use: none (solidus ummy_app)
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Create a customer return and choose a reimbursement of type "Store Credit".
Perform the reimbursement.
Expected behavior
A StoreCredit should be created (table
spree_store_credits
) and linked to from Reimbursement::Credit (tablespree_reimbursement_credits
).Actual behavior
The StoreCredit creation fails without generating any error.
There is no line added to the spree_store_credits table.
The creditable_id column in the spree_reimbursement_credits table is nil.
Explanation
The StoreCredit creation is made in
Spree::ReimbursementType::ReimbursementHelpers #create_creditable
method.This method uses
Spree::StoreCredit.default_created_by
to retrieve the user creating the store credit.The
DEFAULT_CREATED_BY
constant is hidden in the Spree::StoreCredit class and equals to[email protected]
.If there is no such user, the StoreCredit creation fails.
Solution
Retrieve the actual logged in user or move the
DEFAULT_CREATED_BY_EMAIL
to a preference settings.System configuration
Solidus Version: v2.6.0.rc1
Extensions in use: none (solidus ummy_app)
The text was updated successfully, but these errors were encountered: