regentmarkets-repo-archive / binary-extjs

http://extjs.binary.com
3 stars 4 forks source link

Specific error for contract call #81

Closed AntonDriemin closed 9 years ago

AntonDriemin commented 9 years ago

@frank-binary Example of valid request: http://rmg-prod.apigee.net/v1/binary/contract/FLASHD/R_100/sec/30/USD/190/0/0/0 invalid: http://rmg-prod.apigee.net/v1/binary/contract/FLASHD/R_100/sec/30/USD/190/1/0/0 and response is:

{
  "fault":  {
    "faultcode": 200,
    "details":  [
      "The database is not yet updated with settlement data.",
      "Missing market data for entry spot.",
      "Contract has already expired.",
      "Start time is in the past",
      "Invalid stake",
      "Stake must be between <strong>0.50</strong> and <strong>100,000</strong>.",
      "Barrier is out of acceptable range."
    ],
    "faultstring": "Contract can not be validated"
  }
}

which error message should I display to user?

frank-binary commented 9 years ago

Quants,

See Anton's example. If you do a BOM::Product::Transaction->new(..)->buy, with an unsuccessful contract request, you get a whole array of messages. Should they all be shown to the client?

Or maybe just the last one?

junbon-deriv commented 9 years ago

we should show primary_validation_error.

AntonDriemin commented 9 years ago

@frank-binary can you please do?

frank-binary commented 9 years ago

yes, will do. thanks jb.

frank-binary commented 9 years ago

I did a minor variation to junbon's patch.
The answer to Anton's question is now 'the first message reported is the primary_validation_error. This is the one to show to the client'. I retained the old behaviour where the remaining messages if any are still reported anyway.. a conversation with Matt long ago, it emerged that smart clients may be able to do clever things if they can see the other messages too. This is tested and is in master; it will go live with the next release by anybody.