Sha256: dc436c003fba0846b9c01477b52924ccdb5f3bf5785bf982ef49a6c60348d519
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
class DelayedSubscriberUpdate < Struct.new(:token, :order_id) def perform order = Spree::Order.find(order_id) if order.user.nil? email=order.email user_id='' else user=order.user.reload #reload the user to be sure we have the most uptodate record email=user.email user_id=order.user.id end if email.length > 0 begin address=order.bill_address fields={ # these fields neeb be created in bronto, otherwise they won't get updated. :customer_id => user_id, :firstname => address.firstname, :lastname => address.lastname, :address1 => address.address1, :address2 => address.address2, :phone_home => address.phone, :postal_code => address.zipcode, :city => address.city, :state_province => (address.state_id.nil? ? address.state_name.to_s : address.state.name), :country => address.country.name } contact = BrontoIntegration::Contact.new(token) contacts=contact.set_up(email,fields) rescue => exception # should just send email to operations and go ahead #raise exception end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_bronto-3.0.0 | lib/delayed_subscriber_update.rb |