1
0
Fork 0
mirror of synced 2025-04-03 22:03:34 +03:00
Fixed name methods and parameters
This commit is contained in:
Ivan Chaplygin 2024-04-03 18:07:03 +03:00
parent 642e088898
commit a37c039ffb
2 changed files with 36 additions and 36 deletions

View file

@ -2846,7 +2846,7 @@ class WC_Retailcrm_Client_V5
/** Loyalty program */
/** Customer registration in the loyalty program */
public function createPLAccount(array $parameters, $site = null)
public function createLoyaltyAccount(array $parameters, $site = null)
{
if ([] === $parameters) {
throw new InvalidArgumentException(
@ -2862,35 +2862,35 @@ class WC_Retailcrm_Client_V5
}
/** Receiving information about participation in the loyalty program */
public function getPLClientInfo(int $clientIdPL)
public function getLoyaltyClientInfo(int $clientIdLoyalty)
{
return $this->client->makeRequest(
"/loyalty/account/$clientIdPL",
"/loyalty/account/$clientIdLoyalty",
WC_Retailcrm_Request::METHOD_GET
);
}
/** Activation of participation in the loyalty program */
public function activatePLAccount(int $clientIdPL)
public function activateLoyaltyAccount(int $clientIdLoyalty)
{
return $this->client->makeRequest(
"/loyalty/account/$clientIdPL/activate",
"/loyalty/account/$clientIdLoyalty/activate",
WC_Retailcrm_Request::METHOD_POST
);
}
/** Editing participation in the loyalty program */
public function editPLAccount(int $clientIdPL, array $parameters)
public function editLoyaltyAccount(int $clientIdLoyalty, array $parameters)
{
return $this->client->makeRequest(
"/loyalty/account/$clientIdPL/edit",
"/loyalty/account/$clientIdLoyalty/edit",
WC_Retailcrm_Request::METHOD_POST,
['id' => $clientIdPL, 'loyaltyAccount' => json_encode($parameters)]
['id' => $clientIdLoyalty, 'loyaltyAccount' => json_encode($parameters)]
);
}
/** List of participation in the loyalty program */
public function getPLAccountList(array $filter = [], $limit = null, $page = null)
public function getLoyaltyAccountList(array $filter = [], $limit = null, $page = null)
{
$parameters = $this->buildParameters($filter, $limit, $page);
@ -2902,7 +2902,7 @@ class WC_Retailcrm_Client_V5
}
/** List of loyalty programs */
public function getListPL(array $filter = [], $limit = null, $page = null)
public function getListLoyalty(array $filter = [], $limit = null, $page = null)
{
$parameters = $this->buildParameters($filter, $limit, $page);
@ -2914,25 +2914,25 @@ class WC_Retailcrm_Client_V5
}
/** Receiving information about the loyalty program */
public function getPL(int $idPL)
public function getLoyalty(int $idLoyalty)
{
return $this->client->makeRequest(
"/loyalty/loyalties/$idPL",
"/loyalty/loyalties/$idLoyalty",
WC_Retailcrm_Request::METHOD_GET
);
}
/** Charge bonus */
public function chargeBonusPL(int $clientIdPL, float $amount, string $comment = '')
public function chargeBonusLoyalty(int $clientIdLoyalty, float $amount, string $comment = '')
{
return $this->client->makeRequest(
"/loyalty/account/$clientIdPL/bonus/charge",
"/loyalty/account/$clientIdLoyalty/bonus/charge",
WC_Retailcrm_Request::METHOD_POST,
['amount' => $amount, 'comment' => $comment]
);
}
public function creditBonusPL(int $clientIdPL, array $parameters)
public function creditBonusLoyalty(int $clientIdLoyalty, array $parameters)
{
if (!isset($parameters['amount'])) {
throw new InvalidArgumentException(
@ -2941,38 +2941,38 @@ class WC_Retailcrm_Client_V5
}
return $this->client->makeRequest(
"/loyalty/account/$clientIdPL/bonus/credit",
"/loyalty/account/$clientIdLoyalty/bonus/credit",
WC_Retailcrm_Request::METHOD_POST,
$parameters
);
}
/** History of the client's bonus account */
public function getClientBonusHistory(int $clientIdPL, array $filter = [], $limit = null, $page = null)
public function getClientBonusHistory(int $clientIdLoyalty, array $filter = [], $limit = null, $page = null)
{
$parameters = $this->buildParameters($filter, $limit, $page);
$parameters['id'] = $clientIdPL;
$parameters['id'] = $clientIdLoyalty;
return $this->client->makeRequest(
"/loyalty/account/$clientIdPL/bonus/operations",
"/loyalty/account/$clientIdLoyalty/bonus/operations",
WC_Retailcrm_Request::METHOD_GET,
$parameters
);
}
public function getDetailClientBonus(
int $clientIdPL,
int $clientIdLoyalty,
string $status,
array $filter = [],
$limit = null,
$page = null
) {
$parameters = $this->buildParameters($filter, $limit, $page);
$parameters['id'] = $clientIdPL;
$parameters['id'] = $clientIdLoyalty;
$parameters['status'] = $status;
return $this->client->makeRequest(
"/api/v5/loyalty/account/$clientIdPL/bonus/$status/details",
"/api/v5/loyalty/account/$clientIdLoyalty/bonus/$status/details",
WC_Retailcrm_Request::METHOD_GET,
$parameters
);
@ -2992,7 +2992,7 @@ class WC_Retailcrm_Client_V5
}
/** Maximum discount calculation */
public function calculateDiscountPL(string $site, array $order, float $bonuses)
public function calculateDiscountLoyalty(string $site, array $order, float $bonuses)
{
return $this->client->makeRequest(
"/loyalty/calculate",

View file

@ -57,9 +57,9 @@ class WC_Retailcrm_Loyalty_Client_Test extends WC_Retailcrm_Test_Case_Helper
}
/**
* @dataProvider requestPLData
* @dataProvider requestLoyaltyData
*/
public function testPLRequest($method, $parameters)
public function testLoyaltyRequest($method, $parameters)
{
/** @var WC_Retailcrm_Response $test */
$test = call_user_func([$this->clientMock, $method], ...$parameters);
@ -67,43 +67,43 @@ class WC_Retailcrm_Loyalty_Client_Test extends WC_Retailcrm_Test_Case_Helper
$this->assertTrue($test->isSuccessful());
}
public function requestPLData()
public function requestLoyaltyData()
{
return [
[
'method' => 'createPLAccount',
'method' => 'createLoyaltyAccount',
'parameters' => [['test'], 'testSite']
],
[
'method' => 'getPLClientInfo',
'method' => 'getLoyaltyClientInfo',
'parameters' => [1]
],
[
'method' => 'activatePLAccount',
'method' => 'activateLoyaltyAccount',
'parameters' => [1]
],
[
'method' => 'editPLAccount',
'method' => 'editLoyaltyAccount',
'parameters' => [1, ['test']]
],
[
'method' => 'getPLAccountList',
'method' => 'getLoyaltyAccountList',
'parameters' => [['filter'], 20, 1]
],
[
'method' => 'getListPL',
'method' => 'getListLoyalty',
'parameters' => [['filter'], 20, 1]
],
[
'method' => 'getPL',
'method' => 'getLoyalty',
'parameters' => [1]
],
[
'method' => 'chargeBonusPL',
'method' => 'chargeBonusLoyalty',
'parameters' => [1, 100, 'test']
],
[
'method' => 'creditBonusPL',
'method' => 'creditBonusLoyalty',
'parameters' => [1, ['amount' => 100]]
],
[
@ -119,7 +119,7 @@ class WC_Retailcrm_Loyalty_Client_Test extends WC_Retailcrm_Test_Case_Helper
'parameters' => ['cursor', ['filter'], 20]
],
[
'method' => 'calculateDiscountPL',
'method' => 'calculateDiscountLoyalty',
'parameters' => ['site', ['order'], 100]
],
[