Skip to content

Commit b6da156

Browse files
committed
- Added searchTaxPayerTin API
- Update CountryCodes - Update getNotifications API in NotificationService to remove channel parameter - Update getSubmission API in DocumentSubmissionService to add 2 new parameters - Update getRecentDocuments API in DocumentService to rename direction parameter to invoiceDirection parameter - Update searchDocuments API in DocumentService to remove continuationToken parameter, add pageNo parameter and rename direction parameter to invoiceDirection parameter
1 parent 4123f79 commit b6da156

File tree

6 files changed

+61
-24
lines changed

6 files changed

+61
-24
lines changed

src/MyInvoisClient.php

+2
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ public function __call($name, $args)
280280
return call_user_func_array([$this->getNotificationService(), $name], $args);
281281
case 'validateTaxPayerTin':
282282
return call_user_func_array([$this->getTaxPayerService(), $name], $args);
283+
case 'searchTaxPayerTin':
284+
return call_user_func_array([$this->getTaxPayerService(), $name], $args);
283285
default:
284286
throw new BadMethodCallException($name . ' does not exist!');
285287
}

src/Service/Document/DocumentService.php

+11-18
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getDocumentDetail($id)
122122
* @param DateTime|string $submissionDateTo Optional: The end date and time when the document was submitted to the e-Invoice API, Time to be supplied in UTC timezone. Mandatory when ‘submissionDateFrom’ is provided
123123
* @param DateTime|string $issueDateFrom Optional: The start date and time when the document was issued. Mandatory when ‘issueDateTo’ is provided
124124
* @param DateTime|string $issueDateTo Optional: The end date and time when the document was issued. Mandatory when ‘issueDateFrom’ is provided
125-
* @param string $direction Optional: direction of the document. Possible values: (Sent, Received)
125+
* @param string $invoiceDirection Optional: direction of the document. Possible values: (Sent, Received)
126126
* @param string $status Optional: status of the document. Possible values: (Valid, Invalid, Cancelled, Submitted)
127127
* @param string $documentType Optional: Document type code.
128128
* @param string $receiverId Optional: Document recipient identifier. Only can be used when ‘Direction’ filter is set to Sent. Possible values: (Business registration number, National ID(IC), Passport Number, Army ID)
@@ -135,7 +135,7 @@ public function getDocumentDetail($id)
135135
* @return array
136136
*/
137137
public function getRecentDocuments($pageNo = 1, $pageSize = 20, $submissionDateFrom = null,
138-
$submissionDateTo = null, $issueDateFrom = null, $issueDateTo = null, $direction = null,
138+
$submissionDateTo = null, $issueDateFrom = null, $issueDateTo = null, $invoiceDirection = null,
139139
$status = null, $documentType = null, $receiverId = null, $receiverIdType = null, $receiverTin = null,
140140
$issuerId = null, $issuerIdType = null, $issuerTin = null)
141141
{
@@ -151,7 +151,7 @@ public function getRecentDocuments($pageNo = 1, $pageSize = 20, $submissionDateF
151151
'submissionDateTo' => $submissionDateToString,
152152
'issueDateFrom' => $issueDateFromString,
153153
'issueDateTo' => $issueDateToString,
154-
'direction' => $direction,
154+
'invoiceDirection' => $invoiceDirection,
155155
'status' => $status,
156156
'documentType' => $documentType,
157157
'receiverId' => $receiverId,
@@ -175,24 +175,20 @@ public function getRecentDocuments($pageNo = 1, $pageSize = 20, $submissionDateF
175175
* @param string $id Optional: Unique ID of the document to retrieve.
176176
* @param DateTime|string $submissionDateFrom Optional: The start date and time when the document was submitted to the e-Invoice API, Time to be supplied in UTC timezone. Mandatory when ‘submissionDateTo’ is provided or issueDate filters are not used
177177
* @param DateTime|string $submissionDateTo Optional: The end date and time when the document was submitted to the e-Invoice API, Time to be supplied in UTC timezone. Mandatory when ‘submissionDateFrom’ is provided or issueDate filters are not used
178-
* @param string $continuationToken Optional: Token provided to navigate to the next page. Must be omitted or use an empty string when requesting the first page.
178+
* @param int $pageNo Optional: number of the page to retrieve. Typically this parameter value is derived from initial parameter less call when caller learns total amount of page of certain size
179179
* @param int $pageSize Optional: number of the documents to retrieve per page. Page size cannot exceed system configured maximum page size for this API. Default is 100
180180
* @param DateTime|string $issueDateFrom Optional: The start date and time when the document was issued. Mandatory when ‘issueDateTo’ is provided or submissionDate filters are not used
181181
* @param DateTime|string $issueDateTo Optional: The end date and time when the document was issued. Mandatory when ‘issueDateFrom’ is provided or submissionDate filters are not used
182-
* @param string $direction Optional: direction of the document. Possible values: (Sent, Received). When not provided sent and received documents are retrieved.
182+
* @param string $invoiceDirection Optional: direction of the document. Possible values: (Sent, Received). When not provided sent and received documents are retrieved.
183183
* @param string $status Optional: status of the document. Possible values: (Valid, Invalid, Cancelled, Submitted)
184184
* @param string $documentType Optional: Unique name of the document type. Possible values: 01 [Invoice], 02 [Credit Note], 03 [Debit Note], 04 [Refund Note], 11 [Self-billed Invoice], 12 [Self-billed Credit Note], 13 [Self-billed Debit Note], 14 [Self-billed Refund Note]
185-
* @param string $receiverId Optional: Document recipient identifier. Only can be used when ‘Direction’ filter is set to Sent. Possible values: (Business registration number, Passport Number, National ID)
186-
* @param string $receiverIdType Optional: Document recipient identifier type. Only can be used when ‘Direction’ filter is set to Sent. Possible values: (BRN, PASSPORT, NRIC, ARMY) This is mandatory in case the receiverId is provided
187-
* @param string $receiverTin Optional: Document recipient TIN. Only can be used when ‘Direction’ filter is set to Sent.
188-
* @param string $issuerTin Optional: Document issuer identifier. Only can be used when ‘Direction’ filter is set to Received.
185+
* @param string $searchQuery Optional: Free Text can be given. Possible Search parameters: (uuid, buyerTIN, supplierTIN, buyerName, supplierName, internalID, total) Special characters are not allowed
189186
*
190187
* @return array
191188
*/
192189
public function searchDocuments($id = null, $submissionDateFrom = null, $submissionDateTo = null,
193-
$continuationToken = null, $pageSize = 100, $issueDateFrom = null, $issueDateTo = null, $direction = null,
194-
$status = null, $documentType = null, $receiverId = null, $receiverIdType = null, $receiverTin = null,
195-
$issuerTin = null)
190+
$pageNo = 1, $pageSize = 100, $issueDateFrom = null, $issueDateTo = null, $invoiceDirection = null,
191+
$status = null, $documentType = null, $searchQuery = null)
196192
{
197193
$submissionDateFromString = ($submissionDateFrom instanceof DateTime) ? $submissionDateFrom->format('Y-m-d\TH:i:s\Z') : $submissionDateFrom;
198194
$submissionDateToString = ($submissionDateTo instanceof DateTime) ? $submissionDateTo->format('Y-m-d\TH:i:s\Z') : $submissionDateTo;
@@ -204,17 +200,14 @@ public function searchDocuments($id = null, $submissionDateFrom = null, $submiss
204200
'uuid' => $id,
205201
'submissionDateFrom' => $submissionDateFromString,
206202
'submissionDateTo' => $submissionDateToString,
207-
'continuationToken' => $continuationToken,
203+
'pageNo' => $pageNo,
208204
'pageSize' => $pageSize,
209205
'issueDateFrom' => $issueDateFromString,
210206
'issueDateTo' => $issueDateToString,
211-
'direction' => $direction,
207+
'invoiceDirection' => $invoiceDirection,
212208
'status' => $status,
213209
'documentType' => $documentType,
214-
'receiverId' => $receiverId,
215-
'receiverIdType' => $receiverIdType,
216-
'receiverTin' => $receiverTin,
217-
'issuerTin' => $issuerTin,
210+
'searchQuery' => $searchQuery,
218211
];
219212
$query = '?' . http_build_query($params);
220213

src/Service/Document/DocumentSubmissionService.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,21 @@ public function __construct(MyInvoisClient $client, $prodMode = false)
3838
/**
3939
* This API returns information on documents submitted during a single submission by taxpayer.
4040
*
41-
* @param string $id Unique ID of the document submission to retrieve.
41+
* @param string $id Mandatory: Unique ID of the document submission to retrieve.
42+
* @param int $pageNo Optional: number of the page to retrieve
43+
* @param int $pageSize Optional: number of the documents to retrieve per page. Page size cannot exceed system configured maximum page size for this API [100]
4244
*
4345
* @return array
4446
*/
45-
public function getSubmission($id)
47+
public function getSubmission($id, $pageNo = 1, $pageSize = 100)
4648
{
47-
$url = $this->getBaseUrl() . '/' . $id;
49+
$params = [
50+
'pageNo' => $pageNo,
51+
'pageSize' => $pageSize,
52+
];
53+
$query = '?' . http_build_query($params);
54+
55+
$url = $this->getBaseUrl() . '/' . $id . $query;
4856

4957
$response = $this->getClient()->request('GET', $url);
5058
return $response;

src/Service/Notification/NotificationService.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,13 @@ public function __construct(MyInvoisClient $client, $prodMode = false)
4444
* @param string $type Optional: type of notifications to retrieve specified as ID of the type
4545
* @param string $language Optional: used to get notifications only if they were sent out in a specific language
4646
* @param string $status Optional: used to get notifications of certain status only, e.g., only those that were not delivered. Values: pending, batched, delivered, error
47-
* @param string $channel Optional: used to get notifications delivered over certain channel only. Values: email, push
4847
* @param int $pageNo Optional: number of the page to retrieve. Typically this parameter value is derived from initial parameter less call when caller learns total amount of page of certain size
4948
* @param int $pageSize Optional: number of the packages to retrieve per page. Page size cannot exceed system configured maximum page size for this API which is 100
5049
*
5150
* @return array
5251
*/
5352
public function getNotifications($dateFrom = null, $dateTo = null, $type = null, $language = null, $status = null,
54-
$channel = null, $pageNo = 1, $pageSize = 20)
53+
$pageNo = 1, $pageSize = 20)
5554
{
5655
$dateFromString = ($dateFrom instanceof DateTime) ? $dateFrom->format('Y-m-d\TH:i:s\Z') : $dateFrom;
5756
$dateToString = ($dateTo instanceof DateTime) ? $dateTo->format('Y-m-d\TH:i:s\Z') : $dateTo;
@@ -62,7 +61,6 @@ public function getNotifications($dateFrom = null, $dateTo = null, $type = null,
6261
'type' => $type,
6362
'language' => $language,
6463
'status' => $status,
65-
'channel' => $channel,
6664
'pageNo' => $pageNo,
6765
'pageSize' => $pageSize,
6866
];

src/Service/Taxpayer/TaxPayerService.php

+28
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,32 @@ public function validateTaxPayerTin($tin, $idType, $idValue)
6262
}
6363
return $response;
6464
}
65+
66+
/**
67+
* This API allows taxpayer's ERP system to search for a specific Tax Identification Number (TIN)
68+
* using the supported search parameters. The available search parameters are either
69+
* the Taxpayer Name or ID Type and ID Value, or all three parameters combined.
70+
* If all parameters are provided then the search would use an AND operator to make sure the result
71+
* found matches all search parameters provided.
72+
*
73+
* @param string $taxPayerName The Taxpayer Name.
74+
* @param string $idType NRIC, Passport number, Business registration number, army number
75+
* @param string $idValue The actual value of the ID Type selected. For example, if NRIC selected as ID Type, then pass the NRIC value here.
76+
*
77+
* @return string
78+
*/
79+
public function searchTaxPayerTin($taxPayerName = '', $idType = '', $idValue = '')
80+
{
81+
$params = [
82+
'idType' => $idType,
83+
'idValue' => $idValue,
84+
'taxpayerName' => $taxPayerName,
85+
];
86+
$query = '?' . http_build_query($params);
87+
88+
$url = $this->getBaseUrl() . '/search/tin' . $query;
89+
90+
$response = $this->getClient()->request('GET', $url);
91+
return $response;
92+
}
6593
}

src/Ubl/Constant/CountryCodes.php

+8
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public static function getItems()
5151
CountryCodes::CODE => "AND",
5252
CountryCodes::COUNTRY => "ANDORA"
5353
],
54+
[
55+
CountryCodes::CODE => "ANT",
56+
CountryCodes::COUNTRY => "NETHERLANDS ANTILLES"
57+
],
5458
[
5559
CountryCodes::CODE => "ARE",
5660
CountryCodes::COUNTRY => "UNITED ARAB EMIRATES"
@@ -1003,6 +1007,10 @@ public static function getItems()
10031007
CountryCodes::CODE => "WSM",
10041008
CountryCodes::COUNTRY => "SAMOA"
10051009
],
1010+
[
1011+
CountryCodes::CODE => "XKX",
1012+
CountryCodes::COUNTRY => "KOSOVO"
1013+
],
10061014
[
10071015
CountryCodes::CODE => "YEM",
10081016
CountryCodes::COUNTRY => "YEMEN"

0 commit comments

Comments
 (0)