Browse Source

logs

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
21311df99a
  1. 3
      api/network/modify.ts
  2. 4
      api/network/receive.ts
  3. 3
      dist/api/network/modify.js
  4. 2
      dist/api/network/modify.js.map
  5. 4
      dist/api/network/receive.js
  6. 2
      dist/api/network/receive.js.map

3
api/network/modify.ts

@ -34,6 +34,7 @@ export async function purchaseFromOriginalSender(payload, chat, purchaser){
if(!muid) return if(!muid) return
const mediaKey = await models.MediaKey.findOne({where:{originalMuid:muid}}) const mediaKey = await models.MediaKey.findOne({where:{originalMuid:muid}})
console.log("MEDIA KEY FOUND",mediaKey.dataValues)
const terms = parseLDAT(mt) const terms = parseLDAT(mt)
let price = terms.meta && terms.meta.amt let price = terms.meta && terms.meta.amt
@ -54,6 +55,7 @@ export async function purchaseFromOriginalSender(payload, chat, purchaser){
originalMuid:mediaKey.originalMuid, originalMuid:mediaKey.originalMuid,
mediaType:mediaKey.mediaType mediaType:mediaKey.mediaType
} }
console.log('send the thingy')
sendMessage({ sendMessage({
chat: {...chat.dataValues, contactIds:[mediaKey.sender]}, // the merchant id chat: {...chat.dataValues, contactIds:[mediaKey.sender]}, // the merchant id
sender: owner, sender: owner,
@ -63,6 +65,7 @@ export async function purchaseFromOriginalSender(payload, chat, purchaser){
failure: ()=>{} failure: ()=>{}
}) })
// PAY THE OG POSTER HERE!!! // PAY THE OG POSTER HERE!!!
console.log('pay the dude')
sendMessage({ sendMessage({
chat: {...chat.dataValues, contactIds:[purchaser.id]}, chat: {...chat.dataValues, contactIds:[purchaser.id]},
sender: owner, sender: owner,

4
api/network/receive.ts

@ -28,7 +28,8 @@ export const typesToReplay=[ // should match typesToForward
] ]
async function onReceive(payload){ async function onReceive(payload){
// if tribe, owner must forward to MQTT // if tribe, owner must forward to MQTT
console.log('======> ON RECEIVE',payload.chat&&payload.chat.type,payload.message) console.log('======> ON RECEIVE',payload.message&&payload.message.type,payload.message)
console.log('>>.>>', payload.sender&&payload.sender.pub_key)
let doAction = true let doAction = true
const toAddIn:{[k:string]:any} = {} const toAddIn:{[k:string]:any} = {}
const isTribe = payload.chat && payload.chat.type===constants.chat_types.tribe const isTribe = payload.chat && payload.chat.type===constants.chat_types.tribe
@ -70,7 +71,6 @@ async function onReceive(payload){
if(!myMediaMessage) { // someone else's attachment if(!myMediaMessage) { // someone else's attachment
const senderContact = await models.Contact.findOne({where:{publicKey:payload.sender.pub_key}}) const senderContact = await models.Contact.findOne({where:{publicKey:payload.sender.pub_key}})
purchaseFromOriginalSender(payload, chat, senderContact) purchaseFromOriginalSender(payload, chat, senderContact)
// we do pass thru, to store... so that we know who the og purchaser was
doAction = false doAction = false
} }
} }

3
dist/api/network/modify.js

@ -48,6 +48,7 @@ function purchaseFromOriginalSender(payload, chat, purchaser) {
if (!muid) if (!muid)
return; return;
const mediaKey = yield models_1.models.MediaKey.findOne({ where: { originalMuid: muid } }); const mediaKey = yield models_1.models.MediaKey.findOne({ where: { originalMuid: muid } });
console.log("MEDIA KEY FOUND", mediaKey.dataValues);
const terms = ldat_1.parseLDAT(mt); const terms = ldat_1.parseLDAT(mt);
let price = terms.meta && terms.meta.amt; let price = terms.meta && terms.meta.amt;
if (amount < price) if (amount < price)
@ -66,6 +67,7 @@ function purchaseFromOriginalSender(payload, chat, purchaser) {
originalMuid: mediaKey.originalMuid, originalMuid: mediaKey.originalMuid,
mediaType: mediaKey.mediaType mediaType: mediaKey.mediaType
}; };
console.log('send the thingy');
send_1.sendMessage({ send_1.sendMessage({
chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [mediaKey.sender] }), chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [mediaKey.sender] }),
sender: owner, sender: owner,
@ -75,6 +77,7 @@ function purchaseFromOriginalSender(payload, chat, purchaser) {
failure: () => { } failure: () => { }
}); });
// PAY THE OG POSTER HERE!!! // PAY THE OG POSTER HERE!!!
console.log('pay the dude');
send_1.sendMessage({ send_1.sendMessage({
chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [purchaser.id] }), chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [purchaser.id] }),
sender: owner, sender: owner,

2
dist/api/network/modify.js.map

File diff suppressed because one or more lines are too long

4
dist/api/network/receive.js

@ -38,7 +38,8 @@ exports.typesToReplay = [
function onReceive(payload) { function onReceive(payload) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// if tribe, owner must forward to MQTT // if tribe, owner must forward to MQTT
console.log('======> ON RECEIVE', payload.chat && payload.chat.type, payload.message); console.log('======> ON RECEIVE', payload.message && payload.message.type, payload.message);
console.log('>>.>>', payload.sender && payload.sender.pub_key);
let doAction = true; let doAction = true;
const toAddIn = {}; const toAddIn = {};
const isTribe = payload.chat && payload.chat.type === constants.chat_types.tribe; const isTribe = payload.chat && payload.chat.type === constants.chat_types.tribe;
@ -86,7 +87,6 @@ function onReceive(payload) {
if (!myMediaMessage) { // someone else's attachment if (!myMediaMessage) { // someone else's attachment
const senderContact = yield models_1.models.Contact.findOne({ where: { publicKey: payload.sender.pub_key } }); const senderContact = yield models_1.models.Contact.findOne({ where: { publicKey: payload.sender.pub_key } });
modify_1.purchaseFromOriginalSender(payload, chat, senderContact); modify_1.purchaseFromOriginalSender(payload, chat, senderContact);
// we do pass thru, to store... so that we know who the og purchaser was
doAction = false; doAction = false;
} }
} }

2
dist/api/network/receive.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save