alexandercerutti / passkit-generator

The easiest way to generate custom Apple Wallet passes in Node.js
MIT License
893 stars 109 forks source link

Pass not getting updated #202

Closed prashant03Dev closed 6 months ago

prashant03Dev commented 6 months ago

STEPS to reproduce:

-When pass is being created,when writing pkpass file and sending it to client side,It's design won't be impacted. -Below is the code

        const passCreated: PassKit.PKPass = await this.walletService.createPass(
            'Generic.pass',
            this.user.uuid,
            'membership-card-pass',
        );

        try {
            passCreated.type = this.pass.type;

            passCreated.primaryFields.push({
                key: 'memberName',
                label: 'Member Name',
                value: `${this.user.insuredName}`,
                textAlignment: 'PKTextAlignmentRight',
            });

            passCreated.secondaryFields.push({
                key: 'memberNumber',
                label: 'Member Number',
                value: `${this.user.memberId}`,
                textAlignment: 'PKTextAlignmentRight',
            });

            const buffer = await passCreated.getAsBuffer();

            await this.upsertPass();
            //await fs.writeFile('pass.pkpass', buffer);

            response.setHeader('Content-Type', 'application/vnd.apple.pkpass');
            response.setHeader('Content-Disposition', `attachment; filename="membership-pass.pkpass"`);

            response.send(buffer);
            this.logger.debug('======= MEMBERSHIP PASS GENERATED SUCCESSFULLY====');
        } catch (error) {
            throw Error(error.message);
        }

As I've updated textAlignment to right side,but again and again it's showing up in the left side.

@alexandercerutti suggest me solution for above one,and change for value color and key also

prashant03Dev commented 6 months ago

@alexandercerutti

alexandercerutti commented 6 months ago

No need to tag me. I already receive notifications for issues.

prashant03Dev commented 6 months ago

ok

alexandercerutti commented 6 months ago

Color: https://developer.apple.com/documentation/walletpasses/pass Look for "foregroundColor" / "labelColor". Set them in the props when you do new PKPass() or PKPass.from().

Alignment: you cannot set it for primaryFields apparently. Docs says:

This key is invalid for primary and back fields.

About secondaryFields I'm not sure. Can you share a compiled pass?