Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 17e6cd2

Browse files
committed
feat(Account): Create method to check if an account exists
Create method to check if an account exists
1 parent 946f406 commit 17e6cd2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Resource/Account.php

+12
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ public function get($moip_id)
130130
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $moip_id));
131131
}
132132

133+
/**
134+
* Check if an account exists.
135+
*
136+
* @param string $moip_id
137+
*
138+
* @return stdClass
139+
*/
140+
public function checkAccountExists($moip_id)
141+
{
142+
return $this->getByPath(sprintf('/%s/%s/%s?tax_document=%s', MoipResource::VERSION, self::PATH, 'exists', $moip_id));
143+
}
144+
133145
/**
134146
* Get account id.
135147
*

tests/Resource/AccountTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,15 @@ public function testShouldCreateAccountWithCompany()
6060
$this->assertEquals('66448899', $account->getAlternativePhones()[0]->number);
6161
$this->assertEquals('Teste Empresa ME', $account->getCompany()->businessName);
6262
}
63+
64+
public function testCheckExistingAccount()
65+
{
66+
67+
}
68+
69+
public function testCheckNonExistingAccount()
70+
{
71+
72+
}
73+
6374
}

0 commit comments

Comments
 (0)