Skip to content

Commit

Permalink
https://github.com/mage2pro/moip/issues/7
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Jul 22, 2017
1 parent a58cee5 commit 1570c96
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
6 changes: 6 additions & 0 deletions API/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// 2017-06-10
// Possible values: CREDIT_CARD, BOLETO, ONLINE_BANK_DEBIT, WALLET»
// https://dev.moip.com.br/page/api-reference#section-payments
// https://dev.moip.com.br/v2.0/reference#criar-pagamento
// https://dev.moip.com.br/v2.0/reference#pedidos
final class Option {
/**
Expand All @@ -12,4 +13,9 @@ final class Option {
* @used-by \Dfe\Moip\T\CaseT\Payment\Card::pFundingInstrument()
*/
const BANK_CARD = 'CREDIT_CARD';
/**
* 2017-07-21
* @used-by \Dfe\Moip\T\CaseT\Payment\OnlineBanking::pPayment()
*/
const ONLINE_BANKING = 'ONLINE_BANK_DEBIT';
}
1 change: 1 addition & 0 deletions T/CaseT.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @see \Dfe\Moip\T\CaseT\Customer
* @see \Dfe\Moip\T\CaseT\Order
* @see \Dfe\Moip\T\CaseT\Payment\Card
* @see \Dfe\Moip\T\CaseT\Payment\OnlineBanking
* @method \Dfe\Moip\Method m()
*/
abstract class CaseT extends \Df\Payment\TestCase {}
4 changes: 2 additions & 2 deletions T/CaseT/Payment/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// https://dev.moip.com.br/page/api-reference#section-payments
// https://dev.moip.com.br/v2.0/reference#pagamentos
final class Card extends \Dfe\Moip\T\CaseT {
/** 2017-06-09 */
/** @test 2017-06-09 */
function t00() {}

/**
* @test 2017-06-09
* 2017-06-09
* https://dev.moip.com.br/v2.0/reference#criar-pagamento
* https://dev.moip.com.br/page/api-reference#section-create-a-payment-post-
* [Moip] An example of a response to «POST v2/orders/<order ID>/payments» https://mage2.pro/t/4048
Expand Down
53 changes: 53 additions & 0 deletions T/CaseT/Payment/OnlineBanking.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
namespace Dfe\Moip\T\CaseT\Payment;
use Dfe\Moip\API\Facade\Payment as lP;
use Dfe\Moip\API\Option;
use Dfe\Moip\T\Order as tOrder;
// 2017-07-21
// https://dev.moip.com.br/page/api-reference#section-payments
// https://dev.moip.com.br/v2.0/reference#pagamentos
final class OnlineBanking extends \Dfe\Moip\T\CaseT {
/** 2017-07-21 */
function t00() {}

/**
* @test 2017-07-21
* https://dev.moip.com.br/v2.0/reference#criar-pagamento
* https://dev.moip.com.br/page/api-reference#section-create-a-payment-post-
* [Moip] An example of a response to «POST v2/orders/<order ID>/payments» https://mage2.pro/t/4048
*/
function t01_create() {
try {
echo lP::s()->create2((new tOrder)->create()['id'], $this->pPayment())->j();
//echo df_json_encode($this->pPayment());
}
catch (\Exception $e) {
if (function_exists('xdebug_break')) {
xdebug_break();
}
throw $e;
}
}

/**
* 2017-07-21
* @used-by t01_create()
* @return array(string => mixed)
*/
private function pPayment() {return [
// 2017-06-09
// «Payment method»
// Required
'fundingInstrument' => [
// 2017-06-09
// «Method used. Possible values: CREDIT_CARD, BOLETO, ONLINE_BANK_DEBIT, WALLET»
// Required, String.
'method' => Option::ONLINE_BANKING
,'onlineBankDebit' => [
'bankNumber' => '001'
,'expirationDate' => df_today_add(7)->toString('y-MM-dd')
,'returnUri' => dfp_url_customer_return_remote($this)
]
]
];}
}

0 comments on commit 1570c96

Please sign in to comment.