spree_mercado_pago_payment_method 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/javascripts/{admin → spree/admin}/spree_mercado_pago_payment_method.js +0 -0
- data/app/assets/javascripts/spree/frontend/spree_mercado_pago_payment_method.js +25 -0
- data/app/controllers/spree/mercado_pago_controller.rb +53 -31
- data/app/models/mercado_pago/client.rb +63 -0
- data/app/models/mercado_pago/client/api.rb +43 -0
- data/app/models/mercado_pago/client/authentication.rb +36 -0
- data/app/models/mercado_pago/client/preferences.rb +20 -0
- data/app/models/mercado_pago/notification.rb +8 -0
- data/app/models/mercado_pago/order_preferences_builder.rb +68 -0
- data/app/models/spree/payment_method/mercado_pago.rb +46 -0
- data/app/services/mercado_pago/handle_received_notification.rb +18 -0
- data/app/services/mercado_pago/process_notification.rb +54 -0
- data/app/views/spree/checkout/payment/_mercadopago.html.erb +15 -1
- data/config/locales/en.yml +3 -12
- data/config/locales/es.yml +3 -13
- data/config/routes.rb +5 -7
- data/lib/generators/spree_mercado_pago_payment_method/install/install_generator.rb +15 -10
- data/lib/spree_mercado_pago_payment_method.rb +1 -0
- data/lib/spree_mercado_pago_payment_method/engine.rb +1 -2
- data/lib/tasks/mercado_user.rake +0 -1
- data/spec/controllers/spree/mercado_pago_controller_spec.rb +18 -76
- data/spec/dummy/README.rdoc +15 -248
- data/spec/dummy/Rakefile +1 -2
- data/spec/dummy/app/assets/stylesheets/application.css +5 -3
- data/spec/dummy/app/controllers/application_controller.rb +3 -1
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/config/application.rb +0 -36
- data/spec/dummy/config/database.yml +3 -5
- data/spec/dummy/config/environment.rb +3 -5
- data/spec/dummy/config/environments/development.rb +19 -19
- data/spec/dummy/config/environments/production.rb +41 -30
- data/spec/dummy/config/environments/test.rb +3 -6
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/devise.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +6 -5
- data/spec/dummy/config/initializers/mime_types.rb +0 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -6
- data/spec/dummy/config/initializers/spree.rb +4 -4
- data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/spec/dummy/config/locales/en.yml +20 -2
- data/spec/dummy/config/routes.rb +8 -2
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/spree.yml +1 -1
- data/spec/dummy/db/migrate/20141112193407_spree_one_two.spree.rb +482 -0
- data/spec/dummy/db/migrate/20141112193408_spree_promo_one_two.spree.rb +46 -0
- data/spec/dummy/db/migrate/{20121121030242_add_tax_rate_label.spree.rb → 20141112193409_add_tax_rate_label.spree.rb} +0 -0
- data/spec/dummy/db/migrate/{20121121030243_add_toggle_tax_rate_display.spree.rb → 20141112193410_add_toggle_tax_rate_display.spree.rb} +0 -0
- data/spec/dummy/db/migrate/20141112193411_remove_unused_preference_columns.spree.rb +9 -0
- data/spec/dummy/db/migrate/{20121121030244_add_lock_version_to_variant.spree.rb → 20141112193412_add_lock_version_to_variant.spree.rb} +0 -0
- data/spec/dummy/db/migrate/20141112193413_add_states_required_to_countries.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193414_add_on_demand_to_product_and_variant.spree.rb +7 -0
- data/spec/dummy/db/migrate/{20121121030245_remove_not_null_constraint_from_products_on_hand.spree.rb → 20141112193415_remove_not_null_constraint_from_products_on_hand.spree.rb} +0 -0
- data/spec/dummy/db/migrate/20141112193416_split_prices_from_variants.spree.rb +32 -0
- data/spec/dummy/db/migrate/20141112193417_remove_not_null_from_spree_prices_amount.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193418_add_currency_to_line_items.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193419_add_currency_to_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193420_add_cost_currency_to_variants.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193421_remove_display_on_from_payment_methods.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193422_add_position_to_taxonomies.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193423_add_last_ip_to_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193424_add_state_to_spree_adjustments.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193425_add_display_on_to_spree_payment_methods.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193426_add_position_to_product_properties.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193427_add_identifier_to_spree_payments.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193428_add_order_id_index_to_payments.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193429_add_primary_to_spree_products_taxons.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193430_create_spree_stock_items.spree.rb +15 -0
- data/spec/dummy/db/migrate/20141112193431_create_spree_stock_locations.spree.rb +12 -0
- data/spec/dummy/db/migrate/20141112193432_create_default_stock.spree.rb +31 -0
- data/spec/dummy/db/migrate/20141112193433_add_order_id_index_to_shipments.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193434_change_meta_description_on_spree_products_to_text.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193435_add_stock_location_id_to_spree_shipments.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193436_add_pending_to_inventory_unit.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193437_remove_on_demand_from_product_and_variant.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193438_create_shipping_method_zone.spree.rb +23 -0
- data/spec/dummy/db/migrate/20141112193439_remove_shipping_category_id_from_shipping_method.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193440_create_shipping_method_categories.spree.rb +14 -0
- data/spec/dummy/db/migrate/20141112193441_add_tracking_url_to_spree_shipping_methods.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193442_create_spree_shipping_rates.spree.rb +25 -0
- data/spec/dummy/db/migrate/20141112193443_remove_category_match_attributes_from_shipping_method.spree.rb +8 -0
- data/spec/dummy/db/migrate/20141112193444_create_stock_movements.spree.rb +13 -0
- data/spec/dummy/db/migrate/20141112193445_add_address_fields_to_stock_location.spree.rb +23 -0
- data/spec/dummy/db/migrate/20141112193446_add_active_field_to_stock_locations.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193447_add_backorderable_to_stock_item.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193448_add_default_quantity_to_stock_movement.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193449_add_source_and_destination_to_stock_movements.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193450_change_orders_total_precision.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193451_change_spree_payments_amount_precision.spree.rb +8 -0
- data/spec/dummy/db/migrate/20141112193452_change_spree_return_authorization_amount_precision.spree.rb +8 -0
- data/spec/dummy/db/migrate/20141112193453_change_adjustments_amount_precision.spree.rb +8 -0
- data/spec/dummy/db/migrate/20141112193454_add_originator_to_stock_movement.spree.rb +8 -0
- data/spec/dummy/db/migrate/20141112193455_drop_source_and_destination_from_stock_movement.spree.rb +16 -0
- data/spec/dummy/db/migrate/20141112193456_migrate_inventory_unit_sold_to_on_hand.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193457_add_stock_location_to_rma.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193458_update_shipment_state_for_canceled_orders.spree.rb +16 -0
- data/spec/dummy/db/migrate/20141112193459_add_seo_metas_to_taxons.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193460_remove_stock_item_and_variant_lock.spree.rb +15 -0
- data/spec/dummy/db/migrate/20141112193461_add_name_to_spree_credit_cards.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193462_update_name_fields_on_spree_credit_cards.spree.rb +14 -0
- data/spec/dummy/db/migrate/20141112193463_add_index_to_source_columns_on_adjustments.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193464_update_adjustment_states.spree.rb +17 -0
- data/spec/dummy/db/migrate/20141112193465_add_shipping_rates_to_shipments.spree.rb +16 -0
- data/spec/dummy/db/migrate/20141112193466_create_spree_stock_transfers.spree.rb +15 -0
- data/spec/dummy/db/migrate/20141112193467_drop_products_count_on_hand.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193468_set_default_shipping_rate_cost.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193469_add_number_to_stock_transfer.spree.rb +24 -0
- data/spec/dummy/db/migrate/20141112193470_add_sku_index_to_spree_variants.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193471_add_backorderable_default_to_spree_stock_location.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193472_add_propage_all_variants_to_spree_stock_location.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193473_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb +11 -0
- data/spec/dummy/db/migrate/20141112193474_add_user_id_index_to_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193475_add_updated_at_to_spree_countries.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193476_add_updated_at_to_spree_states.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193477_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193478_add_unique_index_to_permalink_on_spree_products.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193479_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb +8 -0
- data/spec/dummy/db/migrate/20141112193480_add_deleted_at_to_spree_tax_rates.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193481_remove_lock_version_from_inventory_units.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193482_add_cost_price_to_line_item.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193483_set_backorderable_to_default_to_false.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193484_add_created_by_id_to_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193485_index_completed_at_on_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193486_add_tax_category_id_to_spree_line_items.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193487_migrate_tax_categories_to_line_items.spree.rb +11 -0
- data/spec/dummy/db/migrate/20141112193488_drop_spree_mail_methods.spree.rb +13 -0
- data/spec/dummy/db/migrate/20141112193489_set_default_stock_location_on_shipments.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193490_upgrade_adjustments.spree.rb +40 -0
- data/spec/dummy/db/migrate/20141112193491_rename_adjustment_fields.spree.rb +15 -0
- data/spec/dummy/db/migrate/20141112193492_add_admin_name_column_to_spree_shipping_methods.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193493_add_admin_name_column_to_spree_stock_locations.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193494_add_shipment_total_to_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193495_expand_order_number_size.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193496_rename_activators_to_promotions.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193497_add_adjustment_total_to_line_items.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193498_add_adjustment_total_to_shipments.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193499_add_depth_to_spree_taxons.spree.rb +17 -0
- data/spec/dummy/db/migrate/20141112193500_add_tax_total_to_line_items_shipments_and_orders.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193501_add_shipping_category_to_shipping_methods_and_products.spree.rb +16 -0
- data/spec/dummy/db/migrate/20141112193502_migrate_old_shipping_calculators.spree.rb +20 -0
- data/spec/dummy/db/migrate/20141112193503_add_code_to_spree_promotion_rules.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193504_change_states_required_for_countries.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193505_add_deleted_at_to_spree_stock_items.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193506_remove_promotions_event_name_field.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193507_add_promo_total_to_line_items_and_shipments_and_orders.spree.rb +8 -0
- data/spec/dummy/db/migrate/20141112193508_remove_unused_credit_card_fields.spree.rb +17 -0
- data/spec/dummy/db/migrate/20141112193509_add_track_inventory_to_variant.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193510_add_tax_category_to_variants.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193511_add_channel_to_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193512_add_included_to_adjustments.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193513_rename_tax_total_fields.spree.rb +12 -0
- data/spec/dummy/db/migrate/20141112193514_add_line_item_id_to_spree_inventory_units.spree.rb +22 -0
- data/spec/dummy/db/migrate/20141112193515_add_updated_at_to_variants.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193516_add_position_to_classifications.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193517_create_spree_orders_promotions.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193518_unique_shipping_method_categories.spree.rb +25 -0
- data/spec/dummy/db/migrate/20141112193519_add_item_count_to_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193520_remove_value_type_from_spree_preferences.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193521_rename_permalink_to_slug_for_products.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193522_add_index_to_variant_id_and_currency_on_prices.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193523_rename_activator_id_in_rules_and_actions_to_promotion_id.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193524_add_deleted_at_to_spree_prices.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193525_add_approver_id_and_approved_at_to_orders.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193526_add_confirmation_delivered_to_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193527_add_auto_capture_to_payment_methods.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193528_create_spree_payment_capture_events.spree.rb +13 -0
- data/spec/dummy/db/migrate/20141112193529_add_uncaptured_amount_to_payments.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193530_default_variant_weight_to_zero.spree.rb +12 -0
- data/spec/dummy/db/migrate/20141112193531_add_tax_category_id_to_shipping_methods.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193532_add_tax_rate_id_to_shipping_rates.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193533_add_pre_tax_amount_to_line_items_and_shipments.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193534_add_more_indexes.spree.rb +14 -0
- data/spec/dummy/db/migrate/20141112193535_add_considered_risky_to_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193536_add_preference_store_to_everything.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193537_add_user_id_to_spree_credit_cards.spree.rb +14 -0
- data/spec/dummy/db/migrate/20141112193538_migrate_old_preferences.spree.rb +24 -0
- data/spec/dummy/db/migrate/20141112193539_create_spree_stores.spree.rb +26 -0
- data/spec/dummy/db/migrate/20141112193540_create_store_from_preferences.spree.rb +31 -0
- data/spec/dummy/db/migrate/20141112193541_add_timestamps_to_spree_assets.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193542_add_additional_store_fields.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193543_add_many_missing_indexes.spree.rb +19 -0
- data/spec/dummy/db/migrate/20141112193544_correct_some_polymorphic_index_and_add_more_missing.spree.rb +67 -0
- data/spec/dummy/db/migrate/20141112193545_add_user_id_created_by_id_index_to_order.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193546_change_spree_price_amount_precision.spree.rb +9 -0
- data/spec/dummy/db/migrate/20141112193547_add_token_to_spree_orders.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193548_move_order_token_from_tokenized_permission.spree.rb +30 -0
- data/spec/dummy/db/migrate/20141112193549_set_shipment_total_for_users_upgrading.spree.rb +11 -0
- data/spec/dummy/db/migrate/20141112193550_drop_credit_card_first_name_and_last_name.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193551_add_deleted_at_to_spree_promotion_actions.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193552_remove_uncaptured_amount_from_spree_payments.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193553_add_default_to_shipment_cost.spree.rb +11 -0
- data/spec/dummy/db/migrate/20141112193554_default_pre_tax_amount_should_be_zero.spree.rb +7 -0
- data/spec/dummy/db/migrate/20141112193555_add_state_lock_version_to_order.spree.rb +6 -0
- data/spec/dummy/db/migrate/20141112193556_fix_adjustment_order_presence.spree.rb +14 -0
- data/spec/dummy/db/migrate/20141112193557_update_classifications_positions.spree.rb +10 -0
- data/spec/dummy/db/migrate/20141112193558_add_api_key_to_spree_users.spree_api.rb +8 -0
- data/spec/dummy/db/migrate/20141112193559_resize_api_key_field.spree_api.rb +8 -0
- data/spec/dummy/db/migrate/20141112193560_rename_api_key_to_spree_api_key.spree_api.rb +8 -0
- data/spec/dummy/db/migrate/20141112193561_add_index_to_user_spree_api_key.spree_api.rb +8 -0
- data/spec/dummy/db/migrate/{20121121030246_create_users.spree_auth.rb → 20141112193562_create_users.spree_auth.rb} +0 -0
- data/spec/dummy/db/migrate/{20121121030247_rename_columns_for_devise.spree_auth.rb → 20141112193563_rename_columns_for_devise.spree_auth.rb} +0 -0
- data/spec/dummy/db/migrate/{20121121030248_convert_user_remember_field.spree_auth.rb → 20141112193564_convert_user_remember_field.spree_auth.rb} +0 -0
- data/spec/dummy/db/migrate/{20121121030249_add_reset_password_sent_at_to_spree_users.spree_auth.rb → 20141112193565_add_reset_password_sent_at_to_spree_users.spree_auth.rb} +0 -0
- data/spec/dummy/db/migrate/{20121121030250_make_users_email_index_unique.spree_auth.rb → 20141112193566_make_users_email_index_unique.spree_auth.rb} +0 -0
- data/spec/dummy/db/migrate/20141202172111_create_spree_mercado_pago_notifications.spree_mercado_pago_payment_method_engine.rb +10 -0
- data/spec/dummy/db/schema.rb +581 -260
- data/spec/dummy/db/seeds.rb +2 -2
- data/spec/dummy/db/spree_development.sqlite3 +0 -0
- data/spec/dummy/db/spree_test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +27822 -1376
- data/spec/dummy/log/test.log +87064 -37048
- data/spec/dummy/public/404.html +54 -13
- data/spec/dummy/public/422.html +54 -13
- data/spec/dummy/public/500.html +53 -12
- data/spec/dummy/tmp/cache/17E/D61/spree%2Fapp_configuration%2Fdefault_seo_title +1 -0
- data/spec/dummy/tmp/cache/2CC/B21/spree%2Fapp_configuration%2Frequire_master_price +1 -0
- data/spec/dummy/tmp/cache/334/AA1/spree%2Fapp_configuration%2Fdefault_meta_keywords +1 -0
- data/spec/dummy/tmp/cache/397/F31/spree%2Fapp_configuration%2Fbinary_inventory_cache +1 -0
- data/spec/dummy/tmp/cache/39C/F91/spree%2Fapp_configuration%2Ftax_using_ship_address +1 -0
- data/spec/dummy/tmp/cache/3A7/4A1/spree%2Fapp_configuration%2Faddress_requires_state +1 -0
- data/spec/dummy/tmp/cache/3B7/CD1/spree%2Fapp_configuration%2Fredirect_https_to_http +1 -0
- data/spec/dummy/tmp/cache/3BE/851/spree%2Fapp_configuration%2Ftrack_inventory_levels +1 -0
- data/spec/dummy/tmp/cache/460/D81/spree%2Fapp_configuration%2Fdefault_meta_description +1 -0
- data/spec/dummy/tmp/cache/5AE/6A1/spree%2Fapp_configuration%2Falways_include_confirm_step +1 -0
- data/spec/dummy/tmp/cache/DD9/320/spree%2Fapp_configuration%2Fsite_url +1 -0
- data/spec/dummy/tmp/cache/DDD/2D0/spree%2Fapp_configuration%2Fcurrency +1 -0
- data/spec/dummy/tmp/cache/E27/320/spree%2Fapp_configuration%2Fsite_name +1 -0
- data/spec/dummy/tmp/cache/E9B/7F0/spree%2Fapp_configuration%2Fmails_from +1 -0
- data/spec/dummy/tmp/cache/F01/FD0/spree%2Ffrontend_configuration%2Flocale +1 -0
- data/spec/dummy/{app/assets/javascripts/admin → vendor/assets/javascripts/spree/backend}/all.js +2 -1
- data/spec/dummy/{app/assets/javascripts/store → vendor/assets/javascripts/spree/frontend}/all.js +2 -1
- data/spec/dummy/{app/assets/stylesheets/admin → vendor/assets/stylesheets/spree/backend}/all.css +2 -1
- data/spec/dummy/{app/assets/stylesheets/store → vendor/assets/stylesheets/spree/frontend}/all.css +2 -1
- data/spec/models/mercado_pago/client_spec.rb +138 -0
- data/spec/models/mercado_pago/notification_spec.rb +17 -0
- data/spec/models/mercado_pago/order_preferences_builder_spec.rb +66 -0
- data/spec/services/mercado_pago/process_notification_spec.rb +57 -0
- data/spec/spec_helper.rb +12 -53
- metadata +444 -328
- data/app/assets/javascripts/store/spree_mercado_pago_payment_method.js +0 -1
- data/app/controllers/spree/checkout_controller_decorator.rb +0 -29
- data/app/models/payment_method/mercado_pago.rb +0 -33
- data/app/models/spree_mercado_pago_client.rb +0 -102
- data/app/views/spree/mercado_pago/failure.html.erb +0 -1
- data/app/views/spree/mercado_pago/pending.html.erb +0 -1
- data/app/views/spree/mercado_pago/success.html.erb +0 -1
- data/spec/controllers/spree/checkout_controller_spec.rb +0 -57
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/db/migrate/20121121030140_spree_zero_nine_zero.spree.rb +0 -392
- data/spec/dummy/db/migrate/20121121030141_create_indexes_for_inventory_units.spree.rb +0 -7
- data/spec/dummy/db/migrate/20121121030142_add_count_on_hand_to_variants_and_products.spree.rb +0 -50
- data/spec/dummy/db/migrate/20121121030143_change_taxons_to_nested_set.spree.rb +0 -47
- data/spec/dummy/db/migrate/20121121030144_move_to_configurable_gateways.spree.rb +0 -55
- data/spec/dummy/db/migrate/20121121030145_add_open_id_authentication_tables.spree.rb +0 -16
- data/spec/dummy/db/migrate/20121121030146_add_openid_field_to_users.spree.rb +0 -27
- data/spec/dummy/db/migrate/20121121030147_change_preference_value_type.spree.rb +0 -11
- data/spec/dummy/db/migrate/20121121030148_create_billing_integrations.spree.rb +0 -13
- data/spec/dummy/db/migrate/20121121030149_charge_refactoring.spree.rb +0 -40
- data/spec/dummy/db/migrate/20121121030150_add_some_indexes.spree.rb +0 -12
- data/spec/dummy/db/migrate/20121121030151_checkout_state_machine.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030152_state_for_shipments.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030153_make_state_events_polymorphic.spree.rb +0 -13
- data/spec/dummy/db/migrate/20121121030154_ship_address_id_for_checkouts.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030155_shipping_method_id_for_checkouts.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030156_creditcard_last_four_digits.spree.rb +0 -15
- data/spec/dummy/db/migrate/20121121030157_populate_legacy_shipment_state.spree.rb +0 -16
- data/spec/dummy/db/migrate/20121121030158_add_cost_price.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030159_shipment_id_for_inventory_units.spree.rb +0 -26
- data/spec/dummy/db/migrate/20121121030160_cim_fields_for_creditcards.spree.rb +0 -7
- data/spec/dummy/db/migrate/20121121030161_create_return_authorizations.spree.rb +0 -13
- data/spec/dummy/db/migrate/20121121030162_add_return_authorization_to_inventory_units.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030163_create_trackers.spree.rb +0 -11
- data/spec/dummy/db/migrate/20121121030164_creditcard_id_for_creditcard_txns.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030165_original_creditcard_txn_id_for_creditcard_txns.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030166_add_test_mode_to_billing_integration.spree.rb +0 -7
- data/spec/dummy/db/migrate/20121121030167_create_payment_methods.spree.rb +0 -17
- data/spec/dummy/db/migrate/20121121030168_polymorphic_payments.spree.rb +0 -43
- data/spec/dummy/db/migrate/20121121030169_change_payments_payment_method_to_belongs_to.spree.rb +0 -12
- data/spec/dummy/db/migrate/20121121030170_assign_creditcard_txns_to_payment.spree.rb +0 -24
- data/spec/dummy/db/migrate/20121121030171_sti_for_transactions.spree.rb +0 -16
- data/spec/dummy/db/migrate/20121121030172_drop_billing_integrations.spree.rb +0 -17
- data/spec/dummy/db/migrate/20121121030173_deleted_at_for_payment_methods.spree.rb +0 -15
- data/spec/dummy/db/migrate/20121121030174_add_adjustments_index.spree.rb +0 -7
- data/spec/dummy/db/migrate/20121121030175_add_alt_text_to_images.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030176_fix_existing_coupon_credits.spree.rb +0 -14
- data/spec/dummy/db/migrate/20121121030177_add_display_to_payment_methods.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030178_add_addresses_checkouts_indexes.spree.rb +0 -9
- data/spec/dummy/db/migrate/20121121030179_add_icon_to_taxons.spree.rb +0 -18
- data/spec/dummy/db/migrate/20121121030180_add_description_to_taxons.spree.rb +0 -12
- data/spec/dummy/db/migrate/20121121030181_index_for_shipments_number.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030182_add_index_on_users_persistence_token.spree.rb +0 -8
- data/spec/dummy/db/migrate/20121121030183_add_default_to_tax_categories.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030184_add_display_to_shipping_methods.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030185_rename_payment_method_display.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030186_rename_preferences_field.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030187_add_guest_flag.spree.rb +0 -8
- data/spec/dummy/db/migrate/20121121030188_drop_order_token.spree.rb +0 -10
- data/spec/dummy/db/migrate/20121121030189_payments_state_and_assigned_to_order_only.spree.rb +0 -15
- data/spec/dummy/db/migrate/20121121030190_create_address_keys_for_order.spree.rb +0 -7
- data/spec/dummy/db/migrate/20121121030191_payment_total_for_orders.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030192_shipping_method_id_for_orders.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030193_add_shipment_and_payment_state.spree.rb +0 -7
- data/spec/dummy/db/migrate/20121121030194_refactor_adjustments.spree.rb +0 -30
- data/spec/dummy/db/migrate/20121121030195_response_code_and_avs_response_for_payments.spree.rb +0 -7
- data/spec/dummy/db/migrate/20121121030196_change_guest_flag_to_anonymous.spree.rb +0 -8
- data/spec/dummy/db/migrate/20121121030197_email_for_orders.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030198_create_mail_methods.spree.rb +0 -11
- data/spec/dummy/db/migrate/20121121030199_rename_frozen_to_locked.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030200_move_special_instructions_to_orders.spree.rb +0 -11
- data/spec/dummy/db/migrate/20121121030201_create_log_entries.spree.rb +0 -12
- data/spec/dummy/db/migrate/20121121030202_migrate_transactions_to_payment_state.spree.rb +0 -99
- data/spec/dummy/db/migrate/20121121030203_delete_in_progress_orders.spree.rb +0 -20
- data/spec/dummy/db/migrate/20121121030204_migrate_checkout_to_orders.spree.rb +0 -24
- data/spec/dummy/db/migrate/20121121030205_remove_shipped_state.spree.rb +0 -13
- data/spec/dummy/db/migrate/20121121030206_prevent_nil_payment_total.spree.rb +0 -9
- data/spec/dummy/db/migrate/20121121030207_prevent_nil_email.spree.rb +0 -10
- data/spec/dummy/db/migrate/20121121030208_generate_anonymous_users.spree.rb +0 -21
- data/spec/dummy/db/migrate/20121121030209_update_order_state.spree.rb +0 -13
- data/spec/dummy/db/migrate/20121121030210_cleanup_legacy_tables.spree.rb +0 -12
- data/spec/dummy/db/migrate/20121121030211_remove_number_and_cvv_from_credicard.spree.rb +0 -12
- data/spec/dummy/db/migrate/20121121030212_drop_anonymous_field_for_user.spree.rb +0 -12
- data/spec/dummy/db/migrate/20121121030213_renamed_rma_cancelled_state.spree.rb +0 -10
- data/spec/dummy/db/migrate/20121121030214_fix_problematic_index_names.spree.rb +0 -14
- data/spec/dummy/db/migrate/20121121030215_add_position_to_variants.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030216_add_next_state_to_state_events.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030217_add_position_to_option_types.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030218_remove_trailing_slashes_in_taxon_permalinks.spree.rb +0 -20
- data/spec/dummy/db/migrate/20121121030219_create_activators.spree.rb +0 -15
- data/spec/dummy/db/migrate/20121121030220_eligible_for_adjustments.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030221_namespace_top_level_models.spree.rb +0 -67
- data/spec/dummy/db/migrate/20121121030222_migrate_namespaced_polymorphic_models.spree.rb +0 -53
- data/spec/dummy/db/migrate/20121121030223_make_adjustments_polymorphic.spree.rb +0 -10
- data/spec/dummy/db/migrate/20121121030224_add_company_to_addresses.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030225_add_inc_tax_to_tax_rates.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030226_rename_inc_price_attribute.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030227_add_default_tax_zone.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030228_associate_shipping_methods_and_shipping_categories.spree.rb +0 -8
- data/spec/dummy/db/migrate/20121121030229_add_match_rules_to_shipping_methods.spree.rb +0 -8
- data/spec/dummy/db/migrate/20121121030230_new_preferences.spree.rb +0 -49
- data/spec/dummy/db/migrate/20121121030231_rename_state_events_to_state_changes.spree.rb +0 -10
- data/spec/dummy/db/migrate/20121121030232_add_deleted_at_to_tax_category.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030233_migrate_images_from_products_to_variants.spree.rb +0 -38
- data/spec/dummy/db/migrate/20121121030234_rename_attachment_size_to_attachment_file_size.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030235_increase_scale_of_tax_rate_amount.spree.rb +0 -10
- data/spec/dummy/db/migrate/20121121030236_create_tokenized_permissions_table.spree.rb +0 -17
- data/spec/dummy/db/migrate/20121121030237_convert_sales_tax_to_default_tax.spree.rb +0 -10
- data/spec/dummy/db/migrate/20121121030238_rename_creditcards_to_credit_cards.spree.rb +0 -12
- data/spec/dummy/db/migrate/20121121030239_add_deleted_at_to_spree_shipping_methods.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030240_remove_credit_total_from_orders.spree.rb +0 -6
- data/spec/dummy/db/migrate/20121121030241_add_counter_cache_to_zone_members.spree.rb +0 -15
- data/spec/dummy/script/rails +0 -6
- data/spec/models/spree_mercado_pago_client_spec.rb +0 -131
@@ -1,53 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20111107143030)
|
2
|
-
class MigrateNamespacedPolymorphicModels < ActiveRecord::Migration
|
3
|
-
def concat(str1, str2)
|
4
|
-
dbtype = Rails.configuration.database_configuration[Rails.env]['adapter'].to_sym
|
5
|
-
|
6
|
-
case dbtype
|
7
|
-
when :mysql, :mysql2
|
8
|
-
"CONCAT(#{str1}, #{str2})"
|
9
|
-
when :sqlserver
|
10
|
-
"(#{str1} + #{str2})"
|
11
|
-
else
|
12
|
-
"(#{str1} || #{str2})"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def update_column_data(table_names, column_name)
|
17
|
-
tables = Array.wrap(table_names)
|
18
|
-
tables.each do |table|
|
19
|
-
execute "UPDATE #{table} SET #{column_name} = #{concat("'Spree::'", column_name)}" +
|
20
|
-
" where #{column_name} NOT LIKE 'Spree::%' AND #{column_name} IS NOT NULL"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def replace_column_data(table_names, column_name)
|
25
|
-
tables = Array.wrap(table_names)
|
26
|
-
tables.each do |table|
|
27
|
-
execute "UPDATE #{table} SET #{column_name} = REPLACE(#{column_name}, 'Spree::', '') " +
|
28
|
-
" where #{column_name} LIKE 'Spree::%'"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def up
|
33
|
-
update_column_data(['spree_payments', 'spree_adjustments', 'spree_log_entries'], 'source_type')
|
34
|
-
update_column_data('spree_adjustments', 'originator_type')
|
35
|
-
update_column_data('spree_calculators', 'calculable_type')
|
36
|
-
update_column_data('spree_preferences', 'owner_type')
|
37
|
-
update_column_data('spree_state_events', 'stateful_type')
|
38
|
-
update_column_data(['spree_activators', 'spree_assets', 'spree_calculators', 'spree_configurations', 'spree_gateways', 'spree_payment_methods'], 'type')
|
39
|
-
update_column_data('spree_assets', 'viewable_type')
|
40
|
-
update_column_data('spree_zone_members', 'zoneable_type')
|
41
|
-
end
|
42
|
-
|
43
|
-
def down
|
44
|
-
replace_column_data(['spree_payments', 'spree_adjustments', 'spree_log_entries'], 'source_type')
|
45
|
-
replace_column_data('spree_adjustments', 'originator_type')
|
46
|
-
replace_column_data('spree_calculators', 'calculable_type')
|
47
|
-
replace_column_data('spree_preferences', 'owner_type')
|
48
|
-
replace_column_data('spree_state_events', 'stateful_type')
|
49
|
-
replace_column_data(['spree_activators', 'spree_assets', 'spree_calculators', 'spree_configurations', 'spree_gateways', 'spree_payment_methods'], 'type')
|
50
|
-
replace_column_data('spree_assets', 'viewable_type')
|
51
|
-
replace_column_data('spree_zone_members', 'zoneable_type')
|
52
|
-
end
|
53
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20111201024007)
|
2
|
-
class MakeAdjustmentsPolymorphic < ActiveRecord::Migration
|
3
|
-
|
4
|
-
def change
|
5
|
-
add_column :spree_adjustments, :adjustable_type, :string
|
6
|
-
rename_column :spree_adjustments, :order_id, :adjustable_id
|
7
|
-
execute "UPDATE spree_adjustments SET adjustable_type = 'Spree::Order'"
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120105195817)
|
2
|
-
class AddMatchRulesToShippingMethods < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
add_column :spree_shipping_methods, :match_none, :boolean
|
5
|
-
add_column :spree_shipping_methods, :match_all, :boolean
|
6
|
-
add_column :spree_shipping_methods, :match_one, :boolean
|
7
|
-
end
|
8
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120119024710)
|
2
|
-
require 'spree/core/preference_rescue'
|
3
|
-
|
4
|
-
class NewPreferences < ActiveRecord::Migration
|
5
|
-
|
6
|
-
def up
|
7
|
-
add_column :spree_preferences, :key, :string
|
8
|
-
add_column :spree_preferences, :value_type, :string
|
9
|
-
add_index :spree_preferences, :key, :unique => true
|
10
|
-
|
11
|
-
remove_index :spree_preferences, :name => 'ix_prefs_on_owner_attr_pref'
|
12
|
-
|
13
|
-
# remove old constraints for migration
|
14
|
-
change_column :spree_preferences, :name, :string, :null => true
|
15
|
-
change_column :spree_preferences, :owner_id, :integer, :null => true
|
16
|
-
change_column :spree_preferences, :owner_type, :string, :null => true
|
17
|
-
change_column :spree_preferences, :group_id, :integer, :null => true
|
18
|
-
change_column :spree_preferences, :group_type, :string, :null => true
|
19
|
-
|
20
|
-
cfgs = execute("select id, type from spree_configurations").to_a
|
21
|
-
execute("select id, owner_id, name from spree_preferences where owner_type = 'Spree::Configuration'").each do |pref|
|
22
|
-
configuration = cfgs.detect { |c| c[0].to_s == pref[1].to_s }
|
23
|
-
|
24
|
-
value_type = configuration[1].constantize.new.send "preferred_#{pref[2]}_type" rescue 'string'
|
25
|
-
|
26
|
-
execute "UPDATE spree_preferences set `key` = '#{configuration[1].underscore}/#{pref[2]}', `value_type` = '#{value_type}' where id = #{pref[0]}" rescue nil
|
27
|
-
end
|
28
|
-
|
29
|
-
# remove orphaned calculator preferences
|
30
|
-
Spree::Preference.where(:owner_type => 'Spree::Calculator').each do |preference|
|
31
|
-
preference.destroy unless Spree::Calculator.exists? preference.owner_id
|
32
|
-
end
|
33
|
-
|
34
|
-
Spree::PreferenceRescue.try
|
35
|
-
|
36
|
-
Spree::Preference.where(:value_type => nil).update_all(:value_type => 'string')
|
37
|
-
end
|
38
|
-
|
39
|
-
def down
|
40
|
-
remove_column :spree_preferences, :key
|
41
|
-
remove_column :spree_preferences, :value_type
|
42
|
-
|
43
|
-
add_column :spree_preferences, :name, :string
|
44
|
-
add_column :spree_preferences, :owner_id, :integer
|
45
|
-
add_column :spree_preferences, :owner_type, :string
|
46
|
-
add_column :spree_preferences, :group_id, :integer
|
47
|
-
add_column :spree_preferences, :group_type, :string
|
48
|
-
end
|
49
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120203001428)
|
2
|
-
class RenameStateEventsToStateChanges < ActiveRecord::Migration
|
3
|
-
def up
|
4
|
-
rename_table :spree_state_events, :spree_state_changes
|
5
|
-
end
|
6
|
-
|
7
|
-
def down
|
8
|
-
rename_table :spree_state_changes, :spree_state_events
|
9
|
-
end
|
10
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120315064358)
|
2
|
-
class MigrateImagesFromProductsToVariants < ActiveRecord::Migration
|
3
|
-
def up
|
4
|
-
images = select_all("SELECT spree_assets.* FROM spree_assets
|
5
|
-
WHERE spree_assets.type = 'Spree::Image'
|
6
|
-
AND spree_assets.viewable_type = 'Spree::Product'
|
7
|
-
AND spree_assets.viewable_id IS NOT NULL")
|
8
|
-
|
9
|
-
images.each do |image|
|
10
|
-
master_variant_id = select_value("SELECT id FROM spree_variants
|
11
|
-
WHERE product_id = #{image['viewable_id']}
|
12
|
-
AND is_master = #{quoted_true}")
|
13
|
-
|
14
|
-
execute("UPDATE spree_assets SET viewable_type = 'Spree::Variant', viewable_id = #{master_variant_id}
|
15
|
-
WHERE id = #{image['id']}") if master_variant_id
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def down
|
20
|
-
images = select_all("SELECT spree_assets.* FROM spree_assets
|
21
|
-
JOIN spree_variants
|
22
|
-
ON spree_variants.id = spree_assets.viewable_id
|
23
|
-
AND spree_variants.is_master = #{quoted_true}
|
24
|
-
WHERE spree_assets.type = 'Spree::Image'
|
25
|
-
AND spree_assets.viewable_type = 'Spree::Variant'
|
26
|
-
AND spree_assets.viewable_id IS NOT NULL")
|
27
|
-
|
28
|
-
images.each do |image|
|
29
|
-
product_id = select_value("SELECT spree_products.id FROM spree_products
|
30
|
-
JOIN spree_variants
|
31
|
-
ON spree_variants.id = #{image['viewable_id']}
|
32
|
-
AND spree_products.id = spree_variants.product_id")
|
33
|
-
|
34
|
-
execute("UPDATE spree_assets SET viewable_type = 'Spree::Product', viewable_id = #{product_id}
|
35
|
-
WHERE id = #{image['id']}") if product_id
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120507232704)
|
2
|
-
class IncreaseScaleOfTaxRateAmount < ActiveRecord::Migration
|
3
|
-
def up
|
4
|
-
change_column :spree_tax_rates, :amount, :decimal, { :scale => 5, :precision => 8 }
|
5
|
-
end
|
6
|
-
|
7
|
-
def down
|
8
|
-
change_column :spree_tax_rates, :amount, :decimal, { :scale => 4, :precision => 8 }
|
9
|
-
end
|
10
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120509055454)
|
2
|
-
class CreateTokenizedPermissionsTable < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
unless Spree::TokenizedPermission.table_exists?
|
5
|
-
create_table :spree_tokenized_permissions do |t|
|
6
|
-
t.integer :permissable_id
|
7
|
-
t.string :permissable_type
|
8
|
-
t.string :token
|
9
|
-
|
10
|
-
t.timestamps
|
11
|
-
end
|
12
|
-
|
13
|
-
add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120523061241)
|
2
|
-
class ConvertSalesTaxToDefaultTax < ActiveRecord::Migration
|
3
|
-
def up
|
4
|
-
execute "UPDATE spree_calculators SET type='Spree::Calculator::DefaultTax' WHERE type='Spree::Calculator::SalesTax'"
|
5
|
-
end
|
6
|
-
|
7
|
-
def down
|
8
|
-
execute "UPDATE spree_calculators SET type='Spree::Calculator::SalesTax' WHERE type='Spree::Calculator::DefaultTax'"
|
9
|
-
end
|
10
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120530012000)
|
2
|
-
class RenameCreditcardsToCreditCards < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
rename_table :spree_creditcards, :spree_credit_cards
|
5
|
-
execute("UPDATE spree_payments SET source_type = 'Spree::CreditCard' WHERE source_type = 'Spree::Creditcard'")
|
6
|
-
end
|
7
|
-
|
8
|
-
def down
|
9
|
-
execute("UPDATE spree_payments SET source_type = 'Spree::Creditcard' WHERE source_type = 'Spree::CreditCard'")
|
10
|
-
rename_table :spree_credit_cards, :spree_creditcards
|
11
|
-
end
|
12
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# This migration comes from spree (originally 20120712172620)
|
2
|
-
class AddCounterCacheToZoneMembers < ActiveRecord::Migration
|
3
|
-
def up
|
4
|
-
add_column :spree_zones, :zone_members_count, :integer, :default => 0
|
5
|
-
|
6
|
-
Spree::Zone.reset_column_information
|
7
|
-
Spree::Zone.find(:all).each do |zone|
|
8
|
-
Spree::Zone.update_counters zone.id, :zone_members_count => zone.zone_members.length
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def down
|
13
|
-
remove_column :spree_zones, :zone_members_count
|
14
|
-
end
|
15
|
-
end
|
data/spec/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,131 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe SpreeMercadoPagoClient do
|
5
|
-
SPEC_ROOT = File.expand_path("../", File.dirname(__FILE__))
|
6
|
-
|
7
|
-
let(:payment_method) do
|
8
|
-
double(
|
9
|
-
"payment_method",
|
10
|
-
:preferred_client_id => 1,
|
11
|
-
:preferred_client_secret => 1
|
12
|
-
)
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:order) { double("order", :payment_method => payment_method, :number => "testorder", :line_items => []) }
|
16
|
-
let(:url_callbacks) { {success: "url", failure: "url", pending: "url"} }
|
17
|
-
let(:client) { SpreeMercadoPagoClient.new(order, url_callbacks) }
|
18
|
-
|
19
|
-
let(:login_json_response) do
|
20
|
-
File.open("#{SPEC_ROOT}/fixtures/authenticated.json", "r").read
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:preferences_json_response) do
|
24
|
-
File.open("#{SPEC_ROOT}/fixtures/preferences_created.json", "r").read
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#initialize" do
|
28
|
-
it "raises error if initialized without callbacks" do
|
29
|
-
expect {
|
30
|
-
SpreeMercadoPagoClient.new(order, {})
|
31
|
-
}.to raise_error
|
32
|
-
end
|
33
|
-
|
34
|
-
it "doesn't raise error with all callbacks" do
|
35
|
-
expect {
|
36
|
-
SpreeMercadoPagoClient.new(order, url_callbacks)
|
37
|
-
}.not_to raise_error
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "#authenticate" do
|
42
|
-
|
43
|
-
context "On success" do
|
44
|
-
before(:each) do
|
45
|
-
response = double("response")
|
46
|
-
response.stub(:code) { 200 }
|
47
|
-
response.stub(:to_str) { login_json_response }
|
48
|
-
RestClient.should_receive(:post) { response }
|
49
|
-
end
|
50
|
-
|
51
|
-
it "returns truthy value" do
|
52
|
-
client.authenticate.should be_true
|
53
|
-
end
|
54
|
-
|
55
|
-
it "#errors returns empty array" do
|
56
|
-
client.authenticate
|
57
|
-
client.errors.should be_empty
|
58
|
-
end
|
59
|
-
|
60
|
-
it "sets the access token" do
|
61
|
-
client.authenticate
|
62
|
-
client.auth_response["access_token"].should eq("TU_ACCESS_TOKEN")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context "On failure" do
|
67
|
-
let(:bad_request_response) do
|
68
|
-
response = double("response")
|
69
|
-
response.stub(:code) { 400 }
|
70
|
-
response.stub(:to_str) { "" }
|
71
|
-
response
|
72
|
-
end
|
73
|
-
|
74
|
-
before { RestClient.should_receive(:post) { bad_request_response } }
|
75
|
-
|
76
|
-
it "returns falsy value on invalid authentication" do
|
77
|
-
client.authenticate.should be_false
|
78
|
-
end
|
79
|
-
|
80
|
-
it "populates #errors returns array of errors" do
|
81
|
-
client.authenticate
|
82
|
-
client.errors.should include(I18n.t(:mp_authentication_error))
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe "#send_data" do
|
88
|
-
|
89
|
-
context "On success" do
|
90
|
-
before(:each) do
|
91
|
-
response = double("response")
|
92
|
-
response.stub(:code).and_return(200, 201)
|
93
|
-
response.stub(:to_str).and_return(login_json_response, preferences_json_response)
|
94
|
-
RestClient.should_receive(:post).exactly(2).times { response }
|
95
|
-
|
96
|
-
client.authenticate
|
97
|
-
end
|
98
|
-
|
99
|
-
it "returns truthy value on success" do
|
100
|
-
client.send_data.should be_true
|
101
|
-
end
|
102
|
-
|
103
|
-
it "#redirect_url returns offsite checkout url" do
|
104
|
-
client.send_data
|
105
|
-
client.redirect_url.should be_present
|
106
|
-
client.redirect_url.should eq("https://www.mercadopago.com/checkout/pay?pref_id=identificador_de_la_preferencia")
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context "on failure" do
|
111
|
-
before(:each) do
|
112
|
-
response = double("response")
|
113
|
-
response.stub(:code).and_return(200, 400)
|
114
|
-
response.stub(:to_str) { {some_fake_data: "irrelevant"}.to_json }
|
115
|
-
RestClient.should_receive(:post).exactly(2).times { response }
|
116
|
-
end
|
117
|
-
|
118
|
-
it "returns falsy value" do
|
119
|
-
client.authenticate
|
120
|
-
client.send_data.should be_false
|
121
|
-
end
|
122
|
-
|
123
|
-
it "populates #errors returns array of errors" do
|
124
|
-
client.authenticate
|
125
|
-
client.send_data
|
126
|
-
client.errors.should include(I18n.t(:mp_preferences_setup_error))
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|