|
16 | 16 | );
|
17 | 17 | $activityDetails = $yotiClient->getActivityDetails($token);
|
18 | 18 | $profile = $activityDetails->getProfile();
|
| 19 | + $ageVerifications = $profile->getAgeVerifications(); |
| 20 | + $ageVerification = current($ageVerifications); |
19 | 21 |
|
20 | 22 | $profileAttributes = [
|
21 | 23 | [
|
|
43 | 45 | 'obj' => $profile->getDateOfBirth(),
|
44 | 46 | 'icon' => 'yoti-icon-calendar',
|
45 | 47 | ],
|
| 48 | + [ |
| 49 | + 'name' => 'Age Verification', |
| 50 | + 'obj' => $ageVerification, |
| 51 | + 'icon' => 'yoti-icon-calendar', |
| 52 | + ], |
46 | 53 | [
|
47 | 54 | 'name' => 'Address',
|
48 | 55 | 'obj' => $profile->getPostalAddress(),
|
|
66 | 73 |
|
67 | 74 | // Create selfie image file.
|
68 | 75 | if ($selfie && is_writable(__DIR__)) {
|
69 |
| - file_put_contents($selfieFileName, $selfie->getValue(), LOCK_EX); |
| 76 | + file_put_contents($selfieFileName, $selfie->getValue()->getContent(), LOCK_EX); |
70 | 77 | }
|
71 | 78 | } catch(\Exception $e) {
|
72 | 79 | header('Location: /error.php?msg='.$e->getMessage());
|
|
78 | 85 | <head>
|
79 | 86 | <meta charset="utf-8">
|
80 | 87 | <title>Yoti client example</title>
|
81 |
| - |
82 |
| - <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous"> |
83 | 88 | <link rel="stylesheet" type="text/css" href="assets/css/profile.css">
|
| 89 | + <link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet" /> |
84 | 90 | </head>
|
85 | 91 | <body class="yoti-body">
|
86 | 92 | <main class="yoti-profile-layout">
|
|
139 | 145 | </div>
|
140 | 146 |
|
141 | 147 | <div class="yoti-attribute-value">
|
142 |
| - <div class="yoti-attribute-value-text"><?php echo $item['obj']->getValue() ?></div> |
| 148 | + <?php |
| 149 | + $name = $item['name']; |
| 150 | + $attributeObj = $item['obj']; |
| 151 | + switch($name) { |
| 152 | + case 'Date of birth': |
| 153 | + $value = $item['obj']->getValue()->format('d-m-Y'); |
| 154 | + break; |
| 155 | + case 'Age Verification': |
| 156 | + $attributeObj = $item['obj']->getAttribute(); |
| 157 | + $result = $ageVerification->getResult() ? 'Yes' : 'No'; |
| 158 | + $value = $ageVerification->getChecktype() . ':' . $ageVerification->getAge() |
| 159 | + . ' ' . $result; |
| 160 | + break; |
| 161 | + default: |
| 162 | + $value = $item['obj']->getValue(); |
| 163 | + } |
| 164 | + |
| 165 | + $anchors = $attributeObj->getAnchors(); |
| 166 | + ?> |
| 167 | + <div class="yoti-attribute-value-text"><?php echo $value; ?></div> |
143 | 168 | </div>
|
144 | 169 | <div class="yoti-attribute-anchors-layout">
|
145 | 170 | <div class="yoti-attribute-anchors-head -s-v">S / V</div>
|
146 | 171 | <div class="yoti-attribute-anchors-head -value">Value</div>
|
147 | 172 | <div class="yoti-attribute-anchors-head -subtype">Sub type</div>
|
148 | 173 |
|
149 |
| - <?php foreach($item['obj']->getSources() as $source) : ?> |
150 |
| - <div class="yoti-attribute-anchors -s-v">Source</div> |
151 |
| - <div class="yoti-attribute-anchors -value"><?php echo $source->getValue() ?></div> |
152 |
| - <div class="yoti-attribute-anchors -subtype"><?php echo $source->getSubType() ?></div> |
153 |
| - <?php endforeach; ?> |
154 |
| - |
155 |
| - <?php foreach($item['obj']->getVerifiers() as $verifier) : ?> |
156 |
| - <div class="yoti-attribute-anchors -s-v">Verifier</div> |
157 |
| - <div class="yoti-attribute-anchors -value"><?php echo $verifier->getValue() ?></div> |
158 |
| - <div class="yoti-attribute-anchors -subtype"><?php echo $verifier->getSubType() ?></div> |
| 174 | + <?php foreach($anchors as $anchor) : ?> |
| 175 | + <div class="yoti-attribute-anchors -s-v"><?php echo $anchor->getType(); ?></div> |
| 176 | + <div class="yoti-attribute-anchors -value"><?php echo $anchor->getValue() ?></div> |
| 177 | + <div class="yoti-attribute-anchors -subtype"><?php echo $anchor->getSubType() ?></div> |
159 | 178 | <?php endforeach; ?>
|
160 | 179 |
|
161 | 180 | </div>
|
|
0 commit comments