some odd features in opensocial Payment feature(extra)
------------------------------------------------------
Key: SHINDIG-1443
URL: https://issues.apache.org/jira/browse/SHINDIG-1443
Project: Shindig
Issue Type: Improvement
Components: Javascript
Affects Versions: 2.0.0
Reporter: Naosuke Yokoe
Fix For: 2.0.0
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);
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.