Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove bulkantecipation routes on v4 #422

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ Você pode acessar a documentação oficial do Pagar.me acessando esse [link](ht
- [Antecipações](#antecipações)
- [Criando uma antecipação](#criando-uma-antecipação)
- [Obtendo os limites de antecipação](#obtendo-os-limites-de-antecipação)
- [Confirmando uma antecipação building](#confirmando-uma-antecipação-building)
- [Cancelando uma antecipação pending](#cancelando-uma-antecipação-pending)
- [Deletando uma antecipação building](#deletando-uma-antecipação-building)
- [Retornando antecipações](#retornando-antecipações)
- [Contas bancárias](#contas-bancárias)
- [Criando uma conta bancária](#criando-uma-conta-bancária)
Expand Down Expand Up @@ -847,7 +845,6 @@ Para entender o que são as antecipações, você deve acessar esse [link](https
<?php
$anticipation = $pagarme->bulkAnticipations()->create([
'recipient_id' => 're_cjeptpdyg03u3cb6elj68p5ej',
'build' => 'true',
'payment_date' => '1536883200000',
'requested_amount' => '300000',
'timeframe' => 'start'
Expand All @@ -865,16 +862,6 @@ $anticipationLimits = $pagarme->bulkAnticipations()->getLimits([
]);
```

### Confirmando uma antecipação building

```php
<?php
$confirmedAnticipation = $pagarme->bulkAnticipations()->confirm([
'recipient_id' => 'ID_DO_RECEBEDOR',
'bulk_anticipation_id' => 'ID_DA_ANTECIPAÇÃO',
]);
```

### Cancelando uma antecipação pending

```php
Expand All @@ -885,16 +872,6 @@ $canceledAnticipation = $pagarme->bulkAnticipations()->cancel([
]);
```

### Deletando uma antecipação building

```php
<?php
$deletedAnticipation = $pagarme->bulkAnticipations()->delete([
'recipient_id' => 'ID_DO_RECEBEDOR',
'bulk_anticipation_id' => 'ID_DA_ANTECIPAÇÃO',
]);
```

### Retornando antecipações

```php
Expand Down
34 changes: 0 additions & 34 deletions src/Endpoints/BulkAnticipations.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,6 @@ public function getLimits(array $payload)
);
}

/**
* @param array $payload
*
* @return \ArrayObject
*/
public function confirm(array $payload)
{
return $this->client->request(
self::POST,
Routes::bulkAnticipations()->confirm(
$payload['recipient_id'],
$payload['bulk_anticipation_id']
),
['json' => $payload]
);
}

/**
* @param array $payload
*
Expand All @@ -70,23 +53,6 @@ public function cancel(array $payload)
);
}

/**
* @param array $payload
*
* @return \ArrayObject
*/
public function delete(array $payload)
{
return $this->client->request(
self::DELETE,
Routes::bulkAnticipations()->delete(
$payload['recipient_id'],
$payload['bulk_anticipation_id']
),
['json' => $payload]
);
}

/**
* @param array $payload
*
Expand Down
8 changes: 0 additions & 8 deletions src/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,10 @@ public static function bulkAnticipations()
return "recipients/$recipientId/bulk_anticipations/limits";
};

$anonymous->confirm = static function ($recipientId, $bulkAnticipationId) {
return "recipients/$recipientId/bulk_anticipations/$bulkAnticipationId/confirm";
};

$anonymous->cancel = static function ($recipientId, $bulkAnticipationId) {
return "recipients/$recipientId/bulk_anticipations/$bulkAnticipationId/cancel";
};

$anonymous->delete = static function ($recipientId, $bulkAnticipationId) {
return "recipients/$recipientId/bulk_anticipations/$bulkAnticipationId";
};

return $anonymous;
}

Expand Down
58 changes: 0 additions & 58 deletions tests/unit/Endpoints/BulkAnticipationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public function mockProvider()
'limits' => new MockHandler([
new Response(200, [], self::jsonMock('BulkAnticipationLimitsMock'))
]),
'delete' => new MockHandler([
new Response(200, [], '[]')
]),
'list' => new MockHandler([
new Response(200, [], self::jsonMock('BulkAnticipationListMock')),
new Response(200, [], '[]'),
Expand All @@ -42,7 +39,6 @@ public function testBulkAnticipationCreate($mock)
'payment_date' => '1234567890000',
'timeframe' => 'start',
'requested_amount' => '1000',
'build' => true
]);

$this->assertEquals(
Expand Down Expand Up @@ -87,33 +83,6 @@ public function testBulkAnticipationGetLimits($mock)
);
}

/**
* @dataProvider mockProvider
*/
public function testBulkAnticipationConfirm($mock)
{
$container = [];
$client = self::buildClient($container, $mock['anticipation']);

$response = $client->bulkAnticipations()->confirm([
'recipient_id' => 're_abc1234abc1234abc1234abc1',
'bulk_anticipation_id' => 'ba_abc1234abc1234abc1234abc1'
]);

$this->assertEquals(
BulkAnticipations::POST,
self::getRequestMethod($container[0])
);
$this->assertEquals(
'/1/recipients/re_abc1234abc1234abc1234abc1/bulk_anticipations/ba_abc1234abc1234abc1234abc1/confirm',
self::getRequestUri($container[0])
);
$this->assertEquals(
json_decode(self::jsonMock('BulkAnticipationMock')),
$response
);
}

/**
* @dataProvider mockProvider
*/
Expand Down Expand Up @@ -141,33 +110,6 @@ public function testBulkAnticipationCancel($mock)
);
}

/**
* @dataProvider mockProvider
*/
public function testBulkAnticipationDelete($mock)
{
$container = [];
$client = self::buildClient($container, $mock['delete']);

$response = $client->bulkAnticipations()->delete([
'recipient_id' => 're_abc1234abc1234abc1234abc1',
'bulk_anticipation_id' => 'ba_abc1234abc1234abc1234abc1'
]);

$this->assertEquals(
BulkAnticipations::DELETE,
self::getRequestMethod($container[0])
);
$this->assertEquals(
'/1/recipients/re_abc1234abc1234abc1234abc1/bulk_anticipations/ba_abc1234abc1234abc1234abc1',
self::getRequestUri($container[0])
);
$this->assertEquals(
[],
$response
);
}

/**
* @dataProvider mockProvider
*/
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/RoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,8 @@ public function testBulkAnticipationsRoutes()
$this->assertIsCallable($routes->base);
$this->assertObjectHasAttribute('limits', $routes);
$this->assertIsCallable($routes->limits);
$this->assertObjectHasAttribute('confirm', $routes);
$this->assertIsCallable($routes->confirm);
$this->assertObjectHasAttribute('cancel', $routes);
$this->assertIsCallable($routes->cancel);
$this->assertObjectHasAttribute('delete', $routes);
}

public function testPaymentLinksRoutes()
Expand Down