parent
9f4447fa79
commit
8ca151574a
@ -47,5 +47,5 @@
|
||||
</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>
|
||||
|
||||
@ -118,11 +118,22 @@ export class BonusProgramComponent implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
addCardToWallet(e: any) {
|
||||
async addCardToWallet(e: any) {
|
||||
e.preventDefault()
|
||||
const token = this.cookiesService.getItem('token')
|
||||
if (token) {
|
||||
this.appleWallet.generateCard(token).subscribe({
|
||||
const accountData = (await lastValueFrom(
|
||||
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) => {
|
||||
this.document.location.href = res.url
|
||||
},
|
||||
|
||||
@ -11,12 +11,12 @@ export class AppleWalletService {
|
||||
private http: HttpClient,
|
||||
) {}
|
||||
|
||||
generateCard(token: string) {
|
||||
generateCard(token: string, user_id: string) {
|
||||
let headers = new HttpHeaders();
|
||||
headers = headers.set('Authorization', environment.appleWalletSecret);
|
||||
const options = {
|
||||
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 = {
|
||||
production: true,
|
||||
appAuthEndpoint: 'https://testauth.crm4retail.ru/tnt',
|
||||
appAuthEndpoint: 'https://auth.crm4retail.ru/tnt',
|
||||
appBonusEndpoint: 'https://customerapi2.mi.crm4retail.ru/json.rpc/',
|
||||
appWPEndpoint: 'http://213.239.210.240:4500/wp-json/woofood/v1/',
|
||||
hasBonusProgram: true,
|
||||
@ -18,7 +18,7 @@ export const environment = {
|
||||
measurementId: "G-RQF97ZK7R1"
|
||||
},
|
||||
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!',
|
||||
clientName: 'fashionlogica'
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ import packageJson from '../../package.json';
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
appAuthEndpoint: 'https://testauth.crm4retail.ru/tnt',
|
||||
appAuthEndpoint: 'https://auth.crm4retail.ru/tnt',
|
||||
appBonusEndpoint: 'https://customerapi2.mi.crm4retail.ru/json.rpc/',
|
||||
appWPEndpoint: 'http://192.168.0.179:4200/wp-json/woofood/v1/',
|
||||
hasBonusProgram: true,
|
||||
@ -18,7 +18,7 @@ export const environment = {
|
||||
measurementId: 'G-RQF97ZK7R1',
|
||||
},
|
||||
version: packageJson.version,
|
||||
appleWalletEndpoint: 'https://ru-academy.online/apns/api',
|
||||
appleWalletEndpoint: 'http://192.168.0.179:4200/apns/api',
|
||||
appleWalletSecret: 'Token Z_vtuf_flvby!',
|
||||
clientName: 'fashionlogica'
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user