Gift support changes
This commit is contained in:
@@ -44,7 +44,9 @@ end
|
||||
|
||||
update_delivery_destination = ->() {
|
||||
cart = Cart.just_find(anonymous_id, logged_in_user_id)
|
||||
allowed_keys = ["name", "address", "place", "postal_code", "phone", "email", "note", "payment_method", "gift"]
|
||||
allowed_keys = ["name", "address", "place", "postal_code", "phone", "email", "note", "payment_method", "gift",
|
||||
"recipient_name", "recipient_address", "recipient_place", "recipient_postal_code", "recipient_phone", "recipient_email"]
|
||||
|
||||
params = @json_params.reject { |key,_| !allowed_keys.include?(key) }
|
||||
cart.delivery_destination.update_attributes(params)
|
||||
cart.delivery_destination.save!
|
||||
@@ -53,22 +55,6 @@ update_delivery_destination = ->() {
|
||||
put '/cart/delivery_destination', &update_delivery_destination
|
||||
post '/cart/delivery_destination', &update_delivery_destination
|
||||
|
||||
get '/cart/recipient_destination' do
|
||||
cart = Cart.just_find(anonymous_id, logged_in_user_id)
|
||||
cart.recipient.to_json(:except => [:created_at, :email_verification_code, :phone_verification_code])
|
||||
end
|
||||
|
||||
update_recipient_destination = ->() {
|
||||
cart = Cart.just_find(anonymous_id, logged_in_user_id)
|
||||
allowed_keys = ["name", "address", "place", "postal_code", "phone", "email"]
|
||||
params = @json_params.reject { |key,_| !allowed_keys.include?(key) }
|
||||
cart.recipient_destination.update_attributes(params)
|
||||
cart.recipient_destination.save!
|
||||
cart.recipient_destination.to_json(:except => [:created_at, :email_verification_code, :phone_verification_code])
|
||||
}
|
||||
put '/cart/recipient_destination', &update_delivery_destination
|
||||
post '/cart/recipient_destination', &update_delivery_destination
|
||||
|
||||
def report_to_trello(cart)
|
||||
Thread.new do
|
||||
@cart = cart
|
||||
|
||||
Reference in New Issue
Block a user