Page MenuHomeIn-Portal Phabricator

MINC-194 Fix ECB currency rate downloader
ClosedPublic

Authored by erik on Dec 6 2017, 9:39 AM.

Details

Summary

Added follow redirect, added logic to avoid parsing invalid results

Test Plan

Preparations

  1. go to Admin Console
  2. enable at least 3 currencies (e.g. GBP, EUR, USD) and either of them must be set as primary

Part 1

  1. go to Admin Console
  2. go to ConfigurationE-commerceGeneral
  3. set "Choose the exchange rate source" to "Federal Reserve Bank of New York - www.ny.frb.org"
  4. press "Save" button
  5. go to ConfigurationE-commerceCurrencies
  6. press "Update Rates" button
  7. in the dialog, that appears after "Update Rates" button press, confirm the action so that all and not only active currencies would be updated
  8. confirm that no errors reported in the Logs & ReportsSystem Log

Part 2

  1. go to Admin Console
  2. go to ConfigurationE-commerceGeneral
  3. set "Choose the exchange rate source" to "European Central Bank - www.ecb.int"
  4. press "Save" button
  5. go to ConfigurationE-commerceCurrencies
  6. press "Update Rates" button
  7. in the dialog, that appears after "Update Rates" button press, confirm the action so that all and not only active currencies would be updated
  8. confirm that no errors reported in the Logs & ReportsSystem Log
  9. confirm that active currency rates are updated
  10. edit some of active currency rates to 2x larger value
  11. select (with checkbox selection) edited currency rate
  12. press "Update Rates" button
  13. in the dialog, that appears after "Update Rates" button press, confirm the action so that all and not only active currencies would be updated
  14. confirm that no errors reported in the Logs & ReportsSystem Log
  15. confirm that selected currency rate is updated to normal (not ~2x) value

Part 3

  1. go to Admin Console
  2. set "Choose the exchange rate source" to "Bank of Latvia - www.bank.lv"
  3. press "Save" button
  4. go to ConfigurationE-commerceCurrencies
  5. press "Update Rates" button
  6. in the dialog, that appears after "Update Rates" button press, confirm the action so that all and not only active currencies would be updated
  7. confirm that no errors reported in the Logs & ReportsSystem Log

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.2.x
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 823
Build 823: arc lint + arc unit

Event Timeline

erik created this revision.Dec 6 2017, 9:39 AM
alex requested changes to this revision.Dec 7 2017, 6:07 AM

Updates to test plan:

confirm that no errors reported in the debugger panel

There never will be any errors reported, because a redirect is made after currency update event was executed. Therefore I recommend to check new records in System Log instead.

  1. go to ConfigurationE-commerceCurrencies
  2. press "Update Rates" button

Also mention, that:

  1. user needs to enable at least 3 currencies (e.g. GBP, EUR, USD) and either of them must be set as primary
  2. in the dialog, that appears after Update Rates button press user must confirm the action so that all and not only active currencies would be updated

Notices (not added by this differential, but still bad):

Requested ID for prefix curr not passed

  1. remove the $object = $event->getObject(); line
  2. get table name directly from unit config instead of doing $object->TableName

Undefined offset: 0

replace if(is_array($ids) && $ids[0]) + { on the next line with if ( $ids ) {

Undefined variable: iso_list

in the else part of if ( $ids ) { assign an empty array to $iso_list variable

Undefined index: EUR when using ECB

in the ECBCurrencyRates class replace if(!$data_res['EUR']) + { on the next line with if (!isset($data_res['EUR']) ) {

This revision now requires changes to proceed.Dec 7 2017, 6:07 AM
erik edited the test plan for this revision. (Show Details)Dec 7 2017, 9:03 AM
erik edited the test plan for this revision. (Show Details)Dec 7 2017, 9:07 AM
erik updated this revision to Diff 821.Dec 7 2017, 9:23 AM
erik edited edge metadata.

Fixed notices.

erik edited the test plan for this revision. (Show Details)Dec 7 2017, 9:42 AM
alex accepted this revision.Dec 7 2017, 9:46 AM
alex edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Dec 7 2017, 9:48 AM
This revision was automatically updated to reflect the committed changes.