@@ -22,51 +22,51 @@ |
||
22 | 22 | class SearchAuthorizationByCode |
23 | 23 | { |
24 | 24 | |
25 | - public static function main() |
|
26 | - { |
|
25 | + public static function main() |
|
26 | + { |
|
27 | 27 | |
28 | - $authorizationCode = "C7A067F4AEDC4B538242EBBE3B7FB755"; |
|
28 | + $authorizationCode = "C7A067F4AEDC4B538242EBBE3B7FB755"; |
|
29 | 29 | |
30 | - try { |
|
30 | + try { |
|
31 | 31 | |
32 | - /** |
|
33 | - * #### Credentials ##### |
|
34 | - * Replace the parameters below with your credentials |
|
35 | - * You can also get your credentials from a config file. See an example: |
|
36 | - * $credentials = PagSeguroConfig::getApplicationCredentials(); |
|
37 | - */ |
|
38 | - $credentials = new PagSeguroApplicationCredentials("appId", |
|
39 | - "appKey"); |
|
32 | + /** |
|
33 | + * #### Credentials ##### |
|
34 | + * Replace the parameters below with your credentials |
|
35 | + * You can also get your credentials from a config file. See an example: |
|
36 | + * $credentials = PagSeguroConfig::getApplicationCredentials(); |
|
37 | + */ |
|
38 | + $credentials = new PagSeguroApplicationCredentials("appId", |
|
39 | + "appKey"); |
|
40 | 40 | |
41 | - $authorization = PagSeguroAuthorizationSearchService::searchByCode($credentials, $authorizationCode); |
|
41 | + $authorization = PagSeguroAuthorizationSearchService::searchByCode($credentials, $authorizationCode); |
|
42 | 42 | |
43 | - self::printAuthorization($authorization); |
|
43 | + self::printAuthorization($authorization); |
|
44 | 44 | |
45 | - } catch (PagSeguroServiceException $e) { |
|
46 | - die($e->getMessage()); |
|
47 | - } |
|
45 | + } catch (PagSeguroServiceException $e) { |
|
46 | + die($e->getMessage()); |
|
47 | + } |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - public static function printAuthorization(PagSeguroAuthorization $authorization) |
|
52 | - { |
|
51 | + public static function printAuthorization(PagSeguroAuthorization $authorization) |
|
52 | + { |
|
53 | 53 | |
54 | - echo "<h2>Authorization search by Code</h2>"; |
|
55 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
56 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
57 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
58 | - echo "<p><strong>PrivateKey: </strong>" . |
|
59 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
54 | + echo "<h2>Authorization search by Code</h2>"; |
|
55 | + echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
56 | + echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
57 | + echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
58 | + echo "<p><strong>PrivateKey: </strong>" . |
|
59 | + $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
60 | 60 | |
61 | - echo "<h3>Permissions:</h3>"; |
|
62 | - foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
63 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
64 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
65 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
66 | - } |
|
61 | + echo "<h3>Permissions:</h3>"; |
|
62 | + foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
63 | + echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
64 | + echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
65 | + echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | echo "<pre>"; |
69 | - } |
|
69 | + } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | SearchAuthorizationByCode::main(); |
73 | 73 | \ No newline at end of file |
@@ -52,17 +52,17 @@ |
||
52 | 52 | { |
53 | 53 | |
54 | 54 | echo "<h2>Authorization search by Notification Code</h2>"; |
55 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
56 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
57 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
58 | - echo "<p><strong>PrivateKey: </strong>" . |
|
59 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
55 | + echo "<p><strong>Code: </strong>".$authorization->getCode()."</p>"; |
|
56 | + echo "<p><strong>Creation Date: </strong>".$authorization->getCreationDate()."</p>"; |
|
57 | + echo "<p><strong>Reference: </strong>".$authorization->getReference()."</p>"; |
|
58 | + echo "<p><strong>PrivateKey: </strong>". |
|
59 | + $authorization->getAccount()->getPrivateKey()."</p>"; |
|
60 | 60 | |
61 | 61 | echo "<h3>Permissions:</h3>"; |
62 | 62 | foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
63 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
64 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
65 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
63 | + echo "<p><strong>Code: </strong>".$permission->getCode()."</br>"; |
|
64 | + echo "<strong>Status: </strong>".$permission->getStatus()."</br>"; |
|
65 | + echo "<strong>Last Update: </strong>".$permission->getLastUpdate()."</p>"; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | echo "<pre>"; |
@@ -22,51 +22,51 @@ |
||
22 | 22 | class SearchAuthorizationByNotificationCode |
23 | 23 | { |
24 | 24 | |
25 | - public static function main() |
|
26 | - { |
|
25 | + public static function main() |
|
26 | + { |
|
27 | 27 | |
28 | - $notificationCode = "B9BD516853A853A812422463EFBD10FCC88A"; |
|
28 | + $notificationCode = "B9BD516853A853A812422463EFBD10FCC88A"; |
|
29 | 29 | |
30 | - try { |
|
30 | + try { |
|
31 | 31 | |
32 | - /** |
|
33 | - * #### Credentials ##### |
|
34 | - * Replace the parameters below with your credentials |
|
35 | - * You can also get your credentials from a config file. See an example: |
|
36 | - * $credentials = PagSeguroConfig::getApplicationCredentials(); |
|
37 | - */ |
|
38 | - $credentials = new PagSeguroApplicationCredentials("appId", |
|
39 | - "appKey"); |
|
32 | + /** |
|
33 | + * #### Credentials ##### |
|
34 | + * Replace the parameters below with your credentials |
|
35 | + * You can also get your credentials from a config file. See an example: |
|
36 | + * $credentials = PagSeguroConfig::getApplicationCredentials(); |
|
37 | + */ |
|
38 | + $credentials = new PagSeguroApplicationCredentials("appId", |
|
39 | + "appKey"); |
|
40 | 40 | |
41 | - $authorization = PagSeguroAuthorizationSearchService::searchByNotificationCode($credentials, $notificationCode); |
|
41 | + $authorization = PagSeguroAuthorizationSearchService::searchByNotificationCode($credentials, $notificationCode); |
|
42 | 42 | |
43 | - self::printAuthorization($authorization); |
|
43 | + self::printAuthorization($authorization); |
|
44 | 44 | |
45 | - } catch (PagSeguroServiceException $e) { |
|
46 | - die($e->getMessage()); |
|
47 | - } |
|
45 | + } catch (PagSeguroServiceException $e) { |
|
46 | + die($e->getMessage()); |
|
47 | + } |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - public static function printAuthorization(PagSeguroAuthorization $authorization) |
|
52 | - { |
|
51 | + public static function printAuthorization(PagSeguroAuthorization $authorization) |
|
52 | + { |
|
53 | 53 | |
54 | - echo "<h2>Authorization search by Notification Code</h2>"; |
|
55 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
56 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
57 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
58 | - echo "<p><strong>PrivateKey: </strong>" . |
|
59 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
54 | + echo "<h2>Authorization search by Notification Code</h2>"; |
|
55 | + echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
56 | + echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
57 | + echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
58 | + echo "<p><strong>PrivateKey: </strong>" . |
|
59 | + $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
60 | 60 | |
61 | - echo "<h3>Permissions:</h3>"; |
|
62 | - foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
63 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
64 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
65 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
66 | - } |
|
61 | + echo "<h3>Permissions:</h3>"; |
|
62 | + foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
63 | + echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
64 | + echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
65 | + echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
66 | + } |
|
67 | 67 | |
68 | - echo "<pre>"; |
|
69 | - } |
|
68 | + echo "<pre>"; |
|
69 | + } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | SearchAuthorizationByNotificationCode::main(); |
73 | 73 | \ No newline at end of file |
@@ -52,17 +52,17 @@ |
||
52 | 52 | { |
53 | 53 | |
54 | 54 | echo "<h2>Authorization search by Notification Code</h2>"; |
55 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
56 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
57 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
58 | - echo "<p><strong>PrivateKey: </strong>" . |
|
59 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
55 | + echo "<p><strong>Code: </strong>".$authorization->getCode()."</p>"; |
|
56 | + echo "<p><strong>Creation Date: </strong>".$authorization->getCreationDate()."</p>"; |
|
57 | + echo "<p><strong>Reference: </strong>".$authorization->getReference()."</p>"; |
|
58 | + echo "<p><strong>PrivateKey: </strong>". |
|
59 | + $authorization->getAccount()->getPrivateKey()."</p>"; |
|
60 | 60 | |
61 | 61 | echo "<h3>Permissions:</h3>"; |
62 | 62 | foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
63 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
64 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
65 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
63 | + echo "<p><strong>Code: </strong>".$permission->getCode()."</br>"; |
|
64 | + echo "<strong>Status: </strong>".$permission->getStatus()."</br>"; |
|
65 | + echo "<strong>Last Update: </strong>".$permission->getLastUpdate()."</p>"; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | echo "<pre>"; |
@@ -22,75 +22,75 @@ |
||
22 | 22 | class SearchAuthorizationByReference |
23 | 23 | { |
24 | 24 | |
25 | - public static function main() |
|
26 | - { |
|
25 | + public static function main() |
|
26 | + { |
|
27 | 27 | |
28 | - $reference = "REF123"; |
|
28 | + $reference = "REF123"; |
|
29 | 29 | |
30 | - try { |
|
30 | + try { |
|
31 | 31 | |
32 | - /** |
|
33 | - * #### Credentials ##### |
|
34 | - * Replace the parameters below with your credentials |
|
35 | - * You can also get your credentials from a config file. See an example: |
|
36 | - * $credentials = PagSeguroConfig::getApplicationCredentials(); |
|
37 | - */ |
|
32 | + /** |
|
33 | + * #### Credentials ##### |
|
34 | + * Replace the parameters below with your credentials |
|
35 | + * You can also get your credentials from a config file. See an example: |
|
36 | + * $credentials = PagSeguroConfig::getApplicationCredentials(); |
|
37 | + */ |
|
38 | 38 | |
39 | - $credentials = new PagSeguroApplicationCredentials("appId", |
|
40 | - "appKey"); |
|
39 | + $credentials = new PagSeguroApplicationCredentials("appId", |
|
40 | + "appKey"); |
|
41 | 41 | |
42 | - $authorization = PagSeguroAuthorizationSearchService::searchByReference($credentials, $reference); |
|
42 | + $authorization = PagSeguroAuthorizationSearchService::searchByReference($credentials, $reference); |
|
43 | 43 | |
44 | - self::printAuthorization($authorization); |
|
44 | + self::printAuthorization($authorization); |
|
45 | 45 | |
46 | - } catch (PagSeguroServiceException $e) { |
|
47 | - die($e->getMessage()); |
|
48 | - } |
|
46 | + } catch (PagSeguroServiceException $e) { |
|
47 | + die($e->getMessage()); |
|
48 | + } |
|
49 | 49 | |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - public static function printAuthorization($authorization) |
|
53 | - { |
|
52 | + public static function printAuthorization($authorization) |
|
53 | + { |
|
54 | 54 | |
55 | - echo "<h2>Authorization search by Reference</h2>"; |
|
56 | - echo "<p><strong>" . $authorization->getDate() . "</strong></p>"; |
|
55 | + echo "<h2>Authorization search by Reference</h2>"; |
|
56 | + echo "<p><strong>" . $authorization->getDate() . "</strong></p>"; |
|
57 | 57 | |
58 | - if ($authorization->getAuthorizations()) { |
|
59 | - if (is_array($authorization->getAuthorizations())) { |
|
60 | - $i = 0; |
|
61 | - foreach ($authorization->getAuthorizations() as $authorization) { |
|
62 | - echo "<h2> Authorization: " . ++$i . "</h2>"; |
|
63 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
64 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
65 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
66 | - echo "<p><strong>PrivateKey: </strong>" . |
|
67 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
68 | - |
|
69 | - echo "<h3>Permissions:</h3>"; |
|
70 | - foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
71 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
72 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
73 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
74 | - } |
|
75 | - } |
|
76 | - } else { |
|
77 | - $authorization = $authorization->getAuthorizations(); |
|
78 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
79 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
80 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
81 | - echo "<p><strong>PrivateKey: </strong>" . |
|
82 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
83 | - |
|
84 | - echo "<h3>Permissions:</h3>"; |
|
85 | - foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
86 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
87 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
88 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
89 | - } |
|
90 | - } |
|
91 | - } |
|
92 | - echo "<pre>"; |
|
93 | - } |
|
58 | + if ($authorization->getAuthorizations()) { |
|
59 | + if (is_array($authorization->getAuthorizations())) { |
|
60 | + $i = 0; |
|
61 | + foreach ($authorization->getAuthorizations() as $authorization) { |
|
62 | + echo "<h2> Authorization: " . ++$i . "</h2>"; |
|
63 | + echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
64 | + echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
65 | + echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
66 | + echo "<p><strong>PrivateKey: </strong>" . |
|
67 | + $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
68 | + |
|
69 | + echo "<h3>Permissions:</h3>"; |
|
70 | + foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
71 | + echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
72 | + echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
73 | + echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
74 | + } |
|
75 | + } |
|
76 | + } else { |
|
77 | + $authorization = $authorization->getAuthorizations(); |
|
78 | + echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
79 | + echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
80 | + echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
81 | + echo "<p><strong>PrivateKey: </strong>" . |
|
82 | + $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
83 | + |
|
84 | + echo "<h3>Permissions:</h3>"; |
|
85 | + foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
86 | + echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
87 | + echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
88 | + echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
89 | + } |
|
90 | + } |
|
91 | + } |
|
92 | + echo "<pre>"; |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | SearchAuthorizationByReference::main(); |
97 | 97 | \ No newline at end of file |
@@ -56,39 +56,39 @@ |
||
56 | 56 | { |
57 | 57 | |
58 | 58 | echo "<h2>Authorization search by Reference</h2>"; |
59 | - echo "<p><strong>" . $authorization->getDate() . "</strong></p>"; |
|
59 | + echo "<p><strong>".$authorization->getDate()."</strong></p>"; |
|
60 | 60 | |
61 | 61 | if ($authorization->getAuthorizations()) { |
62 | 62 | if (is_array($authorization->getAuthorizations())) { |
63 | 63 | $i = 0; |
64 | 64 | foreach ($authorization->getAuthorizations() as $authorization) { |
65 | - echo "<h2> Authorization: " . ++$i . "</h2>"; |
|
66 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
67 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
68 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
69 | - echo "<p><strong>PrivateKey: </strong>" . |
|
70 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
65 | + echo "<h2> Authorization: ".++$i."</h2>"; |
|
66 | + echo "<p><strong>Code: </strong>".$authorization->getCode()."</p>"; |
|
67 | + echo "<p><strong>Creation Date: </strong>".$authorization->getCreationDate()."</p>"; |
|
68 | + echo "<p><strong>Reference: </strong>".$authorization->getReference()."</p>"; |
|
69 | + echo "<p><strong>PrivateKey: </strong>". |
|
70 | + $authorization->getAccount()->getPrivateKey()."</p>"; |
|
71 | 71 | |
72 | 72 | echo "<h3>Permissions:</h3>"; |
73 | 73 | foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
74 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
75 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
76 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
74 | + echo "<p><strong>Code: </strong>".$permission->getCode()."</br>"; |
|
75 | + echo "<strong>Status: </strong>".$permission->getStatus()."</br>"; |
|
76 | + echo "<strong>Last Update: </strong>".$permission->getLastUpdate()."</p>"; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } else { |
80 | 80 | $authorization = $authorization->getAuthorizations(); |
81 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
82 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
83 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
84 | - echo "<p><strong>PrivateKey: </strong>" . |
|
85 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
81 | + echo "<p><strong>Code: </strong>".$authorization->getCode()."</p>"; |
|
82 | + echo "<p><strong>Creation Date: </strong>".$authorization->getCreationDate()."</p>"; |
|
83 | + echo "<p><strong>Reference: </strong>".$authorization->getReference()."</p>"; |
|
84 | + echo "<p><strong>PrivateKey: </strong>". |
|
85 | + $authorization->getAccount()->getPrivateKey()."</p>"; |
|
86 | 86 | |
87 | 87 | echo "<h3>Permissions:</h3>"; |
88 | 88 | foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
89 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
90 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
91 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
89 | + echo "<p><strong>Code: </strong>".$permission->getCode()."</br>"; |
|
90 | + echo "<strong>Status: </strong>".$permission->getStatus()."</br>"; |
|
91 | + echo "<strong>Last Update: </strong>".$permission->getLastUpdate()."</p>"; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -22,78 +22,78 @@ |
||
22 | 22 | class SearchAuthorizations |
23 | 23 | { |
24 | 24 | |
25 | - public static function main() |
|
26 | - { |
|
25 | + public static function main() |
|
26 | + { |
|
27 | 27 | |
28 | - $options = array( |
|
29 | - 'page' => 1, //optional |
|
30 | - 'maxPageResults' => 1, //optional |
|
31 | - 'initialDate' => '2014-11-23T00:00', //optional |
|
32 | - 'finalDate' => '2014-12-02T10:00' //optional |
|
33 | - ); |
|
28 | + $options = array( |
|
29 | + 'page' => 1, //optional |
|
30 | + 'maxPageResults' => 1, //optional |
|
31 | + 'initialDate' => '2014-11-23T00:00', //optional |
|
32 | + 'finalDate' => '2014-12-02T10:00' //optional |
|
33 | + ); |
|
34 | 34 | |
35 | - try { |
|
35 | + try { |
|
36 | 36 | |
37 | - /* |
|
37 | + /* |
|
38 | 38 | * #### Credentials ##### |
39 | 39 | * Replace the parameters below with your credentials |
40 | 40 | * You can also get your credentials from a config file. See an example: |
41 | 41 | * $credentials = PagSeguroConfig::getApplicationCredentials() |
42 | 42 | */ |
43 | - $credentials = new PagSeguroApplicationCredentials("appId", |
|
44 | - "appKey"); |
|
43 | + $credentials = new PagSeguroApplicationCredentials("appId", |
|
44 | + "appKey"); |
|
45 | 45 | |
46 | - $authorization = PagSeguroAuthorizationSearchService::searchAuthorizations($credentials, $options); |
|
46 | + $authorization = PagSeguroAuthorizationSearchService::searchAuthorizations($credentials, $options); |
|
47 | 47 | |
48 | - self::printAuthorization($authorization); |
|
48 | + self::printAuthorization($authorization); |
|
49 | 49 | |
50 | - } catch (PagSeguroServiceException $e) { |
|
51 | - die($e->getMessage()); |
|
52 | - } |
|
53 | - } |
|
50 | + } catch (PagSeguroServiceException $e) { |
|
51 | + die($e->getMessage()); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - public static function printAuthorization($authorization) |
|
56 | - { |
|
55 | + public static function printAuthorization($authorization) |
|
56 | + { |
|
57 | 57 | |
58 | - echo "<h2>Authorization search by Reference</h2>"; |
|
59 | - echo "<p><strong>" . $authorization->getDate() . "</strong></p>"; |
|
58 | + echo "<h2>Authorization search by Reference</h2>"; |
|
59 | + echo "<p><strong>" . $authorization->getDate() . "</strong></p>"; |
|
60 | 60 | |
61 | - if ($authorization->getAuthorizations()) { |
|
62 | - if (is_array($authorization->getAuthorizations())) { |
|
63 | - $i = 0; |
|
64 | - foreach ($authorization->getAuthorizations() as $authorization) { |
|
65 | - echo "<h2> Authorization: " . ++$i . "</h2>"; |
|
66 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
67 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
68 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
69 | - echo "<p><strong>PrivateKey: </strong>" . |
|
70 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
71 | - |
|
72 | - echo "<h3>Permissions:</h3>"; |
|
73 | - foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
74 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
75 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
76 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
77 | - } |
|
78 | - } |
|
79 | - } else { |
|
80 | - $authorization = $authorization->getAuthorizations(); |
|
81 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
82 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
83 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
84 | - echo "<p><strong>PrivateKey: </strong>" . |
|
85 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
86 | - |
|
87 | - echo "<h3>Permissions:</h3>"; |
|
88 | - foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
89 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
90 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
91 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
95 | - echo "<pre>"; |
|
96 | - } |
|
61 | + if ($authorization->getAuthorizations()) { |
|
62 | + if (is_array($authorization->getAuthorizations())) { |
|
63 | + $i = 0; |
|
64 | + foreach ($authorization->getAuthorizations() as $authorization) { |
|
65 | + echo "<h2> Authorization: " . ++$i . "</h2>"; |
|
66 | + echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
67 | + echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
68 | + echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
69 | + echo "<p><strong>PrivateKey: </strong>" . |
|
70 | + $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
71 | + |
|
72 | + echo "<h3>Permissions:</h3>"; |
|
73 | + foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
74 | + echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
75 | + echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
76 | + echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
77 | + } |
|
78 | + } |
|
79 | + } else { |
|
80 | + $authorization = $authorization->getAuthorizations(); |
|
81 | + echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
82 | + echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
83 | + echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
84 | + echo "<p><strong>PrivateKey: </strong>" . |
|
85 | + $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
86 | + |
|
87 | + echo "<h3>Permissions:</h3>"; |
|
88 | + foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
|
89 | + echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
90 | + echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
91 | + echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | + echo "<pre>"; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | SearchAuthorizations::main(); |
100 | 100 | \ No newline at end of file |
@@ -56,39 +56,39 @@ |
||
56 | 56 | { |
57 | 57 | |
58 | 58 | echo "<h2>Authorization search by Reference</h2>"; |
59 | - echo "<p><strong>" . $authorization->getDate() . "</strong></p>"; |
|
59 | + echo "<p><strong>".$authorization->getDate()."</strong></p>"; |
|
60 | 60 | |
61 | 61 | if ($authorization->getAuthorizations()) { |
62 | 62 | if (is_array($authorization->getAuthorizations())) { |
63 | 63 | $i = 0; |
64 | 64 | foreach ($authorization->getAuthorizations() as $authorization) { |
65 | - echo "<h2> Authorization: " . ++$i . "</h2>"; |
|
66 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
67 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
68 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
69 | - echo "<p><strong>PrivateKey: </strong>" . |
|
70 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
65 | + echo "<h2> Authorization: ".++$i."</h2>"; |
|
66 | + echo "<p><strong>Code: </strong>".$authorization->getCode()."</p>"; |
|
67 | + echo "<p><strong>Creation Date: </strong>".$authorization->getCreationDate()."</p>"; |
|
68 | + echo "<p><strong>Reference: </strong>".$authorization->getReference()."</p>"; |
|
69 | + echo "<p><strong>PrivateKey: </strong>". |
|
70 | + $authorization->getAccount()->getPrivateKey()."</p>"; |
|
71 | 71 | |
72 | 72 | echo "<h3>Permissions:</h3>"; |
73 | 73 | foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
74 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
75 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
76 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
74 | + echo "<p><strong>Code: </strong>".$permission->getCode()."</br>"; |
|
75 | + echo "<strong>Status: </strong>".$permission->getStatus()."</br>"; |
|
76 | + echo "<strong>Last Update: </strong>".$permission->getLastUpdate()."</p>"; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } else { |
80 | 80 | $authorization = $authorization->getAuthorizations(); |
81 | - echo "<p><strong>Code: </strong>" . $authorization->getCode() . "</p>"; |
|
82 | - echo "<p><strong>Creation Date: </strong>" . $authorization->getCreationDate() . "</p>"; |
|
83 | - echo "<p><strong>Reference: </strong>" . $authorization->getReference() . "</p>"; |
|
84 | - echo "<p><strong>PrivateKey: </strong>" . |
|
85 | - $authorization->getAccount()->getPrivateKey() . "</p>"; |
|
81 | + echo "<p><strong>Code: </strong>".$authorization->getCode()."</p>"; |
|
82 | + echo "<p><strong>Creation Date: </strong>".$authorization->getCreationDate()."</p>"; |
|
83 | + echo "<p><strong>Reference: </strong>".$authorization->getReference()."</p>"; |
|
84 | + echo "<p><strong>PrivateKey: </strong>". |
|
85 | + $authorization->getAccount()->getPrivateKey()."</p>"; |
|
86 | 86 | |
87 | 87 | echo "<h3>Permissions:</h3>"; |
88 | 88 | foreach ($authorization->getPermissions()->getPermissions() as $permission) { |
89 | - echo "<p><strong>Code: </strong>" . $permission->getCode() . "</br>"; |
|
90 | - echo "<strong>Status: </strong>" . $permission->getStatus() . "</br>"; |
|
91 | - echo "<strong>Last Update: </strong>" . $permission->getLastUpdate() . "</p>"; |
|
89 | + echo "<p><strong>Code: </strong>".$permission->getCode()."</br>"; |
|
90 | + echo "<strong>Status: </strong>".$permission->getStatus()."</br>"; |
|
91 | + echo "<strong>Last Update: </strong>".$permission->getLastUpdate()."</p>"; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -22,96 +22,96 @@ |
||
22 | 22 | class SearchTransactionByCode |
23 | 23 | { |
24 | 24 | |
25 | - public static function main() |
|
26 | - { |
|
25 | + public static function main() |
|
26 | + { |
|
27 | 27 | |
28 | - $transaction_code = 'FC138A0E-C734-44A8-A9B7-6A79E1E33292'; |
|
28 | + $transaction_code = 'FC138A0E-C734-44A8-A9B7-6A79E1E33292'; |
|
29 | 29 | |
30 | - try { |
|
30 | + try { |
|
31 | 31 | |
32 | - /* |
|
32 | + /* |
|
33 | 33 | * #### Credentials ##### |
34 | 34 | * Replace the parameters below with your credentials |
35 | 35 | * You can also get your credentials from a config file. See an example: |
36 | 36 | * $credentials = PagSeguroConfig::getAccountCredentials(); |
37 | 37 | */ |
38 | - // seller authentication |
|
39 | - $credentials = new PagSeguroAccountCredentials("[email protected]", |
|
40 | - "E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
41 | - |
|
42 | - // application authentication |
|
43 | - //$credentials = PagSeguroConfig::getApplicationCredentials(); |
|
44 | - |
|
45 | - //$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
46 | - |
|
47 | - $transaction = PagSeguroTransactionSearchService::searchByCode($credentials, $transaction_code); |
|
48 | - |
|
49 | - self::printTransaction($transaction); |
|
50 | - |
|
51 | - } catch (PagSeguroServiceException $e) { |
|
52 | - die($e->getMessage()); |
|
53 | - } |
|
54 | - |
|
55 | - } |
|
56 | - |
|
57 | - public static function printTransaction(PagSeguroTransaction $transaction) |
|
58 | - { |
|
59 | - |
|
60 | - echo "<h2>Transaction search by code result"; |
|
61 | - echo "<h3>Code: " . $transaction->getCode() . '</h3>'; |
|
62 | - echo "<h3>Status: " . $transaction->getStatus()->getTypeFromValue() . '</h3>'; |
|
63 | - echo "<h4>Reference: " . $transaction->getReference() . "</h4>"; |
|
64 | - |
|
65 | - echo "grossAmount: " . $transaction->getGrossAmount() . '<br>'; |
|
66 | - echo "discountAmount: " . $transaction->getDiscountAmount() . '<br>'; |
|
67 | - echo "installmentCount: " . $transaction->getInstallmentCount() . '<br>'; |
|
68 | - |
|
69 | - if ($transaction->getCreditorFees()) { |
|
70 | - echo "<h4>CreditorFees:</h4>"; |
|
71 | - echo "intermediationRateAmount: " . $transaction->getCreditorFees()->getIntermediationRateAmount() . '<br>'; |
|
72 | - echo "intermediationFeeAmount: " . $transaction->getCreditorFees()->getIntermediationFeeAmount() . '<br>'; |
|
73 | - } |
|
74 | - |
|
75 | - if ($transaction->getItems()) { |
|
76 | - echo "<h4>Items:</h4>"; |
|
77 | - if (is_array($transaction->getItems())) { |
|
78 | - foreach ($transaction->getItems() as $key => $item) { |
|
79 | - echo "Id: " . $item->getId() . '<br>'; // prints the item id, e.g. I39 |
|
80 | - echo "Description: " . $item->getDescription() . |
|
81 | - '<br>'; // prints the item description, e.g. Notebook prata |
|
82 | - echo "Quantidade: " . $item->getQuantity() . '<br>'; // prints the item quantity, e.g. 1 |
|
83 | - echo "Amount: " . $item->getAmount() . '<br>'; // prints the item unit value, e.g. 3050.68 |
|
84 | - echo "<hr>"; |
|
85 | - } |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - if ($transaction->getSender()) { |
|
90 | - echo "<h4>Sender data:</h4>"; |
|
91 | - echo "Name: " . $transaction->getSender()->getName() . '<br>'; |
|
92 | - echo "Email: " . $transaction->getSender()->getEmail() . '<br>'; |
|
93 | - if ($transaction->getSender()->getPhone()) { |
|
94 | - echo "Phone: " . $transaction->getSender()->getPhone()->getAreaCode() . " - " . |
|
95 | - $transaction->getSender()->getPhone()->getNumber(); |
|
96 | - } |
|
97 | - } |
|
98 | - |
|
99 | - if ($transaction->getShipping()) { |
|
100 | - echo "<h4>Shipping information:</h4>"; |
|
101 | - if ($transaction->getShipping()->getAddress()) { |
|
102 | - echo "Postal code: " . $transaction->getShipping()->getAddress()->getPostalCode() . '<br>'; |
|
103 | - echo "Street: " . $transaction->getShipping()->getAddress()->getStreet() . '<br>'; |
|
104 | - echo "Number: " . $transaction->getShipping()->getAddress()->getNumber() . '<br>'; |
|
105 | - echo "Complement: " . $transaction->getShipping()->getAddress()->getComplement() . '<br>'; |
|
106 | - echo "District: " . $transaction->getShipping()->getAddress()->getDistrict() . '<br>'; |
|
107 | - echo "City: " . $transaction->getShipping()->getAddress()->getCity() . '<br>'; |
|
108 | - echo "State: " . $transaction->getShipping()->getAddress()->getState() . '<br>'; |
|
109 | - echo "Country: " . $transaction->getShipping()->getAddress()->getCountry() . '<br>'; |
|
110 | - } |
|
111 | - echo "Shipping type: " . $transaction->getShipping()->getType()->getTypeFromValue() . '<br>'; |
|
112 | - echo "Shipping cost: " . $transaction->getShipping()->getCost() . '<br>'; |
|
113 | - } |
|
114 | - } |
|
38 | + // seller authentication |
|
39 | + $credentials = new PagSeguroAccountCredentials("[email protected]", |
|
40 | + "E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
41 | + |
|
42 | + // application authentication |
|
43 | + //$credentials = PagSeguroConfig::getApplicationCredentials(); |
|
44 | + |
|
45 | + //$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
46 | + |
|
47 | + $transaction = PagSeguroTransactionSearchService::searchByCode($credentials, $transaction_code); |
|
48 | + |
|
49 | + self::printTransaction($transaction); |
|
50 | + |
|
51 | + } catch (PagSeguroServiceException $e) { |
|
52 | + die($e->getMessage()); |
|
53 | + } |
|
54 | + |
|
55 | + } |
|
56 | + |
|
57 | + public static function printTransaction(PagSeguroTransaction $transaction) |
|
58 | + { |
|
59 | + |
|
60 | + echo "<h2>Transaction search by code result"; |
|
61 | + echo "<h3>Code: " . $transaction->getCode() . '</h3>'; |
|
62 | + echo "<h3>Status: " . $transaction->getStatus()->getTypeFromValue() . '</h3>'; |
|
63 | + echo "<h4>Reference: " . $transaction->getReference() . "</h4>"; |
|
64 | + |
|
65 | + echo "grossAmount: " . $transaction->getGrossAmount() . '<br>'; |
|
66 | + echo "discountAmount: " . $transaction->getDiscountAmount() . '<br>'; |
|
67 | + echo "installmentCount: " . $transaction->getInstallmentCount() . '<br>'; |
|
68 | + |
|
69 | + if ($transaction->getCreditorFees()) { |
|
70 | + echo "<h4>CreditorFees:</h4>"; |
|
71 | + echo "intermediationRateAmount: " . $transaction->getCreditorFees()->getIntermediationRateAmount() . '<br>'; |
|
72 | + echo "intermediationFeeAmount: " . $transaction->getCreditorFees()->getIntermediationFeeAmount() . '<br>'; |
|
73 | + } |
|
74 | + |
|
75 | + if ($transaction->getItems()) { |
|
76 | + echo "<h4>Items:</h4>"; |
|
77 | + if (is_array($transaction->getItems())) { |
|
78 | + foreach ($transaction->getItems() as $key => $item) { |
|
79 | + echo "Id: " . $item->getId() . '<br>'; // prints the item id, e.g. I39 |
|
80 | + echo "Description: " . $item->getDescription() . |
|
81 | + '<br>'; // prints the item description, e.g. Notebook prata |
|
82 | + echo "Quantidade: " . $item->getQuantity() . '<br>'; // prints the item quantity, e.g. 1 |
|
83 | + echo "Amount: " . $item->getAmount() . '<br>'; // prints the item unit value, e.g. 3050.68 |
|
84 | + echo "<hr>"; |
|
85 | + } |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + if ($transaction->getSender()) { |
|
90 | + echo "<h4>Sender data:</h4>"; |
|
91 | + echo "Name: " . $transaction->getSender()->getName() . '<br>'; |
|
92 | + echo "Email: " . $transaction->getSender()->getEmail() . '<br>'; |
|
93 | + if ($transaction->getSender()->getPhone()) { |
|
94 | + echo "Phone: " . $transaction->getSender()->getPhone()->getAreaCode() . " - " . |
|
95 | + $transaction->getSender()->getPhone()->getNumber(); |
|
96 | + } |
|
97 | + } |
|
98 | + |
|
99 | + if ($transaction->getShipping()) { |
|
100 | + echo "<h4>Shipping information:</h4>"; |
|
101 | + if ($transaction->getShipping()->getAddress()) { |
|
102 | + echo "Postal code: " . $transaction->getShipping()->getAddress()->getPostalCode() . '<br>'; |
|
103 | + echo "Street: " . $transaction->getShipping()->getAddress()->getStreet() . '<br>'; |
|
104 | + echo "Number: " . $transaction->getShipping()->getAddress()->getNumber() . '<br>'; |
|
105 | + echo "Complement: " . $transaction->getShipping()->getAddress()->getComplement() . '<br>'; |
|
106 | + echo "District: " . $transaction->getShipping()->getAddress()->getDistrict() . '<br>'; |
|
107 | + echo "City: " . $transaction->getShipping()->getAddress()->getCity() . '<br>'; |
|
108 | + echo "State: " . $transaction->getShipping()->getAddress()->getState() . '<br>'; |
|
109 | + echo "Country: " . $transaction->getShipping()->getAddress()->getCountry() . '<br>'; |
|
110 | + } |
|
111 | + echo "Shipping type: " . $transaction->getShipping()->getType()->getTypeFromValue() . '<br>'; |
|
112 | + echo "Shipping cost: " . $transaction->getShipping()->getCost() . '<br>'; |
|
113 | + } |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | SearchTransactionByCode::main(); |
118 | 118 | \ No newline at end of file |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | { |
59 | 59 | |
60 | 60 | echo "<h2>Transaction search by code result"; |
61 | - echo "<h3>Code: " . $transaction->getCode() . '</h3>'; |
|
62 | - echo "<h3>Status: " . $transaction->getStatus()->getTypeFromValue() . '</h3>'; |
|
63 | - echo "<h4>Reference: " . $transaction->getReference() . "</h4>"; |
|
61 | + echo "<h3>Code: ".$transaction->getCode().'</h3>'; |
|
62 | + echo "<h3>Status: ".$transaction->getStatus()->getTypeFromValue().'</h3>'; |
|
63 | + echo "<h4>Reference: ".$transaction->getReference()."</h4>"; |
|
64 | 64 | |
65 | - echo "grossAmount: " . $transaction->getGrossAmount() . '<br>'; |
|
66 | - echo "discountAmount: " . $transaction->getDiscountAmount() . '<br>'; |
|
67 | - echo "installmentCount: " . $transaction->getInstallmentCount() . '<br>'; |
|
65 | + echo "grossAmount: ".$transaction->getGrossAmount().'<br>'; |
|
66 | + echo "discountAmount: ".$transaction->getDiscountAmount().'<br>'; |
|
67 | + echo "installmentCount: ".$transaction->getInstallmentCount().'<br>'; |
|
68 | 68 | |
69 | 69 | if ($transaction->getCreditorFees()) { |
70 | 70 | echo "<h4>CreditorFees:</h4>"; |
71 | - echo "intermediationRateAmount: " . $transaction->getCreditorFees()->getIntermediationRateAmount() . '<br>'; |
|
72 | - echo "intermediationFeeAmount: " . $transaction->getCreditorFees()->getIntermediationFeeAmount() . '<br>'; |
|
71 | + echo "intermediationRateAmount: ".$transaction->getCreditorFees()->getIntermediationRateAmount().'<br>'; |
|
72 | + echo "intermediationFeeAmount: ".$transaction->getCreditorFees()->getIntermediationFeeAmount().'<br>'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($transaction->getItems()) { |
76 | 76 | echo "<h4>Items:</h4>"; |
77 | 77 | if (is_array($transaction->getItems())) { |
78 | 78 | foreach ($transaction->getItems() as $key => $item) { |
79 | - echo "Id: " . $item->getId() . '<br>'; // prints the item id, e.g. I39 |
|
80 | - echo "Description: " . $item->getDescription() . |
|
79 | + echo "Id: ".$item->getId().'<br>'; // prints the item id, e.g. I39 |
|
80 | + echo "Description: ".$item->getDescription(). |
|
81 | 81 | '<br>'; // prints the item description, e.g. Notebook prata |
82 | - echo "Quantidade: " . $item->getQuantity() . '<br>'; // prints the item quantity, e.g. 1 |
|
83 | - echo "Amount: " . $item->getAmount() . '<br>'; // prints the item unit value, e.g. 3050.68 |
|
82 | + echo "Quantidade: ".$item->getQuantity().'<br>'; // prints the item quantity, e.g. 1 |
|
83 | + echo "Amount: ".$item->getAmount().'<br>'; // prints the item unit value, e.g. 3050.68 |
|
84 | 84 | echo "<hr>"; |
85 | 85 | } |
86 | 86 | } |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | if ($transaction->getSender()) { |
90 | 90 | echo "<h4>Sender data:</h4>"; |
91 | - echo "Name: " . $transaction->getSender()->getName() . '<br>'; |
|
92 | - echo "Email: " . $transaction->getSender()->getEmail() . '<br>'; |
|
91 | + echo "Name: ".$transaction->getSender()->getName().'<br>'; |
|
92 | + echo "Email: ".$transaction->getSender()->getEmail().'<br>'; |
|
93 | 93 | if ($transaction->getSender()->getPhone()) { |
94 | - echo "Phone: " . $transaction->getSender()->getPhone()->getAreaCode() . " - " . |
|
94 | + echo "Phone: ".$transaction->getSender()->getPhone()->getAreaCode()." - ". |
|
95 | 95 | $transaction->getSender()->getPhone()->getNumber(); |
96 | 96 | } |
97 | 97 | } |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | if ($transaction->getShipping()) { |
100 | 100 | echo "<h4>Shipping information:</h4>"; |
101 | 101 | if ($transaction->getShipping()->getAddress()) { |
102 | - echo "Postal code: " . $transaction->getShipping()->getAddress()->getPostalCode() . '<br>'; |
|
103 | - echo "Street: " . $transaction->getShipping()->getAddress()->getStreet() . '<br>'; |
|
104 | - echo "Number: " . $transaction->getShipping()->getAddress()->getNumber() . '<br>'; |
|
105 | - echo "Complement: " . $transaction->getShipping()->getAddress()->getComplement() . '<br>'; |
|
106 | - echo "District: " . $transaction->getShipping()->getAddress()->getDistrict() . '<br>'; |
|
107 | - echo "City: " . $transaction->getShipping()->getAddress()->getCity() . '<br>'; |
|
108 | - echo "State: " . $transaction->getShipping()->getAddress()->getState() . '<br>'; |
|
109 | - echo "Country: " . $transaction->getShipping()->getAddress()->getCountry() . '<br>'; |
|
102 | + echo "Postal code: ".$transaction->getShipping()->getAddress()->getPostalCode().'<br>'; |
|
103 | + echo "Street: ".$transaction->getShipping()->getAddress()->getStreet().'<br>'; |
|
104 | + echo "Number: ".$transaction->getShipping()->getAddress()->getNumber().'<br>'; |
|
105 | + echo "Complement: ".$transaction->getShipping()->getAddress()->getComplement().'<br>'; |
|
106 | + echo "District: ".$transaction->getShipping()->getAddress()->getDistrict().'<br>'; |
|
107 | + echo "City: ".$transaction->getShipping()->getAddress()->getCity().'<br>'; |
|
108 | + echo "State: ".$transaction->getShipping()->getAddress()->getState().'<br>'; |
|
109 | + echo "Country: ".$transaction->getShipping()->getAddress()->getCountry().'<br>'; |
|
110 | 110 | } |
111 | - echo "Shipping type: " . $transaction->getShipping()->getType()->getTypeFromValue() . '<br>'; |
|
112 | - echo "Shipping cost: " . $transaction->getShipping()->getCost() . '<br>'; |
|
111 | + echo "Shipping type: ".$transaction->getShipping()->getType()->getTypeFromValue().'<br>'; |
|
112 | + echo "Shipping cost: ".$transaction->getShipping()->getCost().'<br>'; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
@@ -22,63 +22,63 @@ |
||
22 | 22 | class SearchTransactionsAbandoned |
23 | 23 | { |
24 | 24 | |
25 | - public static function main() |
|
26 | - { |
|
25 | + public static function main() |
|
26 | + { |
|
27 | 27 | |
28 | - $initialDate = '2014-11-01T14:55'; |
|
29 | - $finalDate = '2014-11-30T09:55'; |
|
28 | + $initialDate = '2014-11-01T14:55'; |
|
29 | + $finalDate = '2014-11-30T09:55'; |
|
30 | 30 | |
31 | - $pageNumber = 1; |
|
32 | - $maxPageResults = 20; |
|
31 | + $pageNumber = 1; |
|
32 | + $maxPageResults = 20; |
|
33 | 33 | |
34 | - try { |
|
34 | + try { |
|
35 | 35 | |
36 | - /* |
|
36 | + /* |
|
37 | 37 | * #### Credentials ##### |
38 | 38 | * Substitute the parameters below with your credentials |
39 | 39 | * You can also get your credentials from a config file. See an example: |
40 | 40 | * $credentials = PagSeguroConfig::getAccountCredentials(); |
41 | 41 | */ |
42 | - // seller authentication |
|
43 | - $credentials = new PagSeguroAccountCredentials("[email protected]", |
|
44 | - "E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
45 | - |
|
46 | - // application authentication |
|
47 | - //$credentials = PagSeguroConfig::getApplicationCredentials(); |
|
48 | - |
|
49 | - //$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
50 | - |
|
51 | - $result = PagSeguroTransactionSearchService::searchAbandoned( |
|
52 | - $credentials, |
|
53 | - $pageNumber, |
|
54 | - $maxPageResults, |
|
55 | - $initialDate, |
|
56 | - $finalDate |
|
57 | - ); |
|
58 | - |
|
59 | - self::printResult($result, $initialDate, $finalDate); |
|
60 | - |
|
61 | - } catch (PagSeguroServiceException $e) { |
|
62 | - die($e->getMessage()); |
|
63 | - } |
|
64 | - |
|
65 | - } |
|
66 | - |
|
67 | - public static function printResult(PagSeguroTransactionSearchResult $result, $initialDate, $finalDate) |
|
68 | - { |
|
69 | - $finalDate = $finalDate ? $finalDate : 'now'; |
|
70 | - echo "<h2>Search transactions abandoned</h2>"; |
|
71 | - echo "<h3>$initialDate to $finalDate</h3>"; |
|
72 | - $transactions = $result->getTransactions(); |
|
73 | - if (is_array($transactions) && count($transactions) > 0) { |
|
74 | - foreach ($transactions as $key => $transactionSummary) { |
|
75 | - echo "Code: " . $transactionSummary->getCode() . "<br>"; |
|
76 | - echo "Reference: " . $transactionSummary->getReference() . "<br>"; |
|
77 | - echo "Amount: " . $transactionSummary->getGrossAmount() . "<br>"; |
|
78 | - echo "<hr>"; |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
42 | + // seller authentication |
|
43 | + $credentials = new PagSeguroAccountCredentials("[email protected]", |
|
44 | + "E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
45 | + |
|
46 | + // application authentication |
|
47 | + //$credentials = PagSeguroConfig::getApplicationCredentials(); |
|
48 | + |
|
49 | + //$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
50 | + |
|
51 | + $result = PagSeguroTransactionSearchService::searchAbandoned( |
|
52 | + $credentials, |
|
53 | + $pageNumber, |
|
54 | + $maxPageResults, |
|
55 | + $initialDate, |
|
56 | + $finalDate |
|
57 | + ); |
|
58 | + |
|
59 | + self::printResult($result, $initialDate, $finalDate); |
|
60 | + |
|
61 | + } catch (PagSeguroServiceException $e) { |
|
62 | + die($e->getMessage()); |
|
63 | + } |
|
64 | + |
|
65 | + } |
|
66 | + |
|
67 | + public static function printResult(PagSeguroTransactionSearchResult $result, $initialDate, $finalDate) |
|
68 | + { |
|
69 | + $finalDate = $finalDate ? $finalDate : 'now'; |
|
70 | + echo "<h2>Search transactions abandoned</h2>"; |
|
71 | + echo "<h3>$initialDate to $finalDate</h3>"; |
|
72 | + $transactions = $result->getTransactions(); |
|
73 | + if (is_array($transactions) && count($transactions) > 0) { |
|
74 | + foreach ($transactions as $key => $transactionSummary) { |
|
75 | + echo "Code: " . $transactionSummary->getCode() . "<br>"; |
|
76 | + echo "Reference: " . $transactionSummary->getReference() . "<br>"; |
|
77 | + echo "Amount: " . $transactionSummary->getGrossAmount() . "<br>"; |
|
78 | + echo "<hr>"; |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | SearchTransactionsAbandoned::main(); |
@@ -72,9 +72,9 @@ |
||
72 | 72 | $transactions = $result->getTransactions(); |
73 | 73 | if (is_array($transactions) && count($transactions) > 0) { |
74 | 74 | foreach ($transactions as $key => $transactionSummary) { |
75 | - echo "Code: " . $transactionSummary->getCode() . "<br>"; |
|
76 | - echo "Reference: " . $transactionSummary->getReference() . "<br>"; |
|
77 | - echo "Amount: " . $transactionSummary->getGrossAmount() . "<br>"; |
|
75 | + echo "Code: ".$transactionSummary->getCode()."<br>"; |
|
76 | + echo "Reference: ".$transactionSummary->getReference()."<br>"; |
|
77 | + echo "Amount: ".$transactionSummary->getGrossAmount()."<br>"; |
|
78 | 78 | echo "<hr>"; |
79 | 79 | } |
80 | 80 | } |
@@ -22,63 +22,63 @@ |
||
22 | 22 | class SearchTransactionsByDateInterval |
23 | 23 | { |
24 | 24 | |
25 | - public static function main() |
|
26 | - { |
|
25 | + public static function main() |
|
26 | + { |
|
27 | 27 | |
28 | - $initialDate = '2014-11-01T14:55'; |
|
29 | - $finalDate = '2014-11-30T09:55'; |
|
28 | + $initialDate = '2014-11-01T14:55'; |
|
29 | + $finalDate = '2014-11-30T09:55'; |
|
30 | 30 | |
31 | - $pageNumber = 1; |
|
32 | - $maxPageResults = 20; |
|
31 | + $pageNumber = 1; |
|
32 | + $maxPageResults = 20; |
|
33 | 33 | |
34 | - try { |
|
34 | + try { |
|
35 | 35 | |
36 | - /* |
|
36 | + /* |
|
37 | 37 | * #### Credentials ##### |
38 | 38 | * Substitute the parameters below with your credentials |
39 | 39 | * You can also get your credentials from a config file. See an example: |
40 | 40 | * $credentials = PagSeguroConfig::getAccountCredentials(); |
41 | 41 | */ |
42 | - // seller authentication |
|
43 | - $credentials = new PagSeguroAccountCredentials("[email protected]", |
|
44 | - "E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
45 | - |
|
46 | - // application authentication |
|
47 | - //$credentials = PagSeguroConfig::getApplicationCredentials(); |
|
48 | - |
|
49 | - //$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
50 | - |
|
51 | - $result = PagSeguroTransactionSearchService::searchByDate( |
|
52 | - $credentials, |
|
53 | - $pageNumber, |
|
54 | - $maxPageResults, |
|
55 | - $initialDate, |
|
56 | - $finalDate |
|
57 | - ); |
|
58 | - |
|
59 | - self::printResult($result, $initialDate, $finalDate); |
|
60 | - |
|
61 | - } catch (PagSeguroServiceException $e) { |
|
62 | - die($e->getMessage()); |
|
63 | - } |
|
64 | - |
|
65 | - } |
|
66 | - |
|
67 | - public static function printResult(PagSeguroTransactionSearchResult $result, $initialDate, $finalDate) |
|
68 | - { |
|
69 | - $finalDate = $finalDate ? $finalDate : 'now'; |
|
70 | - echo "<h2>Search transactions by date</h2>"; |
|
71 | - echo "<h3>$initialDate to $finalDate</h3>"; |
|
72 | - $transactions = $result->getTransactions(); |
|
73 | - if (is_array($transactions) && count($transactions) > 0) { |
|
74 | - foreach ($transactions as $key => $transactionSummary) { |
|
75 | - echo "Code: " . $transactionSummary->getCode() . "<br>"; |
|
76 | - echo "Reference: " . $transactionSummary->getReference() . "<br>"; |
|
77 | - echo "amount: " . $transactionSummary->getGrossAmount() . "<br>"; |
|
78 | - echo "<hr>"; |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
42 | + // seller authentication |
|
43 | + $credentials = new PagSeguroAccountCredentials("[email protected]", |
|
44 | + "E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
45 | + |
|
46 | + // application authentication |
|
47 | + //$credentials = PagSeguroConfig::getApplicationCredentials(); |
|
48 | + |
|
49 | + //$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3"); |
|
50 | + |
|
51 | + $result = PagSeguroTransactionSearchService::searchByDate( |
|
52 | + $credentials, |
|
53 | + $pageNumber, |
|
54 | + $maxPageResults, |
|
55 | + $initialDate, |
|
56 | + $finalDate |
|
57 | + ); |
|
58 | + |
|
59 | + self::printResult($result, $initialDate, $finalDate); |
|
60 | + |
|
61 | + } catch (PagSeguroServiceException $e) { |
|
62 | + die($e->getMessage()); |
|
63 | + } |
|
64 | + |
|
65 | + } |
|
66 | + |
|
67 | + public static function printResult(PagSeguroTransactionSearchResult $result, $initialDate, $finalDate) |
|
68 | + { |
|
69 | + $finalDate = $finalDate ? $finalDate : 'now'; |
|
70 | + echo "<h2>Search transactions by date</h2>"; |
|
71 | + echo "<h3>$initialDate to $finalDate</h3>"; |
|
72 | + $transactions = $result->getTransactions(); |
|
73 | + if (is_array($transactions) && count($transactions) > 0) { |
|
74 | + foreach ($transactions as $key => $transactionSummary) { |
|
75 | + echo "Code: " . $transactionSummary->getCode() . "<br>"; |
|
76 | + echo "Reference: " . $transactionSummary->getReference() . "<br>"; |
|
77 | + echo "amount: " . $transactionSummary->getGrossAmount() . "<br>"; |
|
78 | + echo "<hr>"; |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | SearchTransactionsByDateInterval::main(); |
85 | 85 | \ No newline at end of file |
@@ -66,6 +66,10 @@ |
||
66 | 66 | |
67 | 67 | } |
68 | 68 | |
69 | + /** |
|
70 | + * @param string $initialDate |
|
71 | + * @param string $finalDate |
|
72 | + */ |
|
69 | 73 | public static function printResult(PagSeguroTransactionSearchResult $result, $initialDate, $finalDate) |
70 | 74 | { |
71 | 75 | $finalDate = $finalDate ? $finalDate : 'now'; |
@@ -74,9 +74,9 @@ |
||
74 | 74 | $transactions = $result->getTransactions(); |
75 | 75 | if (is_array($transactions) && count($transactions) > 0) { |
76 | 76 | foreach ($transactions as $key => $transactionSummary) { |
77 | - echo "Code: " . $transactionSummary->getCode() . "<br>"; |
|
78 | - echo "Reference: " . $transactionSummary->getReference() . "<br>"; |
|
79 | - echo "amount: " . $transactionSummary->getGrossAmount() . "<br>"; |
|
77 | + echo "Code: ".$transactionSummary->getCode()."<br>"; |
|
78 | + echo "Reference: ".$transactionSummary->getReference()."<br>"; |
|
79 | + echo "amount: ".$transactionSummary->getGrossAmount()."<br>"; |
|
80 | 80 | echo "<hr>"; |
81 | 81 | } |
82 | 82 | } |
@@ -3,8 +3,8 @@ |
||
3 | 3 | class BasicTest extends PHPUnit_Framework_TestCase |
4 | 4 | { |
5 | 5 | |
6 | - public function testDependencies() |
|
7 | - { |
|
8 | - $this->assertInstanceOf('PagSeguroLibrary', PagSeguroLibrary::init()); |
|
9 | - } |
|
6 | + public function testDependencies() |
|
7 | + { |
|
8 | + $this->assertInstanceOf('PagSeguroLibrary', PagSeguroLibrary::init()); |
|
9 | + } |
|
10 | 10 | } |
@@ -7,31 +7,31 @@ discard block |
||
7 | 7 | |
8 | 8 | var $objPHPExcel; |
9 | 9 | var $title; |
10 | - var $writer; |
|
11 | - var $sheet; |
|
12 | - var $data; |
|
13 | - var $blacklist = array(); |
|
10 | + var $writer; |
|
11 | + var $sheet; |
|
12 | + var $data; |
|
13 | + var $blacklist = array(); |
|
14 | 14 | |
15 | - public function csvHelper() { |
|
15 | + public function csvHelper() { |
|
16 | 16 | $this->log('run this'); |
17 | 17 | $this->objPHPExcel = new PHPExcel(); |
18 | 18 | $this->objPHPExcel->setActiveSheetIndex(0); |
19 | - //$this->objPHPExcel->getActiveSheet() = $this->objPHPExcel->getActiveSheet(); |
|
20 | - } |
|
19 | + //$this->objPHPExcel->getActiveSheet() = $this->objPHPExcel->getActiveSheet(); |
|
20 | + } |
|
21 | 21 | |
22 | - public function create($title = 'Report') { |
|
23 | - $this->title = $title; |
|
24 | - } |
|
22 | + public function create($title = 'Report') { |
|
23 | + $this->title = $title; |
|
24 | + } |
|
25 | 25 | |
26 | 26 | public function end() { |
27 | 27 | header("Content-type: text/csv"); |
28 | - header('Content-Disposition: attachment;filename="'.$this->title.'.csv"'); |
|
29 | - header('Cache-Control: max-age=0'); |
|
28 | + header('Content-Disposition: attachment;filename="'.$this->title.'.csv"'); |
|
29 | + header('Cache-Control: max-age=0'); |
|
30 | 30 | |
31 | 31 | $this->writer = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'CSV'); |
32 | 32 | |
33 | 33 | |
34 | - $this->writer->save('php://output'); |
|
34 | + $this->writer->save('php://output'); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
@@ -39,23 +39,23 @@ discard block |
||
39 | 39 | return $this->objPHPExcel->getActiveSheet()->setCellValue($coordinates, $value); |
40 | 40 | } |
41 | 41 | |
42 | - function _title($title) { |
|
43 | - $this->objPHPExcel->getActiveSheet()->setCellValue('A2', $title); |
|
44 | - } |
|
42 | + function _title($title) { |
|
43 | + $this->objPHPExcel->getActiveSheet()->setCellValue('A2', $title); |
|
44 | + } |
|
45 | 45 | |
46 | - function _headers() { |
|
47 | - $i=0; |
|
46 | + function _headers() { |
|
47 | + $i=0; |
|
48 | 48 | |
49 | 49 | $this->log($this->data); |
50 | 50 | |
51 | - foreach ($this->data[0] as $field => $value) { |
|
52 | - if (!in_array($field,$this->blacklist)) { |
|
51 | + foreach ($this->data[0] as $field => $value) { |
|
52 | + if (!in_array($field,$this->blacklist)) { |
|
53 | 53 | |
54 | - $columnName = Inflector::humanize($field); |
|
55 | - $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
|
54 | + $columnName = Inflector::humanize($field); |
|
55 | + $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
|
56 | 56 | |
57 | - } |
|
58 | - } |
|
57 | + } |
|
58 | + } |
|
59 | 59 | /** |
60 | 60 | $this->objPHPExcel->getActiveSheet()->getStyle('A4')->getFont()->setBold(true); |
61 | 61 | $this->objPHPExcel->getActiveSheet()->getStyle('A4')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID); |
@@ -64,49 +64,49 @@ discard block |
||
64 | 64 | for ($j=1; $j<$i; $j++) { |
65 | 65 | $this->objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($j))->setAutoSize(true); |
66 | 66 | } |
67 | - ***/ |
|
68 | - } |
|
67 | + ***/ |
|
68 | + } |
|
69 | 69 | |
70 | - function _rows() { |
|
71 | - $i=5; |
|
72 | - foreach ($this->data as $row) { |
|
73 | - $j=0; |
|
74 | - foreach ($row as $field => $value) { |
|
75 | - if(!in_array($field,$this->blacklist)) { |
|
76 | - $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
77 | - } |
|
78 | - } |
|
79 | - $i++; |
|
80 | - } |
|
81 | - } |
|
70 | + function _rows() { |
|
71 | + $i=5; |
|
72 | + foreach ($this->data as $row) { |
|
73 | + $j=0; |
|
74 | + foreach ($row as $field => $value) { |
|
75 | + if(!in_array($field,$this->blacklist)) { |
|
76 | + $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
77 | + } |
|
78 | + } |
|
79 | + $i++; |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - function _output($title, $type = 'CSV') { |
|
83 | + function _output($title, $type = 'CSV') { |
|
84 | 84 | if ($type == 'Excel5') { |
85 | 85 | header("Content-type: application/vnd.ms-excel"); |
86 | - header('Content-Disposition: attachment;filename="'.$title.'.xls"'); |
|
87 | - header('Cache-Control: max-age=0'); |
|
86 | + header('Content-Disposition: attachment;filename="'.$title.'.xls"'); |
|
87 | + header('Cache-Control: max-age=0'); |
|
88 | 88 | $this->writer = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel5'); |
89 | 89 | |
90 | 90 | |
91 | 91 | } else if ($type == 'CSV') { |
92 | 92 | header("Content-type: text/csv"); |
93 | - header('Content-Disposition: attachment;filename="'.$title.'.csv"'); |
|
94 | - header('Cache-Control: max-age=0'); |
|
93 | + header('Content-Disposition: attachment;filename="'.$title.'.csv"'); |
|
94 | + header('Cache-Control: max-age=0'); |
|
95 | 95 | |
96 | 96 | $this->objPHPExcel->getActiveSheet()->setCellValue('A1', 'First Name') |
97 | - ->setCellValue('B1', 'Last Name') |
|
98 | - ->setCellValue('C1', 'Age') |
|
99 | - ->setCellValue('D1', 'Date of birth') |
|
100 | - ->setCellValue('E1', 'Salary'); |
|
97 | + ->setCellValue('B1', 'Last Name') |
|
98 | + ->setCellValue('C1', 'Age') |
|
99 | + ->setCellValue('D1', 'Date of birth') |
|
100 | + ->setCellValue('E1', 'Salary'); |
|
101 | 101 | |
102 | 102 | $this->writer = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'CSV'); |
103 | 103 | |
104 | 104 | } |
105 | 105 | |
106 | 106 | $this->log($this->writer); |
107 | - //$this->writer->setTempDir(TMP); |
|
108 | - $this->writer->save('php://output'); |
|
109 | - } |
|
107 | + //$this->writer->setTempDir(TMP); |
|
108 | + $this->writer->save('php://output'); |
|
109 | + } |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | ?> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -include_once(APP . 'Plugin' . DS . 'PhpExcel' . DS . 'Vendor' . DS . 'PHPExcel' . DS . 'IOFactory.php'); |
|
3 | -include_once(APP . 'Plugin' . DS . 'PhpExcel' . DS . 'Vendor' . DS . 'PHPExcel' . DS . 'PHPExcel.php'); |
|
2 | +include_once(APP.'Plugin'.DS.'PhpExcel'.DS.'Vendor'.DS.'PHPExcel'.DS.'IOFactory.php'); |
|
3 | +include_once(APP.'Plugin'.DS.'PhpExcel'.DS.'Vendor'.DS.'PHPExcel'.DS.'PHPExcel.php'); |
|
4 | 4 | |
5 | 5 | |
6 | 6 | class CsvHelper extends AppHelper { |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | function _headers() { |
47 | - $i=0; |
|
47 | + $i = 0; |
|
48 | 48 | |
49 | 49 | $this->log($this->data); |
50 | 50 | |
51 | 51 | foreach ($this->data[0] as $field => $value) { |
52 | - if (!in_array($field,$this->blacklist)) { |
|
52 | + if ( ! in_array($field, $this->blacklist)) { |
|
53 | 53 | |
54 | 54 | $columnName = Inflector::humanize($field); |
55 | 55 | $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | function _rows() { |
71 | - $i=5; |
|
71 | + $i = 5; |
|
72 | 72 | foreach ($this->data as $row) { |
73 | - $j=0; |
|
73 | + $j = 0; |
|
74 | 74 | foreach ($row as $field => $value) { |
75 | - if(!in_array($field,$this->blacklist)) { |
|
76 | - $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
75 | + if ( ! in_array($field, $this->blacklist)) { |
|
76 | + $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++, $i, $value); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | $i++; |