1 | <?php |
||
9 | class PayplugAccountLoader |
||
10 | { |
||
11 | /** |
||
12 | * Url of Payplug account autoconfig |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | const PAYPLUG_AUTOCONFIG_URL = 'https://www.payplug.fr/portal/ecommerce/autoconfig'; |
||
17 | |||
18 | /** |
||
19 | * Url of Payplug test account autoconfig |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | const PAYPLUG_AUTOCONFIG_URL_TEST = 'https://www.payplug.fr/portal/test/ecommerce/autoconfig'; |
||
24 | |||
25 | /** |
||
26 | * Kernel root dir |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | private $rootDir; |
||
31 | |||
32 | /** |
||
33 | * @param string $rootDir |
||
34 | */ |
||
35 | public function __construct($rootDir) |
||
39 | |||
40 | /** |
||
41 | * Load Payplug account parameters and set them into parameters.yml |
||
42 | * |
||
43 | * @param string $mail |
||
44 | * @param string $pass |
||
45 | * @param boolean $test |
||
46 | * @param boolean $noprod |
||
47 | * |
||
48 | * @throws PayplugException on curl or authentication error |
||
49 | */ |
||
50 | public function loadPayplugParameters($mail, $pass, $test = false, $noprod = false) |
||
80 | |||
81 | /** |
||
82 | * Make a curl authenticated request to Payplug to get account parameters. |
||
83 | * Warning: CURLOPT_SSL_VERIFYPEER set to false, so there is not TLS certificate check. |
||
84 | * |
||
85 | * @param string $mail |
||
86 | * @param string $pass |
||
87 | * @param boolean $test |
||
88 | * |
||
89 | * @throws PayplugException on curl error |
||
90 | */ |
||
91 | public function curlPayplugRequest($mail, $pass, $test = false) |
||
110 | |||
111 | /** |
||
112 | * Add or edit parameters in parameters.yml |
||
113 | * |
||
114 | * @param array $parametersArray |
||
115 | */ |
||
116 | public function editParameters(array $parametersArray) |
||
128 | |||
129 | /** |
||
130 | * Return autoconfig for environment |
||
131 | * |
||
132 | * @param boolean $test |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | public function getAutoconfigUrl($test = false) |
||
144 | |||
145 | /** |
||
146 | * Return a detailled error message from status code |
||
147 | * |
||
148 | * @param int $status |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | public function errorStatusResolver($status) |
||
165 | } |
||
166 |