Skip to content

Commit

Permalink
Fix: Tax Issue
Browse files Browse the repository at this point in the history
Refactor: None
Feat: None
  • Loading branch information
jiloysss authored and jiloysss committed Jul 23, 2019
1 parent ec2b20b commit 4b709cc
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/boot/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import getTheme from "../theme/components";
import variables from "../theme/variables/platform";

const stores2 = config();
BackgroundJob.cancel({jobKey: "AutomaticSync"});
BackgroundJob.cancel({ jobKey: "AutomaticSync" });
const backgroundJob = {
jobKey: "myJob",
job: () => syncObjectValues("sync", stores2, true),
Expand Down
86 changes: 42 additions & 44 deletions src/store/PosStore/DbFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,55 +39,53 @@ export function sync(
) {
// if (credentials.url !== undefined && credentials.user_name !== undefined && credentials.password !== undefined) {
if (credentials.url) {
if (validUrl.isWebUri(credentials.url.toLowerCase())) {
return FrappeFetch.createClient({
url: credentials.url.toLowerCase(),
username: credentials.user_name,
password: credentials.password,
})

if (validUrl.isWebUri(credentials.url.toLowerCase())) {
return FrappeFetch.createClient({
url: credentials.url.toLowerCase(),
username: credentials.user_name,
password: credentials.password,
})

.then(responseLog => {
const {Client} = FrappeFetch;
return Client.postApi(
"tailpos_sync.sync_pos.sync_data",
// "frappe.handler.ping",
{
tailposData: JSON.parse(jsonObject),
trashObject: JSON.parse(trashObj),
deviceId: credentials.deviceId,
typeOfSync: type,
},
);
})
.catch(error => {
store.stateStore.setIsNotSyncing();
BackgroundJob.cancel({ jobKey: "AutomaticSync" });
if (!jobStatus) {
Toast.show({
text: "Unable to sync",
type: "danger",
duration: 5000,
});

}
})

.then(response => response.json())
.then(responseJson => {
return responseJson.message.data;
});
} else {
.then(responseLog => {
const { Client } = FrappeFetch;
return Client.postApi(
"tailpos_sync.sync_pos.sync_data",
// "frappe.handler.ping",
{
tailposData: JSON.parse(jsonObject),
trashObject: JSON.parse(trashObj),
deviceId: credentials.deviceId,
typeOfSync: type,
},
);
})
.catch(error => {
store.stateStore.setIsNotSyncing();
Toast.show({
text: "Invalid URL",
BackgroundJob.cancel({ jobKey: "AutomaticSync" });
if (!jobStatus) {
Toast.show({
text: "Unable to sync",
type: "danger",
duration: 5000,
});
BackgroundJob.cancel({ jobKey: "AutomaticSync" });
}
} else {
});
}
})

.then(response => response.json())
.then(responseJson => {
return responseJson.message.data;
});
} else {
store.stateStore.setIsNotSyncing();
Toast.show({
text: "Invalid URL",
type: "danger",
duration: 5000,
});
BackgroundJob.cancel({ jobKey: "AutomaticSync" });
}
} else {
BackgroundJob.cancel({ jobKey: "AutomaticSync" });
}
}

Expand Down
1 change: 0 additions & 1 deletion src/store/PosStore/ReceiptStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ export const Receipt = types
ReceiptStore.delete(self); // Reference
},
clear() {

// Yay!
self.lines.splice(0, self.lines.length);
},
Expand Down

0 comments on commit 4b709cc

Please sign in to comment.