Last active
January 5, 2024 17:01
-
-
Save victor-tremendous/a33eff6ec0e6c47e5daeb2fd9ca33c90 to your computer and use it in GitHub Desktop.
Revert Tillo launch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Xoxoday, Tillo tokens (in that order) | |
product_tokens = { | |
flipkart: %w(GYBBFQT9VVE2 TRI1BRZSKN7P), | |
nykaa: %w(BY1L4C8B8DN5 SH1PWSYC61F3) | |
} | |
product_tokens.each do |product_name, (xoxoday_token, tillo_token)| | |
xoxoday_product = Product.find_by(public_token: xoxoday_token) | |
tillo_product = Product.find_by(public_token: tillo_token) | |
fail "Loaded wrong product" if xoxoday_product.productable.provider != "xoxoday_provider" || tillo_product.productable.provider != "tillo_provider" | |
product_equivalency = ProductEquivalency.find_by!(product: xoxoday_product, equivalent_product: tillo_product) | |
with_write_connection do | |
product_equivalency.update!(product: tillo_product, equivalent_product: xoxoday_product) | |
tillo_product.productable.inactive! | |
xoxoday_product.productable.active! | |
end | |
fail "Tillo product still active!" if tillo_product.reload.active? | |
fail "Xoxoday product still inactive!" if xoxoday_product.reload.inactive? | |
puts "Configured #{product_name}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment