Commit 26542db1 authored by Olivia Madrid's avatar Olivia Madrid

uncomment fake data. this is unlikely to be functional

1 merge request!686WIP: Epic/wallet 80
Pipeline #117174897 failed with stages
in 5 minutes and 58 seconds
<div class="m-walletBalance--cash" *ngIf="loaded">
<div
class="m-walletTransactions__onboarding"
*ngIf="!hasAccount && !onSettingsTab"
>
<p>
<a (click)="scrollTocCashSettings.emit()">Add your bank information</a>
</p>
<p>Start receiving payouts by adding your bank details.</p>
</div>
<div *ngIf="!inProgress" class="m-walletBalance--cash__colContainer">
<!-- ---PENDING BALANCE ------------------------------------------------- -->
<div class="m-walletBalance--cash__col">
......
......@@ -242,32 +242,32 @@ export class WalletDashboardService {
async getStripeAccount() {
//TODOOJM toggle
return fakeData.stripe_account.account;
// const merchant = this.session.getLoggedInUser().merchant;
// if (merchant && merchant.service === 'stripe') {
// try {
// const { account } = <any>(
// await this.client.get('api/v2/payments/stripe/connect')
// );
// if (account && account.totalBalance) {
// this.wallet.cash.balance =
// (account.totalBalance.amount - account.pendingBalance.amount) / 100;
// if (account.bankAccount) {
// const c = account.bankAccount.currency;
// this.wallet.cash.label = c.toUpperCase;
// this.wallet.cash.unit = c;
// }
// }
// return account;
// } catch (e) {
// console.error(e);
// return;
// }
// } else {
// return;
// }
// return fakeData.stripe_account.account;
const merchant = this.session.getLoggedInUser().merchant;
if (merchant && merchant.service === 'stripe') {
try {
const { account } = <any>(
await this.client.get('api/v2/payments/stripe/connect')
);
if (account && account.totalBalance) {
this.wallet.cash.balance =
(account.totalBalance.amount - account.pendingBalance.amount) / 100;
if (account.bankAccount) {
const c = account.bankAccount.currency;
this.wallet.cash.label = c.toUpperCase;
this.wallet.cash.unit = c;
}
}
return account;
} catch (e) {
console.error(e);
return;
}
} else {
return;
}
}
async createStripeAccount(form) {
......@@ -318,39 +318,6 @@ export class WalletDashboardService {
}
}
// async uploadDocument(fileInput: HTMLInputElement, documentType: string) {
// const file = fileInput ? fileInput.files[0] : null;
// this.editing = true;
// this.detectChanges();
// await this.upload.post(
// 'api/v2/payments/stripe/connect/document/' + documentType,
// [file]
// );
// this.editing = false;
// this.account = null;
// this.getSettings();
// }
// async updateField(fieldName: string, value: string) {
// this.editing = true;
// this.detectChanges();
// let body = {};
// body[fieldName] = value;
// await this.client.post('api/v2/payments/stripe/connect/update', body);
// this.editing = false;
// this.account = null;
// this.getSettings();
// }
// async acceptTos() {
// this.editing = true;
// this.detectChanges();
// await this.client.put('api/v2/payments/stripe/connect/terms');
// this.editing = false;
// this.account = null;
// this.getSettings();
// }
async leaveMonetization() {
try {
const response = <any>(
......@@ -377,12 +344,13 @@ export class WalletDashboardService {
async getStripeTransactions(offset) {
try {
// const response = <any>(
// await this.client.get('api/v2/payments/stripe/transactions')
// );
// return response;
const response = <any>(
await this.client.get('api/v2/payments/stripe/transactions')
);
return response;
// TODOOJM toggle fake data
return fakeData.tx_usd;
// return fakeData.tx_usd;
} catch (e) {
console.error(e);
return;
......@@ -391,13 +359,15 @@ export class WalletDashboardService {
async getStripePayouts() {
try {
// const response = <any>(
// await this.client.get('api/v1/monetization/service/analytics/list?offset=&limit=12&type=payouts'
// );
const response = <any>(
await this.client.get(
'api/v1/monetization/service/analytics/list?offset=&limit=12&type=payouts'
)
);
// TODOOJM toggle fake data
// return response.transactions;
return fakeData.stripe_payouts;
return response.transactions;
// return fakeData.stripe_payouts;
} catch (e) {
console.error(e);
return;
......@@ -408,53 +378,58 @@ export class WalletDashboardService {
const opts = { timespan: activeTimespanId };
// TODOOJM toggle
// try {
// const response = <any>await this.client.post('api/v2/analytics/dashboards/engagement?metric=token_balance', opts);
// return response;
// } catch (e) {
// console.error(e);
// return e;
// }
return fakeData.token_chart;
try {
const response = <any>(
await this.client.post(
'api/v2/analytics/dashboards/engagement?metric=token_balance',
opts
)
);
return response;
} catch (e) {
console.error(e);
return e;
}
// return fakeData.token_chart;
}
async getProEarnings() {
return 77.3;
// try {
// const response = <any>(
// await this.client.post(
// 'api/v2/analytics/dashboards/earnings?metric=earnings_total&timespan=today'
// )
// );
// const earnings =
// response.dashboard.metrics
// .find(m => m.id === 'earnings_total')
// .visualisation.segments[0].buckets.slice(-1)[0].value / 100;
// return earnings;
// } catch (e) {
// console.error(e);
// return e;
// }
// return 77.3;
try {
const response = <any>(
await this.client.post(
'api/v2/analytics/dashboards/earnings?metric=earnings_total&timespan=today'
)
);
const earnings =
response.dashboard.metrics
.find(m => m.id === 'earnings_total')
.visualisation.segments[0].buckets.slice(-1)[0].value / 100;
return earnings;
} catch (e) {
console.error(e);
return e;
}
}
async getTokenTransactions(opts) {
try {
// TODOOJM uncomment
// const response = <any>(
// await this.client.get(`api/v2/blockchain/transactions/ledger`, opts)
// );
// return response;
const response = <any>(
await this.client.get(`api/v2/blockchain/transactions/ledger`, opts)
);
return response;
// TODOOJM remove
if (!opts.contract) {
return fakeData.tx_tokens;
} else {
return fakeData.tx_tokens_filtered;
}
// if (!opts.contract) {
// return fakeData.tx_tokens;
// } else {
// return fakeData.tx_tokens_filtered;
// }
} catch (e) {
console.error(e);
return;
......@@ -492,19 +467,19 @@ export class WalletDashboardService {
async getDailyTokenContributionScores(dateRangeOpts) {
// TODOOJM toggle
// try {
// const response: any = await this.client.post(
// 'api/v2/blockchain/contributions',
// dateRangeOpts
// );
// if (!response.contributions) {
// return false;
// }
// return response;
// } catch (e) {
// console.error(e);
// return false;
// }
return fakeData.pendingTokenRewards;
try {
const response: any = await this.client.post(
'api/v2/blockchain/contributions',
dateRangeOpts
);
if (!response.contributions) {
return false;
}
return response;
} catch (e) {
console.error(e);
return false;
}
// return fakeData.pendingTokenRewards;
}
}
<div class="m-walletOnboardingExtrasForm" *ngIf="account">
<!-- TODOOJM sketchy *ngIf for pending notice. -->
<!-- TODOOJM sketchy *ngIf for pending notice -->
<!-- <p *ngIf="!account.verified">
Your account is pending verification. Verification status updates will be
sent in your notifications.
......
......@@ -5,6 +5,7 @@
>Set up cash payments</m-shadowboxSubmitButton
>
</div>
<div class="m-walletCashOnboardingView--form" *ngIf="editing">
<form [formGroup]="form">
<p>Enter personal details to setup your cash payment account.</p>
......
......@@ -65,9 +65,7 @@ export class WalletSettingsCashComponent implements OnInit {
this.inProgress = true;
this.detectChanges();
// todoojm uncomment
// const hasMerchant = this.user && this.user.merchant.id;
const hasMerchant = true;
const hasMerchant = this.user && this.user.merchant.id;
if (!hasMerchant) {
this.view = 'onboarding';
......
Please register or to comment