parent
9f4447fa79
commit
8ca151574a
@ -47,5 +47,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <button *ngIf="deviceType == 'ios'" class="add-to-wallet" (click)="addCardToWallet($event)">Добавить в Apple Wallet</button> -->
|
<button *ngIf="deviceType == 'ios'" class="add-to-wallet" (click)="addCardToWallet($event)">Добавить в Apple Wallet</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -118,11 +118,22 @@ export class BonusProgramComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addCardToWallet(e: any) {
|
async addCardToWallet(e: any) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const token = this.cookiesService.getItem('token')
|
const token = this.cookiesService.getItem('token')
|
||||||
if (token) {
|
const accountData = (await lastValueFrom(
|
||||||
this.appleWallet.generateCard(token).subscribe({
|
this.jsonrpc
|
||||||
|
.rpc(
|
||||||
|
{
|
||||||
|
method: 'getTokenData',
|
||||||
|
params: [],
|
||||||
|
},
|
||||||
|
RpcService.authService,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
)).data
|
||||||
|
if (token && accountData.user_id) {
|
||||||
|
this.appleWallet.generateCard(token, accountData.user_id).subscribe({
|
||||||
next: (res: any) => {
|
next: (res: any) => {
|
||||||
this.document.location.href = res.url
|
this.document.location.href = res.url
|
||||||
},
|
},
|
||||||
|
|||||||
@ -11,12 +11,12 @@ export class AppleWalletService {
|
|||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
generateCard(token: string) {
|
generateCard(token: string, user_id: string) {
|
||||||
let headers = new HttpHeaders();
|
let headers = new HttpHeaders();
|
||||||
headers = headers.set('Authorization', environment.appleWalletSecret);
|
headers = headers.set('Authorization', environment.appleWalletSecret);
|
||||||
const options = {
|
const options = {
|
||||||
headers: headers,
|
headers: headers,
|
||||||
};
|
};
|
||||||
return this.http.get(`${this.url}/client/${environment.clientName}/passUrl/${token}`, options)
|
return this.http.get(`${this.url}/client/${environment.clientName}/passUrl/${user_id}/token/${token}`, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import packageJson from '../../package.json';
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
appAuthEndpoint: 'https://testauth.crm4retail.ru/tnt',
|
appAuthEndpoint: 'https://auth.crm4retail.ru/tnt',
|
||||||
appBonusEndpoint: 'https://customerapi2.mi.crm4retail.ru/json.rpc/',
|
appBonusEndpoint: 'https://customerapi2.mi.crm4retail.ru/json.rpc/',
|
||||||
appWPEndpoint: 'http://213.239.210.240:4500/wp-json/woofood/v1/',
|
appWPEndpoint: 'http://213.239.210.240:4500/wp-json/woofood/v1/',
|
||||||
hasBonusProgram: true,
|
hasBonusProgram: true,
|
||||||
@ -18,7 +18,7 @@ export const environment = {
|
|||||||
measurementId: "G-RQF97ZK7R1"
|
measurementId: "G-RQF97ZK7R1"
|
||||||
},
|
},
|
||||||
version: packageJson.version,
|
version: packageJson.version,
|
||||||
appleWalletEndpoint: 'https://ru-academy.online/apns/api',
|
appleWalletEndpoint: 'https://apple-push-notifications.it-retail.tech/apns/api',
|
||||||
appleWalletSecret: 'Token Z_vtuf_flvby!',
|
appleWalletSecret: 'Token Z_vtuf_flvby!',
|
||||||
clientName: 'fashionlogica'
|
clientName: 'fashionlogica'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import packageJson from '../../package.json';
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
appAuthEndpoint: 'https://testauth.crm4retail.ru/tnt',
|
appAuthEndpoint: 'https://auth.crm4retail.ru/tnt',
|
||||||
appBonusEndpoint: 'https://customerapi2.mi.crm4retail.ru/json.rpc/',
|
appBonusEndpoint: 'https://customerapi2.mi.crm4retail.ru/json.rpc/',
|
||||||
appWPEndpoint: 'http://192.168.0.179:4200/wp-json/woofood/v1/',
|
appWPEndpoint: 'http://192.168.0.179:4200/wp-json/woofood/v1/',
|
||||||
hasBonusProgram: true,
|
hasBonusProgram: true,
|
||||||
@ -18,7 +18,7 @@ export const environment = {
|
|||||||
measurementId: 'G-RQF97ZK7R1',
|
measurementId: 'G-RQF97ZK7R1',
|
||||||
},
|
},
|
||||||
version: packageJson.version,
|
version: packageJson.version,
|
||||||
appleWalletEndpoint: 'https://ru-academy.online/apns/api',
|
appleWalletEndpoint: 'http://192.168.0.179:4200/apns/api',
|
||||||
appleWalletSecret: 'Token Z_vtuf_flvby!',
|
appleWalletSecret: 'Token Z_vtuf_flvby!',
|
||||||
clientName: 'fashionlogica'
|
clientName: 'fashionlogica'
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user