From 4d93051bedd8b07966e2f58ef87dec32b037dd8e Mon Sep 17 00:00:00 2001 From: Gabriel Totoliciu Date: Tue, 20 Sep 2016 15:03:48 +0300 Subject: [PATCH 1/4] added GenerateInvoice and ProcessPayments to lib/objectList.js --- lib/objectList.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/objectList.js b/lib/objectList.js index 501c0c5..b37674e 100644 --- a/lib/objectList.js +++ b/lib/objectList.js @@ -38,5 +38,7 @@ module.exports = [ {name: 'Usage'}, {name: 'BillingPreviewRequest'}, //BillingPreviewRequest {name: 'Request'}, //BillingPreviewRequest - {name: 'BillingPreviewRun', methods: ['create', 'query']} + {name: 'BillingPreviewRun', methods: ['create', 'query']}, + {name: 'GenerateInvoice', methods: ['subscribe']}, + {name: 'ProcessPayments', methods: ['subscribe']} ]; From 22b9709a3abb73fd65363198f1338f4828bb553a Mon Sep 17 00:00:00 2001 From: Gabriel Totoliciu Date: Tue, 20 Sep 2016 15:05:27 +0300 Subject: [PATCH 2/4] added subscribe to zObjectMethods --- lib/xml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xml.js b/lib/xml.js index 9941f73..47089ba 100644 --- a/lib/xml.js +++ b/lib/xml.js @@ -73,7 +73,7 @@ var escapeFields = function(value) { }; function convert (method, object, objectType) { - var zObjectMethods = ['create', 'update', 'generate']; + var zObjectMethods = ['create', 'update', 'generate', 'subscribe']; var ns1Actions = ['delete', 'execute']; var encapsulate = function(key, obj) { From 2ced44a9e2222e9dfd3da54be24477763693544c Mon Sep 17 00:00:00 2001 From: Gabriel Totoliciu Date: Tue, 20 Sep 2016 18:44:28 +0300 Subject: [PATCH 3/4] hardcoded PaymentMethodId for method subscribe to use ns1 --- lib/xml.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/xml.js b/lib/xml.js index 47089ba..177abbd 100644 --- a/lib/xml.js +++ b/lib/xml.js @@ -124,6 +124,9 @@ function convert (method, object, objectType) { prefix = prefix || ns2; val = escapeFields(value); } + if (key === 'PaymentMethodId' && method === 'subscribe') { + prefix = ns1; + } return tag(name, prefix, val, attributes); } }), '\n'); From 4ef4a727f8175471308e5ccfeba20964cccc8764 Mon Sep 17 00:00:00 2001 From: George Ionita Date: Wed, 5 Oct 2016 14:03:31 +0300 Subject: [PATCH 4/4] added more fields to the subscribe namespace fix --- lib/xml.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/xml.js b/lib/xml.js index 177abbd..f00c1b4 100644 --- a/lib/xml.js +++ b/lib/xml.js @@ -124,9 +124,18 @@ function convert (method, object, objectType) { prefix = prefix || ns2; val = escapeFields(value); } - if (key === 'PaymentMethodId' && method === 'subscribe') { + var subscribeFields = [ + 'Amount', + 'EffectiveDate', + 'ProcessPayments', + 'GenerateInvoice', + 'PaymentMethodId' + ]; + + if (method === 'subscribe' && subscribeFields.indexOf(key) >= 0) { prefix = ns1; } + return tag(name, prefix, val, attributes); } }), '\n');