paypro: fix signature error. fix merchant_data. see #1409.
This commit is contained in:
parent
23b055c9e5
commit
5c9bb4982d
2 changed files with 19 additions and 8 deletions
3
app.js
3
app.js
|
|
@ -20,6 +20,9 @@ app.start = function(port, callback) {
|
|||
|
||||
pserver.removeListener('request', pserver.app);
|
||||
|
||||
// pserver.options['no-tx'] = true;
|
||||
// pserver.options['discovery'] = true;
|
||||
|
||||
pserver.on('request', function(req, res) {
|
||||
if (req.url.indexOf('/-/') === 0) {
|
||||
return pserver.app(req, res);
|
||||
|
|
|
|||
|
|
@ -1416,9 +1416,9 @@ Wallet.prototype.receivePaymentRequest = function(options, pr, cb) {
|
|||
expires: expires,
|
||||
memo: memo || 'This server would like some BTC from you.',
|
||||
payment_url: payment_url,
|
||||
merchant_data: merchant_data ? merchant_data.toString('hex')
|
||||
// : new Buffer('none', 'utf8').toString('hex')
|
||||
: '00'
|
||||
merchant_data: merchant_data
|
||||
? merchant_data.toString('hex')
|
||||
: null
|
||||
},
|
||||
signature: sig.toString('hex'),
|
||||
ca: trust.caName,
|
||||
|
|
@ -1540,8 +1540,10 @@ Wallet.prototype.sendPaymentTx = function(ntxid, options, cb) {
|
|||
var pay = new PayPro();
|
||||
pay = pay.makePayment();
|
||||
var merchant_data = txp.merchant.pr.pd.merchant_data;
|
||||
merchant_data = new Buffer(merchant_data, 'hex');
|
||||
pay.set('merchant_data', merchant_data);
|
||||
if (merchant_data) {
|
||||
merchant_data = new Buffer(merchant_data, 'hex');
|
||||
pay.set('merchant_data', merchant_data);
|
||||
}
|
||||
pay.set('transactions', [tx.serialize()]);
|
||||
pay.set('refund_to', refund_outputs);
|
||||
|
||||
|
|
@ -1582,7 +1584,13 @@ Wallet.prototype.sendPaymentTx = function(ntxid, options, cb) {
|
|||
return self.receivePaymentRequestACK(ntxid, tx, txp, ack, cb);
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
return cb(new Error('Status: ' + status));
|
||||
log.debug('Sending to server was not met with a returned tx.');
|
||||
log.debug('XHR status: ' + status);
|
||||
return self._checkSentTx(ntxid, function(txid) {
|
||||
log.debug('[Wallet.js.1581:txid:%s]', txid);
|
||||
if (txid) self.store();
|
||||
return cb(txid, txp.merchant);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1611,7 +1619,7 @@ Wallet.prototype.receivePaymentRequestACK = function(ntxid, tx, txp, ack, cb) {
|
|||
if (!tx) {
|
||||
log.debug('Sending to server was not met with a returned tx.');
|
||||
return this._checkSentTx(ntxid, function(txid) {
|
||||
self.log('[Wallet.js.1048:txid:%s]', txid);
|
||||
log.debug('[Wallet.js.1613:txid:%s]', txid);
|
||||
if (txid) self.store();
|
||||
return cb(txid, txp.merchant);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue