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

some odd features in opensocial Payment feature(extra)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.0
    • 2.0.0
    • Javascript
    • 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

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

            Dates

              Created:
              Updated: