|
3 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; |
4 | 4 | import static org.junit.jupiter.api.Assertions.assertInstanceOf; |
5 | 5 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 6 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
6 | 7 |
|
7 | 8 | import io.facturapi.enums.CancellationStatus; |
8 | 9 | import io.facturapi.enums.InvoiceStatus; |
@@ -143,6 +144,33 @@ void organizationListLiveApiKeysIsTyped() { |
143 | 144 | assertEquals("/v2/organizations/org_1/apikeys/live", request.uri().getPath()); |
144 | 145 | } |
145 | 146 |
|
| 147 | + @Test |
| 148 | + void organizationDefaultSeriesCanBeUpdated() { |
| 149 | + StubHttpClient httpClient = new StubHttpClient(); |
| 150 | + httpClient.enqueueJson(200, "{\"id\":\"org_1\"}"); |
| 151 | + |
| 152 | + Facturapi sdk = new Facturapi( |
| 153 | + FacturapiConfig.builder("sk_test") |
| 154 | + .httpClient(httpClient.client()) |
| 155 | + .build() |
| 156 | + ); |
| 157 | + |
| 158 | + var response = sdk.organizations().updateDefaultSeries( |
| 159 | + "org_1", |
| 160 | + Map.of( |
| 161 | + "type", "I", |
| 162 | + "series", "A" |
| 163 | + ) |
| 164 | + ); |
| 165 | + |
| 166 | + assertEquals("org_1", response.getId()); |
| 167 | + var request = httpClient.requests().get(0); |
| 168 | + assertEquals("PUT", request.method()); |
| 169 | + assertEquals("/v2/organizations/org_1/series-group/default-series", request.uri().getPath()); |
| 170 | + assertTrue(request.bodyUtf8().contains("\"type\":\"I\"")); |
| 171 | + assertTrue(request.bodyUtf8().contains("\"series\":\"A\"")); |
| 172 | + } |
| 173 | + |
146 | 174 | @Test |
147 | 175 | void invoiceComplementsAreTypedForPagoNominaAndCustom() { |
148 | 176 | StubHttpClient httpClient = new StubHttpClient(); |
|
0 commit comments