-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathapple_coupon.php
47 lines (43 loc) · 1.68 KB
/
apple_coupon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
use Chiiya\Passes\Apple\Passes\Coupon;
use Chiiya\Passes\Apple\Components\Field;
use Chiiya\Passes\Apple\Components\SecondaryField;
use Chiiya\Passes\Apple\Enumerators\ImageType;
use Chiiya\Passes\Apple\Components\Image;
use Chiiya\Passes\Apple\PassFactory;
$pass = new Coupon(
description: '15% off purchases',
organizationName: 'ACME',
passTypeIdentifier: 'pass.acme.wallet',
serialNumber: '1464194291627',
teamIdentifier: '123456789',
backgroundColor: 'rgb(0, 0, 0)',
foregroundColor: 'rgb(255, 255, 255)',
labelColor: 'rgb(255, 255, 255)',
logoText: 'ACME',
expirationDate: '2022-01-01T00:00:00+01:00',
headerFields: [
new SecondaryField(key: 'coupon-type', value: "#15-percent"),
],
secondaryFields: [
new SecondaryField(key: 'name', value: '15% off all purchases', label: 'Your Coupon'),
new SecondaryField(key: 'expiration', value: '01.01.2022', label: 'Valid Until'),
],
backFields: [
new Field(key: 'terms', value: 'Lorem Ipsum', label: 'Terms of Use'),
],
);
$pass
->addImage(new Image('strip-1x.png', ImageType::STRIP, 1))
->addImage(new Image('strip-2x.png', ImageType::STRIP, 2))
->addImage(new Image('strip-3x.png', ImageType::STRIP, 3))
->addImage(new Image('logo.png', ImageType::LOGO))
->addImage(new Image('icon.png', ImageType::ICON))
->addImage(new Image('[email protected]', ImageType::ICON, 2))
->addImage(new Image('[email protected]', ImageType::ICON, 3));
$factory = new PassFactory();
$factory->setCertificate('CERT_PATH');
$factory->setPassword('CERT_PASSWORD');
$factory->setWwdr('WWDR_PATH');
$factory->setOutput('OUTPUT_DIR');
$factory->create($pass, 'filename');