Skip to content

Commit 3d6b832

Browse files
committed
Url encode params
1 parent 9a7cef3 commit 3d6b832

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Client.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function isValidAuth($merchant = '')
4444
$this->initCurl(
4545
$this->_endpoint .
4646
'/merchants' .
47-
($merchant?'/'.$merchant:'') .
47+
urlencode($merchant?'/'.$merchant:'').
4848
'/credentials'
4949
);
5050
curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, 'GET');
@@ -153,9 +153,14 @@ public function getPaymentMethods($uri, $options = array())
153153
curl_close($this->ch);
154154
}
155155

156-
public function getCreditAgreements($amount, $merchant)
156+
public function getCreditAgreements($amount, $merchant, $locale = 'es-ES', $country = 'ES', $currency = 'EUR')
157157
{
158-
$uri = $this->_endpoint . '/merchants/' . $merchant . '/credit_agreements?total_with_tax=' . $amount . '&currency=EUR&locale=es-ES&country=ES';
158+
$uri = $this->_endpoint .
159+
'/merchants/' . urlencode($merchant) .
160+
'/credit_agreements?total_with_tax=' . urlencode($amount) .
161+
'&currency=' . urlencode($currency) .
162+
'&locale=' . urlencode($locale) .
163+
'&country=' . urlencode($country);
159164
$this->initCurl($uri);
160165
curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, 'GET');
161166
$this->sendRequest();
@@ -188,8 +193,8 @@ public function sendDeliveryReport($delivery_report)
188193
public function orderUpdate($order)
189194
{
190195
$uri = $this->_endpoint .
191-
'/merchants/' . $order['merchant']['id'] .
192-
'/orders/' . $order['merchant_reference']['order_ref_1'];
196+
'/merchants/' . urlencode($order['merchant']['id']) .
197+
'/orders/' . urlencode($order['merchant_reference']['order_ref_1']);
193198
$this->initCurl($uri);
194199
$this->verbThePayload('PUT', array('order' => $order));
195200
$this->dealWithResponse();

0 commit comments

Comments
 (0)