Skip to content

Commit

Permalink
fix: generate correct offer file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 8, 2022
1 parent 93b8494 commit 7e45e88
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/controllers/offer.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const importOfferFile = async (req, res) => {

await Meta.upsert({
metaKey: 'activeOffer',
metaValue: JSON.stringify(offerFile),
metaValue: offerFile,
});

res.json({
Expand Down
15 changes: 8 additions & 7 deletions src/datalayer/persistance.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ const getSubscriptions = async () => {
}

const options = {
url: `${CONFIG.DATALAYER_URL}/subscriptions `,
url: `${CONFIG.DATALAYER_URL}/subscriptions`,
body: JSON.stringify({}),
};

Expand All @@ -466,7 +466,7 @@ const getSubscriptions = async () => {

const getMirrors = async (storeId) => {
const options = {
url: `${CONFIG.DATALAYER_URL}/get_mirrors `,
url: `${CONFIG.DATALAYER_URL}/get_mirrors`,
body: JSON.stringify({
id: storeId,
}),
Expand All @@ -492,7 +492,7 @@ const getMirrors = async (storeId) => {

const makeOffer = async (offer) => {
const options = {
url: `${CONFIG.DATALAYER_URL}/make_offer `,
url: `${CONFIG.DATALAYER_URL}/make_offer`,
body: JSON.stringify(offer),
};

Expand All @@ -516,7 +516,7 @@ const makeOffer = async (offer) => {

const takeOffer = async (offer) => {
const options = {
url: `${CONFIG.DATALAYER_URL}/take_offer `,
url: `${CONFIG.DATALAYER_URL}/take_offer`,
body: JSON.stringify(offer),
};

Expand All @@ -539,9 +539,10 @@ const takeOffer = async (offer) => {
};

const verifyOffer = async (offer) => {
console.log(offer);
const options = {
url: `${CONFIG.DATALAYER_URL}/verify_offer `,
body: JSON.stringify(offer),
url: `${CONFIG.DATALAYER_URL}/verify_offer`,
body: offer,
};

try {
Expand All @@ -564,7 +565,7 @@ const verifyOffer = async (offer) => {

const cancelOffer = async (tradeId) => {
const options = {
url: `${CONFIG.DATALAYER_URL}/cancel_offer `,
url: `${CONFIG.DATALAYER_URL}/cancel_offer`,
body: JSON.stringify({
trade_id: tradeId,
secure: true,
Expand Down
2 changes: 1 addition & 1 deletion src/models/staging/staging.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class Staging extends Model {
metaValue: offerResponse.offer.trade_id,
});

return offerResponse.offer;
return { offer: offerResponse.offer };
} catch (error) {
throw new Error(error.message);
}
Expand Down

0 comments on commit 7e45e88

Please sign in to comment.