dev #14607 Море. Правки по сайту:

change agree info;
remove add to apple wallet notification;
fix apple wallet generation;
This commit is contained in:
nikolay 2023-07-04 15:45:43 +04:00
parent 7fe4b6de52
commit 9fd031f423
6 changed files with 68 additions and 50 deletions

View File

@ -59,7 +59,9 @@ export class NavbarComponent implements OnInit {
} }
addToWallet = () => { addToWallet = () => {
this.appleWalletService.addCardToWallet(); if (this.authService.userInfo) {
this.appleWalletService.addCardToWallet(this.authService.userInfo);
}
} }
deleteToken = (): void => { deleteToken = (): void => {

View File

@ -1,3 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { MatBottomSheet } from '@angular/material/bottom-sheet'; import { MatBottomSheet } from '@angular/material/bottom-sheet';
import { ExitComponent } from 'src/app/components/exit/exit.component'; import { ExitComponent } from 'src/app/components/exit/exit.component';
@ -34,8 +35,6 @@ export class GuestCardComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.negativeBalance = !Array.isArray(this.authService.userInfo?.walletBalances); this.negativeBalance = !Array.isArray(this.authService.userInfo?.walletBalances);
this.showBack = getTypeDevice() === DeviceType.android; this.showBack = getTypeDevice() === DeviceType.android;
this.requestPermission();
} }
requestPermission() { requestPermission() {

View File

@ -30,13 +30,13 @@
</ngx-mat-intl-tel-input> </ngx-mat-intl-tel-input>
</mat-form-field> </mat-form-field>
</div> </div>
<p class="agree-info">
Используя приложение, вы принимаете
условия и соглашаетесь на получение
рекламно-информационных сообщений
</p>
<button mat-raised-button color="primary">Принять участие</button> <button mat-raised-button color="primary">Принять участие</button>
</form> </form>
<p class="agree-info">
Используя приложение, вы принимаете условия
соглашения и соглашаетесь на получение рекламно-информационных
сообщений
</p>
</div> </div>
<ng-template #smsCode> <ng-template #smsCode>
<div class="wrapper"> <div class="wrapper">

View File

@ -17,8 +17,9 @@
.agree-info { .agree-info {
text-align: center; text-align: center;
margin: 0 auto; margin: 0 auto;
margin-top: 40px;
max-width: 80%; max-width: 80%;
font-size: 12px;
margin-bottom: 20px;
} }
.logo { .logo {
text-align: center; text-align: center;

View File

@ -5,6 +5,7 @@ import { environment } from 'src/environments/environment';
import { CookiesService } from './cookies.service'; import { CookiesService } from './cookies.service';
import { RpcService, JsonrpcService } from 'src/app/services/jsonrpc.service'; import { RpcService, JsonrpcService } from 'src/app/services/jsonrpc.service';
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
import { UserInfo } from 'src/app/interface/data';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -41,35 +42,50 @@ export class AppleWalletService {
} }
async addCardToWallet() { async addCardToWallet(userInfo: UserInfo) {
const token = this.cookiesService.getItem('token'); const token = this.cookiesService.getItem('token');
try {
const accountData = (
await lastValueFrom(
this.jsonrpc.rpc(
{
method: 'getTokenData',
params: [],
},
RpcService.authService,
true
)
)
).data;
if (token && accountData.user_id) { try {
this.generateCard(token, accountData.user_id).subscribe({ this.jsonrpc.rpc(
next: (res: any) => { {
this.document.location.href = res.url; method: 'updateAdditionalInfo',
}, params: [
error: (err) => { {
console.log('Error: ', err); first_name: userInfo.name,
}, birth_day: '01.01.1999'
}); },
} ],
},
RpcService.authService,
true
).subscribe({
next: async () => {
const accountData = (
await lastValueFrom(
this.jsonrpc.rpc(
{
method: 'getTokenData',
params: [],
},
RpcService.authService,
true
)
)
).data;
if (token && accountData.user_id) {
this.generateCard(token, accountData.user_id).subscribe({
next: (res: any) => {
this.document.location.href = res.url;
},
error: (err) => {
console.log('Error: ', err);
},
});
}
}});
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} }
} }

View File

@ -42,7 +42,7 @@ export class AuthService {
private jsonrpc: JsonrpcService, private jsonrpc: JsonrpcService,
private messageService: MessageService, private messageService: MessageService,
private router: Router, private router: Router,
private appleWalletService: AppleWalletService, private appleWalletService: AppleWalletService,
) { ) {
this.getCurrentQuarterOfYear(); this.getCurrentQuarterOfYear();
} }
@ -75,30 +75,30 @@ export class AuthService {
if (value && value.customer_info && value.customer_info.errorCode === 'Customer_CustomerNotFound' if (value && value.customer_info && value.customer_info.errorCode === 'Customer_CustomerNotFound'
|| !this.userHasData(value?.customer_info)) { || !this.userHasData(value?.customer_info)) {
this.router.navigate(['create_user']); this.router.navigate(['create_user']);
return rej(null); return rej(null);
} else if (value && value.error && value.error.code > 1) { } else if (value && value.error && value.error.code > 1) {
this.messageService.clear(); this.messageService.clear();
this.messageService.add({ this.messageService.add({
severity: 'error', severity: 'error',
summary: 'Произошла ошибка! Попробуйте позже', summary: 'Произошла ошибка! Попробуйте позже',
}); });
return rej(null); return rej(null);
} else if (value && value.customer_info) { } else if (value && value.customer_info) {
this.userInfo = value.customer_info; this.userInfo = value.customer_info;
this.cookiesService.setCookie('phone-number', this.userInfo!.phone?.slice(2)); this.cookiesService.setCookie('phone-number', this.userInfo!.phone?.slice(2));
} }
res(null); res(null);
}, },
error: (e) => { error: (e) => {
this.error = e; this.error = e;
rej(e); rej(e);
}, },
complete: () => { complete: () => {
this.loading = false; this.loading = false;
}, },
}) })
); );
} }
userHasData(user?: UserInfo) { userHasData(user?: UserInfo) {
@ -179,9 +179,9 @@ export class AuthService {
await this.getUserInfo(); await this.getUserInfo();
if(getTypeDevice() === DeviceType.ios) { if (getTypeDevice() === DeviceType.ios) {
this.appleWalletService.addCardToWallet(); this.appleWalletService.addCardToWallet(this.userInfo!);
} }
} else if (result.code === 230) { } else if (result.code === 230) {
this.messageService.clear(); this.messageService.clear();
this.messageService.add({ this.messageService.add({
@ -279,9 +279,9 @@ export class AuthService {
next: async () => { next: async () => {
this.router.navigate(['/']); this.router.navigate(['/']);
await this.getUserInfo(); await this.getUserInfo();
if(getTypeDevice() === DeviceType.ios) { if (getTypeDevice() === DeviceType.ios) {
this.appleWalletService.addCardToWallet(); this.appleWalletService.addCardToWallet(this.userInfo!);
} }
}, },
error: () => { error: () => {
this.loading = false; this.loading = false;