| Conditions | 2 |
| Paths | 8 |
| Total Lines | 24 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function getUserTransactionsFromRefreshToken(string $refreshToken) |
||
| 18 | { |
||
| 19 | try { |
||
| 20 | $tokenInfo = $this->refreshToken($refreshToken); |
||
| 21 | $ch = curl_init(); |
||
| 22 | curl_setopt( |
||
| 23 | $ch, |
||
| 24 | CURLOPT_URL, |
||
| 25 | "https://api.sandbox.paypal.com/v1/reporting/transactions?start_date=" . |
||
| 26 | date('Y-m-d', strtotime('5 days ago')) . 'T00:00:00-0700' . |
||
| 27 | "&end_date=" . date('Y-m-d', strtotime('now')) . 'T00:00:00-0700' |
||
| 28 | ); |
||
| 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
||
| 30 | curl_setopt($ch, CURLOPT_HTTPHEADER, [ |
||
| 31 | 'Content-Type: application/json', |
||
| 32 | 'Authorization: Bearer ' . $tokenInfo->getAccessToken(), |
||
| 33 | ]); |
||
| 34 | $userTransactions = curl_exec($ch); |
||
| 35 | curl_close($ch); |
||
| 36 | } catch (Exception $e) { |
||
| 37 | $this->logger->error('Error on PayPal::getUserTransactionsFromRefreshToken = ' . $e->getMessage()); |
||
| 38 | return null; |
||
| 39 | } |
||
| 40 | return json_decode($userTransactions); |
||
|
|
|||
| 41 | } |
||
| 43 |