Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1443

some odd features in opensocial Payment feature(extra)

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Javascript
    • Labels:
      None

      Description

      1. When to create opensocial.ResponseItem in extras/opensocial-payment/jsoncontainer.js, original code uses opensocial.Payment.ResponseCode values instead of opensocial.ResponseItem.Error values. It is not a good manner.
      2. Replaced some redundant codes

      Index: jsoncontainer.js
      ===================================================================
      — jsoncontainer.js (rev 1005715)
      +++ jsoncontainer.js (working copy)
      @@ -37,8 +37,8 @@
      JsonRpcContainer.prototype.requestPayment = function(payment, opt_callback) {
      if (!payment) {
      if (opt_callback)

      { - opt_callback(new opensocial.ResponseItem(null, payment, - opensocial.Payment.ResponseCode.MALFORMED_REQUEST, + opt_callback(new opensocial.ResponseItem(null, null, + opensocial.ResponseItem.Error.BAD_REQUEST, 'Payment object is undefined.')); }

      return;
      @@ -64,16 +64,14 @@
      JsonRpcContainer.requestPaymentCallback_ = function(callbackId, paymentJson) {
      callback = callbackIdStore[callbackId];
      if (callback)

      { - var errorCode = opensocial.Payment.ResponseCode[ - paymentJson[opensocial.Payment.Field.RESPONSE_CODE]]; + var errorCode = paymentJson[opensocial.Payment.Field.RESPONSE_CODE]; var message = paymentJson[opensocial.Payment.Field.RESPONSE_MESSAGE]; - paymentJson[opensocial.Payment.Field.RESPONSE_CODE] = errorCode; var payment = new JsonPayment(paymentJson, false); var responseItem = new opensocial.ResponseItem( null, payment, - (errorCode == opensocial.Payment.ResponseCode.OK ? null : errorCode), + (errorCode == opensocial.Payment.ResponseCode.OK ? null : opensocial.ResponseItem.Error.BAD_REQUEST), message); callback(responseItem); }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              naosuke Naosuke Yokoe
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: