@@ -68,7 +68,7 @@ |
||
| 68 | 68 | private function execute() { |
| 69 | 69 | |
| 70 | 70 | //For debuging |
| 71 | - if ($this->getCurlDebugIsEnable()){ |
|
| 71 | + if ($this->getCurlDebugIsEnable()){ |
|
| 72 | 72 | $parentDir = dirname(dirname(dirname(__FILE__))); |
| 73 | 73 | $fp = fopen($parentDir.'/debug_viva_curl.txt', 'w'); |
| 74 | 74 | curl_setopt($this->ch, CURLOPT_VERBOSE, 1); |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | trait getConfigSettings |
| 7 | 7 | { |
| 8 | - public function getConfigSettings() { |
|
| 8 | + public function getConfigSettings() { |
|
| 9 | 9 | $environment = $this->accessToken->getEnvironment(); |
| 10 | 10 | $config = new Config($environment); |
| 11 | 11 | return $config; |
@@ -149,7 +149,9 @@ |
||
| 149 | 149 | $params .= "&color=" . $this->getConfigSettings()->getEnvConfig('VIVA_SMARTCHECKOUT_COLOR'); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if ($color) $params .= "&color=" . $color; |
|
| 152 | + if ($color) { |
|
| 153 | + $params .= "&color=" . $color; |
|
| 154 | + } |
|
| 153 | 155 | |
| 154 | 156 | |
| 155 | 157 | if ($lang instanceof RequestLang) { |
@@ -30,7 +30,9 @@ discard block |
||
| 30 | 30 | public function getByTransaction($vivaTransaction) |
| 31 | 31 | { |
| 32 | 32 | // https://demo.vivapayments.com/api/transactions/:transaction_id |
| 33 | - if (!$vivaTransaction) throw new \Exception('Invalid transaction code'); |
|
| 33 | + if (!$vivaTransaction) { |
|
| 34 | + throw new \Exception('Invalid transaction code'); |
|
| 35 | + } |
|
| 34 | 36 | $url = $this->getConfigSettings()->getEnvConfig('VIVA_URL'); |
| 35 | 37 | $curl = new CurlWrapper($url . '/api/transactions/' . $vivaTransaction); |
| 36 | 38 | $curl->addHeader('Content-Type: application/json'); |
@@ -61,7 +63,9 @@ discard block |
||
| 61 | 63 | public function getByTransactionV2($vivaTransaction) |
| 62 | 64 | { |
| 63 | 65 | // https://demo.vivapayments.com/checkout/v2/transactions/:transaction_id |
| 64 | - if (!$vivaTransaction) throw new \Exception('Invalid transaction code'); |
|
| 66 | + if (!$vivaTransaction) { |
|
| 67 | + throw new \Exception('Invalid transaction code'); |
|
| 68 | + } |
|
| 65 | 69 | $token = $this->accessToken->getToken(); |
| 66 | 70 | $url = $this->getConfigSettings()->getEnvConfig('VIVA_API_URL') . '/checkout/v2/transactions/' . $vivaTransaction; |
| 67 | 71 | $curl = new CurlWrapper($url); |
@@ -79,7 +83,9 @@ discard block |
||
| 79 | 83 | public function getByOrderCode($orderCode) |
| 80 | 84 | { |
| 81 | 85 | // https://demo.vivapayments.com/api/orders/:orderCode |
| 82 | - if (!$orderCode) throw new \Exception('Invalid transaction code'); |
|
| 86 | + if (!$orderCode) { |
|
| 87 | + throw new \Exception('Invalid transaction code'); |
|
| 88 | + } |
|
| 83 | 89 | $url = $this->getConfigSettings()->getEnvConfig('VIVA_URL'); |
| 84 | 90 | $curl = new CurlWrapper($url . '/api/orders/' . $orderCode); |
| 85 | 91 | $curl->addHeader('Content-Type: application/json'); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | /** |
| 57 | 57 | * Return value as string |
| 58 | 58 | * Enums\PaymentMethods::fromValue(15); |
| 59 | - */ |
|
| 59 | + */ |
|
| 60 | 60 | |
| 61 | 61 | public static function fromValue(int $value): string |
| 62 | 62 | { |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | /** |
| 41 | 41 | * Return value as string |
| 42 | 42 | * Enums\RequestLang::fromValue('el-GR'); |
| 43 | - */ |
|
| 43 | + */ |
|
| 44 | 44 | |
| 45 | 45 | public static function fromValue(string $value): string |
| 46 | 46 | { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * Return value as string |
| 63 | 63 | * Enums\PaymentMethods::fromName('Dias'); |
| 64 | - */ |
|
| 64 | + */ |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | public static function fromName(string $name): int |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * Return value as string |
| 81 | 81 | * Enums\PaymentMethods::fromValue(15); |
| 82 | - */ |
|
| 82 | + */ |
|
| 83 | 83 | |
| 84 | 84 | public static function fromValue(int $value): string |
| 85 | 85 | { |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | public function process(){ |
| 25 | - echo 'Price = '.$this->amount; |
|
| 25 | + echo 'Price = '.$this->amount; |
|
| 26 | 26 | |
| 27 | 27 | } |
| 28 | 28 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * Return value as string |
| 63 | 63 | * Enums\PaymentMethods::fromName('Dias'); |
| 64 | - */ |
|
| 64 | + */ |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | public static function fromName(string $name): int |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * Return value as string |
| 81 | 81 | * Enums\PaymentMethods::fromValue(15); |
| 82 | - */ |
|
| 82 | + */ |
|
| 83 | 83 | |
| 84 | 84 | public static function fromValue(int $value): string |
| 85 | 85 | { |