Skip to content

Commit 8c4e75d

Browse files
Fix for PaymentSend endpoints; removed unused constants
1 parent 96f4e3c commit 8c4e75d

14 files changed

Lines changed: 44 additions & 51 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Each resource (class) can be accessed via magic property on the Merchants API ob
4141
$merchant_api->api_keys->...;
4242
$merchant_api->balance->...;
4343
$merchant_api->payment_requests->...;
44-
$merchant_api->payment_sends->...;
44+
$merchant_api->payment_send->...;
4545
$merchant_api->pos->...;
4646
$merchant_api->profile->...;
4747
$merchant_api->settlements->...;

src/MerchantApi/ApiKeys.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ApiKeys extends SettleApi
1818
*/
1919
public function list()
2020
{
21-
return $this->call('GET', 'api_key/');
21+
return $this->call('GET', 'merchant/v1/api_key/');
2222
}
2323

2424
/**
@@ -28,7 +28,7 @@ public function list()
2828
*/
2929
public function get($api_key_id)
3030
{
31-
return $this->call('GET', "api_key/{$api_key_id}/");
31+
return $this->call('GET', "merchant/v1/api_key/{$api_key_id}/");
3232
}
3333

3434
/**
@@ -38,7 +38,7 @@ public function get($api_key_id)
3838
*/
3939
public function create(array $data)
4040
{
41-
return $this->call('POST', 'api_key/', $data);
41+
return $this->call('POST', 'merchant/v1/api_key/', $data);
4242
}
4343

4444
/**
@@ -49,7 +49,7 @@ public function create(array $data)
4949
*/
5050
public function update($api_key_id, array $data)
5151
{
52-
return $this->call('PUT', "api_key/{$api_key_id}/", $data);
52+
return $this->call('PUT', "merchant/v1/api_key/{$api_key_id}/", $data);
5353
}
5454

5555
/**
@@ -59,6 +59,6 @@ public function update($api_key_id, array $data)
5959
*/
6060
public function delete($api_key_id)
6161
{
62-
return $this->call('DELETE', "api_key/{$api_key_id}/");
62+
return $this->call('DELETE', "merchant/v1/api_key/{$api_key_id}/");
6363
}
6464
}

src/MerchantApi/Balance.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ class Balance extends SettleApi
1919
*/
2020
public function get($merchant_id)
2121
{
22-
return $this->call('GET', "merchant/{$merchant_id}/balance/");
22+
return $this->call('GET', "merchant/v1/merchant/{$merchant_id}/balance/");
2323
}
2424
}

src/MerchantApi/MerchantApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @property ApiKeys api_keys
1212
* @property PaymentRequests payment_requests
13-
* @property PaymentSends payment_sends
13+
* @property PaymentSend payment_send
1414
* @property Pos pos
1515
* @property Settlements settlements
1616
* @property ShortLinks short_links
@@ -30,7 +30,7 @@ protected function getMagicProperties()
3030
'api_keys' => ApiKeys::class,
3131
'balance' => Balance::class,
3232
'payment_requests' => PaymentRequests::class,
33-
'payment_sends' => PaymentSends::class,
33+
'payment_send' => PaymentSend::class,
3434
'pos' => Pos::class,
3535
'profile' => Profile::class,
3636
'settlements' => Settlements::class,

src/MerchantApi/PaymentRequests.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PaymentRequests extends SettleApi
4646
*/
4747
public function list($query = [])
4848
{
49-
return $this->call('GET', 'payment_request/', $query);
49+
return $this->call('GET', 'merchant/v1/payment_request/', $query);
5050
}
5151

5252
/**
@@ -56,7 +56,7 @@ public function list($query = [])
5656
*/
5757
public function get($payment_request_id)
5858
{
59-
return $this->call('GET', "payment_request/{$payment_request_id}/");
59+
return $this->call('GET', "merchant/v1/payment_request/{$payment_request_id}/");
6060
}
6161

6262
/**
@@ -66,7 +66,7 @@ public function get($payment_request_id)
6666
*/
6767
public function create(array $data)
6868
{
69-
return $this->call('POST', 'payment_request/', $data, self::REQUEST_SHAPE);
69+
return $this->call('POST', 'merchant/v1/payment_request/', $data, self::REQUEST_SHAPE);
7070
}
7171

7272
/**
@@ -77,7 +77,7 @@ public function create(array $data)
7777
*/
7878
public function update($payment_request_id, array $data)
7979
{
80-
$path = "payment_request/{$payment_request_id}/";
80+
$path = "merchant/v1/payment_request/{$payment_request_id}/";
8181

8282
return $this->call('PUT', $path, $data, self::REQUEST_SHAPE);
8383
}
@@ -89,7 +89,7 @@ public function update($payment_request_id, array $data)
8989
*/
9090
public function outcome($payment_request_id)
9191
{
92-
return $this->call('GET', "payment_request/{$payment_request_id}/outcome/");
92+
return $this->call('GET', "merchant/v1/payment_request/{$payment_request_id}/outcome/");
9393
}
9494

9595
/**
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
use SettleApi\SettleApiException;
77

88
/**
9-
* Class PaymentSends
9+
* Class PaymentSend
1010
* @package SettleApi\MerchantApi
1111
* @link https://settleapi.stoplight.io/docs/settleapis/b3A6MTUzOTU0Mzc-merchant-payment-send-create
1212
*/
13-
class PaymentSends extends SettleApi
13+
class PaymentSend extends SettleApi
1414
{
1515
/**
1616
* @param array $data
@@ -19,7 +19,7 @@ class PaymentSends extends SettleApi
1919
*/
2020
public function create(array $data)
2121
{
22-
return $this->call('POST', 'payment/', $data);
22+
return $this->call('POST', 'payment/v2/payment/', $data);
2323
}
2424

2525
/**
@@ -29,6 +29,6 @@ public function create(array $data)
2929
*/
3030
public function outcome($payment_send_id)
3131
{
32-
return $this->call('GET', "payment/{$payment_send_id}/outcome/");
32+
return $this->call('GET', "payment/v2/payment/{$payment_send_id}/");
3333
}
3434
}

src/MerchantApi/PermissionRequests.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PermissionRequests extends SettleApi
1919
*/
2020
public function create(array $data)
2121
{
22-
return $this->call('POST', 'permission_request/', $data, [
22+
return $this->call('POST', 'merchant/v1/permission_request/', $data, [
2323
'customer' => 'required|string',
2424
'scope' => 'required|string',
2525
'legal_terms_url' => 'required|string',
@@ -38,7 +38,7 @@ public function create(array $data)
3838
*/
3939
public function get($permissionRequestId)
4040
{
41-
return $this->call('GET', "permission_request/{$permissionRequestId}/");
41+
return $this->call('GET', "merchant/v1/permission_request/{$permissionRequestId}/");
4242
}
4343

4444
/**
@@ -48,6 +48,6 @@ public function get($permissionRequestId)
4848
*/
4949
public function outcome($permissionRequestId)
5050
{
51-
return $this->call('GET', "permission_request/{$permissionRequestId}/outcome/");
51+
return $this->call('GET', "merchant/v1/permission_request/{$permissionRequestId}/outcome/");
5252
}
5353
}

src/MerchantApi/Pos.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Pos extends SettleApi
1818
*/
1919
public function list()
2020
{
21-
return $this->call('GET', 'pos/');
21+
return $this->call('GET', 'merchant/v1/pos/');
2222
}
2323

2424
/**
@@ -28,7 +28,7 @@ public function list()
2828
*/
2929
public function get($pos_id)
3030
{
31-
return $this->call('GET', "pos/{$pos_id}/");
31+
return $this->call('GET', "merchant/v1/pos/{$pos_id}/");
3232
}
3333

3434
/**
@@ -38,7 +38,7 @@ public function get($pos_id)
3838
*/
3939
public function create(array $data)
4040
{
41-
return $this->call('POST', 'pos/', $data);
41+
return $this->call('POST', 'merchant/v1/pos/', $data);
4242
}
4343

4444
/**
@@ -49,7 +49,7 @@ public function create(array $data)
4949
*/
5050
public function update($pos_id, array $data)
5151
{
52-
return $this->call('PUT', "pos/{$pos_id}/", $data);
52+
return $this->call('PUT', "merchant/v1/pos/{$pos_id}/", $data);
5353
}
5454

5555
/**
@@ -59,6 +59,6 @@ public function update($pos_id, array $data)
5959
*/
6060
public function delete($pos_id)
6161
{
62-
return $this->call('DELETE', "pos/{$pos_id}/");
62+
return $this->call('DELETE', "merchant/v1/pos/{$pos_id}/");
6363
}
6464
}

src/MerchantApi/Profile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Profile extends SettleApi
1919
*/
2020
public function get($merchant_id)
2121
{
22-
return $this->call('GET', "merchant/{$merchant_id}/");
22+
return $this->call('GET', "merchant/v1/merchant/{$merchant_id}/");
2323
}
2424

2525
/**
@@ -29,6 +29,6 @@ public function get($merchant_id)
2929
*/
3030
public function lookup($merchant_id)
3131
{
32-
return $this->call('GET', "merchant_lookup/{$merchant_id}/");
32+
return $this->call('GET', "merchant/v1/merchant_lookup/{$merchant_id}/");
3333
}
3434
}

src/MerchantApi/Settlements.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Settlements extends SettleApi
1818
*/
1919
public function list()
2020
{
21-
return $this->call('GET', 'settlement/');
21+
return $this->call('GET', 'merchant/v1/settlement/');
2222
}
2323

2424
/**
@@ -28,7 +28,7 @@ public function list()
2828
*/
2929
public function get($settlement_id)
3030
{
31-
return $this->call('GET', "settlement/{$settlement_id}/");
31+
return $this->call('GET', "merchant/v1/settlement/{$settlement_id}/");
3232
}
3333

3434
/**
@@ -38,16 +38,15 @@ public function get($settlement_id)
3838
*/
3939
public function latest()
4040
{
41-
return $this->call('GET', 'last_settlement/');
41+
return $this->call('GET', 'merchant/v1/last_settlement/');
4242
}
4343

4444
/**
4545
* @return array
4646
* @throws SettleApiException
47-
* @todo This endpoint isn't working properly
4847
*/
4948
public function report()
5049
{
51-
return $this->call('GET', 'settlement_report/');
50+
return $this->call('GET', 'merchant/v1/settlement_report/');
5251
}
5352
}

0 commit comments

Comments
 (0)