Skip to content

Instantly share code, notes, and snippets.

@gomayonqui
Created May 27, 2015 19:27
Show Gist options
  • Save gomayonqui/9ed8d94f41419f28e5ed to your computer and use it in GitHub Desktop.
Save gomayonqui/9ed8d94f41419f28e5ed to your computer and use it in GitHub Desktop.
Bug recalculation
Started POST "/api/collect/1" for 63.247.76.27 at 2015-05-27 19:27:56 +0000
Processing by Api::V1::PaymentController#collect as HTML
Parameters: {"codigoFactura"=>"11861", "valorFactura"=>"23007.0", "transaccionAprobada"=>"-1", "codigoAutorizacion"=>"00", "firmaTuCompra"=>"46ec17bfb17acf746a35607870508713", "campoExtra1"=>"", "campoExtra2"=>"", "campoExtra3"=>"", "numeroTransaccion"=>"419614", "metodoPago"=>"10", "nombreMetodo"=>"Pruebas", "payment_method_branch_id"=>"1"}
PaymentMethodBranch Load (0.3ms) SELECT `payment_method_branches`.* FROM `payment_method_branches` WHERE `payment_method_branches`.`id` = 1 LIMIT 1
RegionPaymentCompany Load (0.2ms) SELECT `region_payment_companies`.* FROM `region_payment_companies` WHERE `region_payment_companies`.`id` = 1 ORDER BY `region_payment_companies`.`id` ASC LIMIT 1
PaymentCompany Load (0.2ms) SELECT `payment_companies`.* FROM `payment_companies` WHERE `payment_companies`.`id` = 1 ORDER BY `payment_companies`.`id` ASC LIMIT 1
Order Load (0.2ms) SELECT `orders`.* FROM `orders` WHERE `orders`.`id` = 11861
Order Load (0.2ms) SELECT `orders`.* FROM `orders` WHERE `orders`.`id` = 11861 LIMIT 1
Payment Load (0.2ms) SELECT `payments`.* FROM `payments` WHERE `payments`.`order_id` = 11861 ORDER BY `payments`.`id` DESC LIMIT 1
MerchantWithdraw Load (0.1ms) SELECT `merchant_withdraws`.* FROM `merchant_withdraws` WHERE `merchant_withdraws`.`id` = 1 ORDER BY `merchant_withdraws`.`id` ASC LIMIT 1
Merchant Load (0.2ms) SELECT `merchants`.* FROM `merchants` WHERE `merchants`.`id` = 1 ORDER BY `merchants`.`id` ASC LIMIT 1
OrderState Load (0.1ms) SELECT `order_states`.* FROM `order_states` WHERE `order_states`.`name` = 'failed' LIMIT 1
MerchantPaymentMethodCurrency Load (0.2ms) SELECT `merchant_payment_method_currencies`.* FROM `merchant_payment_method_currencies` WHERE `merchant_payment_method_currencies`.`id` = 1 ORDER BY `merchant_payment_method_currencies`.`id` ASC LIMIT 1
PaymentMethodCurrency Load (0.2ms) SELECT `payment_method_currencies`.* FROM `payment_method_currencies` WHERE `payment_method_currencies`.`id` = 1 ORDER BY `payment_method_currencies`.`id` ASC LIMIT 1
PaymentMethodBranch Load (0.1ms) SELECT `payment_method_branches`.* FROM `payment_method_branches` WHERE `payment_method_branches`.`id` = 1 ORDER BY `payment_method_branches`.`id` ASC LIMIT 1
PaymentChannelType Load (0.2ms) SELECT `payment_channel_types`.* FROM `payment_channel_types` INNER JOIN `payment_method_type_payment_channel_types` ON `payment_channel_types`.`id` = `payment_method_type_payment_channel_types`.`payment_channel_type_id` WHERE `payment_method_type_payment_channel_types`.`payment_method_branch_id` = 1 ORDER BY `payment_channel_types`.`id` ASC LIMIT 1
PaymentChannelType Load (0.1ms) SELECT `payment_channel_types`.* FROM `payment_channel_types` WHERE `payment_channel_types`.`name` = 'cash' LIMIT 1
Info antes de recalculation
{:payment_date=>Wed, 27 May 2015 19:27:56 +0000}
Params
{:value=>"23007.0", :order=>11861, :order_state=>:failed, :transaction_id=>"419614", :payment_date=>Wed, 27 May 2015 19:27:56 +0000, :comment=>"Pse transfer with id: 419614 through order: 11861", :payment_state=>"-1", :user_account=>nil, :extra_field1=>"", :extra_field2=>"", :extra_field3=>""}
Currency Load (0.1ms) SELECT `currencies`.* FROM `currencies` WHERE `currencies`.`id` = 16 ORDER BY `currencies`.`id` ASC LIMIT 1
Currency Load (0.2ms) SELECT `currencies`.* FROM `currencies` WHERE `currencies`.`id` = 86 ORDER BY `currencies`.`id` ASC LIMIT 1
ActorType Load (0.2ms) SELECT `actor_types`.* FROM `actor_types` WHERE `actor_types`.`name` = 'facilitator' LIMIT 1
CACHE (0.0ms) SELECT `merchants`.* FROM `merchants` WHERE `merchants`.`id` = 1 ORDER BY `merchants`.`id` ASC LIMIT 1 [["id", 1]]
MerchantBankAccount Load (0.2ms) SELECT `merchant_bank_accounts`.* FROM `merchant_bank_accounts` WHERE `merchant_bank_accounts`.`id` = 1 ORDER BY `merchant_bank_accounts`.`id` ASC LIMIT 1
CACHE (0.0ms) SELECT `currencies`.* FROM `currencies` WHERE `currencies`.`id` = 16 ORDER BY `currencies`.`id` ASC LIMIT 1 [["id", 16]]
PaymentMethodCurrency Load (0.2ms) SELECT `payment_method_currencies`.* FROM `payment_method_currencies` INNER JOIN `merchant_payment_method_currencies` ON `payment_method_currencies`.`id` = `merchant_payment_method_currencies`.`payment_method_currency_id` WHERE `merchant_payment_method_currencies`.`id` = 1 ORDER BY `payment_method_currencies`.`id` ASC LIMIT 1
CACHE (0.0ms) SELECT `actor_types`.* FROM `actor_types` WHERE `actor_types`.`name` = 'facilitator' LIMIT 1
NegotiatedOnDemandHandlingFee Load (0.2ms) SELECT `negotiated_on_demand_handling_fees`.* FROM `negotiated_on_demand_handling_fees` WHERE `negotiated_on_demand_handling_fees`.`merchant_id` = 1 AND `negotiated_on_demand_handling_fees`.`payment_method_currency_id` = 1
OnDemandHandlingFee Load (0.2ms) SELECT `on_demand_handling_fees`.* FROM `on_demand_handling_fees` WHERE `on_demand_handling_fees`.`payment_method_currency_id` = 1
CACHE (0.0ms) SELECT `currencies`.* FROM `currencies` WHERE `currencies`.`id` = 16 ORDER BY `currencies`.`id` ASC LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `payment_method_branches`.* FROM `payment_method_branches` WHERE `payment_method_branches`.`id` = 1 ORDER BY `payment_method_branches`.`id` ASC LIMIT 1 [["id", 1]]
CACHE (0.0ms) SELECT `payment_channel_types`.* FROM `payment_channel_types` INNER JOIN `payment_method_type_payment_channel_types` ON `payment_channel_types`.`id` = `payment_method_type_payment_channel_types`.`payment_channel_type_id` WHERE `payment_method_type_payment_channel_types`.`payment_method_branch_id` = 1 ORDER BY `payment_channel_types`.`id` ASC LIMIT 1 [["payment_method_branch_id", 1]]
CACHE (0.0ms) SELECT `actor_types`.* FROM `actor_types` WHERE `actor_types`.`name` = 'facilitator' LIMIT 1
CACHE (0.0ms) SELECT `actor_types`.* FROM `actor_types` WHERE `actor_types`.`name` = 'facilitator' LIMIT 1
ActorType Load (0.2ms) SELECT `actor_types`.* FROM `actor_types` WHERE `actor_types`.`name` = 'bank' LIMIT 1
Currency Load (0.2ms) SELECT `currencies`.* FROM `currencies` WHERE `currencies`.`iso_code` = 'usd' LIMIT 1
CACHE (0.0ms) SELECT `actor_types`.* FROM `actor_types` WHERE `actor_types`.`name` = 'facilitator' LIMIT 1
Info despues de recalculation
{:payment_date=>Wed, 27 May 2015 19:27:56 +0000, :actual_subtotal=>159145589591.0, :actual_handling_fee=>0.0, :actual_total=>159145589591.0, :subtotal_unrounded=>159145589590.1343, :handling_fee_unrounded=>0, :total_unrounded=>159145589590.1343, :actual_withdraw_collect_value=>159145589590.0, :actual_reserve_withdraw=>159145589590.0, :actual_withdraw_collect_value_unrounded=>159145589590.1343, :actual_reserve_withdraw_unrounded=>159145589590.1343, :actual_reserve_margin_value=>0.0, :actual_reserve_margin_percentage=>0.0, :actual_withdraw_bank_value=>159145589590.1343, :actual_withdraw_margin_bank_value=>0.0, :actual_withdraw_margin_bank_percentage=>0.0, :actual_price_usd=>159145589590.1343}
intento de update
(0.1ms) BEGIN
SQL (0.4ms) UPDATE `orders` SET `payment_date` = '2015-05-27 19:27:56', `actual_subtotal` = 159145589591.0, `actual_handling_fee` = 0.0, `actual_total` = 159145589591.0, `subtotal_unrounded` = 159145589590.134, `handling_fee_unrounded` = 0.0, `total_unrounded` = 159145589590.134, `actual_withdraw_collect_value` = 159145589590, `actual_reserve_withdraw` = 159145589590, `actual_withdraw_collect_value_unrounded` = 159145589590, `actual_reserve_withdraw_unrounded` = 159145589590, `actual_reserve_margin_value` = 0, `actual_reserve_margin_percentage` = 0, `actual_withdraw_bank_value` = 159145589590, `actual_withdraw_margin_bank_value` = 0, `actual_withdraw_margin_bank_percentage` = 0, `actual_price_usd` = 159145589590, `is_paid_and_expected_amount_equal` = 0, `updated_at` = '2015-05-27 19:27:56' WHERE `orders`.`id` = 11861
Mysql2::Error: Out of range value for column 'actual_withdraw_collect_value' at row 1: UPDATE `orders` SET `payment_date` = '2015-05-27 19:27:56', `actual_subtotal` = 159145589591.0, `actual_handling_fee` = 0.0, `actual_total` = 159145589591.0, `subtotal_unrounded` = 159145589590.134, `handling_fee_unrounded` = 0.0, `total_unrounded` = 159145589590.134, `actual_withdraw_collect_value` = 159145589590, `actual_reserve_withdraw` = 159145589590, `actual_withdraw_collect_value_unrounded` = 159145589590, `actual_reserve_withdraw_unrounded` = 159145589590, `actual_reserve_margin_value` = 0, `actual_reserve_margin_percentage` = 0, `actual_withdraw_bank_value` = 159145589590, `actual_withdraw_margin_bank_value` = 0, `actual_withdraw_margin_bank_percentage` = 0, `actual_price_usd` = 159145589590, `is_paid_and_expected_amount_equal` = 0, `updated_at` = '2015-05-27 19:27:56' WHERE `orders`.`id` = 11861
(0.1ms) ROLLBACK
Completed 500 Internal Server Error in 29ms
Mysql2::Error (Out of range value for column 'actual_withdraw_collect_value' at row 1):
app/services/payment_branch/register.rb:93:in `update_order'
app/services/payment_branch/register.rb:67:in `pay_fail!'
app/services/payment_branch/register.rb:35:in `process'
app/services/payment_branch/base_payment.rb:15:in `collect_response'
app/controllers/api/v1/payment_controller.rb:23:in `collect'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment