From 84eb9c5e1d97b93ac51bb9b7b389bd8f865f6026 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Tue, 19 Sep 2017 15:15:10 -0300 Subject: [PATCH 01/22] test: Change tests with JSON and improve customer tests Change tests with JSON and improve customer tests --- src/Resource/CustomerCreditCard.php | 50 +++++++++++++++ tests/Resource/CustomerTest.php | 25 ++++++++ tests/Resource/MoipResourceTest.php | 41 ++++++------ tests/TestCase.php | 64 +++++++++++++++---- tests/jsons/account/create.json | 1 + tests/jsons/customer/add_credit_card.json | 1 + tests/jsons/customer/create.json | 1 + tests/jsons/escrow/release.json | 1 + tests/jsons/notification/create.json | 1 + tests/jsons/order/create.json | 1 + tests/jsons/order/get_list.json | 1 + tests/jsons/payment/create_billet.json | 1 + tests/jsons/payment/create_cc_pci.json | 1 + tests/jsons/payment/create_cc_pci_escrow.json | 1 + tests/jsons/payment/create_cc_pci_store.json | 1 + tests/jsons/refund/full_bankaccount.json | 1 + tests/jsons/refund/partial_bankaccount.json | 1 + 17 files changed, 163 insertions(+), 30 deletions(-) create mode 100644 tests/jsons/account/create.json create mode 100644 tests/jsons/customer/add_credit_card.json create mode 100644 tests/jsons/customer/create.json create mode 100644 tests/jsons/escrow/release.json create mode 100644 tests/jsons/notification/create.json create mode 100644 tests/jsons/order/create.json create mode 100644 tests/jsons/order/get_list.json create mode 100644 tests/jsons/payment/create_billet.json create mode 100644 tests/jsons/payment/create_cc_pci.json create mode 100644 tests/jsons/payment/create_cc_pci_escrow.json create mode 100644 tests/jsons/payment/create_cc_pci_store.json create mode 100644 tests/jsons/refund/full_bankaccount.json create mode 100644 tests/jsons/refund/partial_bankaccount.json diff --git a/src/Resource/CustomerCreditCard.php b/src/Resource/CustomerCreditCard.php index 04aa953..681d49f 100644 --- a/src/Resource/CustomerCreditCard.php +++ b/src/Resource/CustomerCreditCard.php @@ -213,4 +213,54 @@ public function setPhone($country_code, $area_code, $number) return $this; } + + /** + * Get credit card id. + * + * @return string + */ + public function getId() + { + return $this->data->creditCard->id; + } + + /** + * Get brand. + * + * @return string + */ + public function getBrand() + { + return $this->data->creditCard->brand; + } + + /** + * Get first 6 characters from credit card. + * + * @return string + */ + public function getFirst6() + { + return $this->data->creditCard->first6; + } + + /** + * Get last 4 characters from credit card. + * + * @return string + */ + public function getLast4() + { + return $this->data->creditCard->last4; + } + + /** + * Get if a credit card was stored or not. + * + * @return boolean + */ + public function getStore() + { + return $this->data->creditCard->store; + } } diff --git a/tests/Resource/CustomerTest.php b/tests/Resource/CustomerTest.php index 6d2074c..1b29bc5 100644 --- a/tests/Resource/CustomerTest.php +++ b/tests/Resource/CustomerTest.php @@ -66,4 +66,29 @@ public function testShippingAddress() $this->assertEquals($customer_original->getShippingAddress()->country, $customer->getShippingAddress()->country); $this->assertEquals($customer_original->getShippingAddress()->zipCode, $customer->getShippingAddress()->zipCode); } + + /** + * MoipTest create credit card for customer. + */ + public function testCreateCreditCard() { + $this->mockHttpSession($this->body_client); + $customer = $this->createCustomer()->create(); + + $this->mockHttpSession($this->body_add_credit_card); + + $creditCard = $this->moip->customers()->creditCard() + ->setExpirationMonth('05') + ->setExpirationYear(2018) + ->setNumber('4012001037141112') + ->setCVC('123') + ->setFullName('Jose Portador da Silva') + ->setBirthDate('1988-12-30') + ->setTaxDocument('CPF', '33333333333') + ->setPhone('55','11','66778899') + ->create($customer->getId()); + + $this->assertNotEmpty($creditCard->getId()); + $this->assertEquals($creditCard->getFirst6(), '401200'); + $this->assertEquals($creditCard->getLast4(), '1112'); + } } diff --git a/tests/Resource/MoipResourceTest.php b/tests/Resource/MoipResourceTest.php index aa35b67..38ea500 100644 --- a/tests/Resource/MoipResourceTest.php +++ b/tests/Resource/MoipResourceTest.php @@ -11,6 +11,18 @@ class MoipResourceTest extends TestCase { + private $filter; + private $pagination; + + public function __construct() + { + parent::__construct(); + $this->filter = new Filters(); + $this->filter->between('amount', 1000, 10000); + $this->filter->in('status', ['NOT_PAID', 'WAITING']); + $this->pagination = new Pagination(10, 0); + } + public function testEndpointGeneratePath() { $path = $this->moip->notifications()->generatePath('notifications', 'NPR-CQU74AQOIVCV'); @@ -18,28 +30,21 @@ public function testEndpointGeneratePath() $this->assertEquals($expected, $path); } - /** - * @dataProvider provider - */ - public function testEndpointGenerateListPath($pagination, $filter, $qParam, $expected) + public function testEndpointGenerateListPathNoParams() { - $path = $this->moip->orders()->generateListPath($pagination, $filter, $qParam); - $this->assertEquals($expected, $path); + $path = $this->moip->orders()->generateListPath(); + $this->assertEquals(sprintf('/%s/%s?%s', MoipResource::VERSION, OrdersList::PATH, ''), $path); } - public function provider() + public function testEndpointGenerateListPaginationFilter() { - $testCases = []; - - $filter = new Filters(); - $filter->between('amount', 1000, 10000); - $filter->in('status', ['NOT_PAID', 'WAITING']); - $pagination = new Pagination(10, 0); - - $testCases[] = [null, null, null, sprintf('/%s/%s?%s', MoipResource::VERSION, OrdersList::PATH, '')]; - $testCases[] = [$pagination, $filter, null, sprintf('/%s/%s?%s', MoipResource::VERSION, OrdersList::PATH, 'limit=10&offset=0&filters='.urlencode('amount::bt(1000,10000)|status::in(NOT_PAID,WAITING)'))]; - $testCases[] = [$pagination, $filter, 'jose augusto', sprintf('/%s/%s?%s', MoipResource::VERSION, OrdersList::PATH, 'limit=10&offset=0&filters='.urlencode('amount::bt(1000,10000)|status::in(NOT_PAID,WAITING)').'&q='.urlencode('jose augusto'))]; + $path = $this->moip->orders()->generateListPath($this->pagination, $this->filter, null); + $this->assertEquals(sprintf('/%s/%s?%s', MoipResource::VERSION, OrdersList::PATH, 'limit=10&offset=0&filters='.urlencode('amount::bt(1000,10000)|status::in(NOT_PAID,WAITING)')), $path); + } - return $testCases; + public function testEndpointGenerateListAllParams() + { + $path = $this->moip->orders()->generateListPath($this->pagination, $this->filter, 'jose augusto'); + $this->assertEquals(sprintf('/%s/%s?%s', MoipResource::VERSION, OrdersList::PATH, 'limit=10&offset=0&filters='.urlencode('amount::bt(1000,10000)|status::in(NOT_PAID,WAITING)').'&q='.urlencode('jose augusto')), $path); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 00986c8..9b7856c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -43,62 +43,62 @@ abstract class TestCase extends PHPUnit_Framework_TestCase /** * @var string response from the client moip API. */ - protected $body_client = '{"id":"CUS-CFMKXQBZNJQQ","ownId":"meu_id_sandbox","fullname":"Jose Silva","email":"jose_silva0@email.com","phone":{"countryCode":"55","areaCode":"11","number":"66778899"},"birthDate":"1989-06-01","taxDocument":{"type":"CPF","number":"22222222222"},"shippingAddress":{"street":"Avenida Faria Lima","streetNumber":"2927","complement":"8","city":"Sao Paulo","state":"SP","country":"BRA","zipCode":"01234000"},"fundingInstruments":[],"createdAt":"2016-02-18T19:55:00.000-02","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/customers/CUS-CFMKXQBZNJQQ"}}}'; + protected $body_client; /** * @var string response from the order moip API. */ - protected $body_order = '{"id":"ORD-HG479ZEIB7LV","ownId":"meu_id_pedido","status":"CREATED","createdAt":"2016-02-19T12:24:55.849-02","updatedAt":"2016-02-19T12:24:55.849-02","amount":{"total":102470,"fees":0,"refunds":0,"liquid":0,"otherReceivers":0,"currency":"BRL","subtotals":{"shipping":1490,"addition":0,"discount":1000,"items":101980}},"items":[{"price":100000,"detail":"Mais info...","quantity":1,"product":"Nome do produto"},{"price":990,"detail":"Abacaxi de terra de areia","quantity":2,"product":"abacaxi"}],"customer":{"id":"CUS-7U5K9KWG8DBZ","ownId":"meu_id_saasdadadsnasdasddboxssssssssss","fullname":"Jose Silva","createdAt":"2016-02-18T20:03:28.000-02","birthDate":"1989-06-01T00:00:00.000-03","email":"jose_silva0@email.com","phone":{"countryCode":"55","areaCode":"11","number":"66778899"},"taxDocument":{"type":"CPF","number":"22222222222"},"shippingAddress":{"zipCode":"01234000","street":"Avenida Faria Lima","streetNumber":"2927","complement":"8","city":"Sao Paulo","district":"Itaim","state":"SP","country":"BRA"},"_links":{"self":{"href":"https://sandbox.moip.com.br/v2/customers/CUS-7U5K9KWG8DBZ"}}},"payments":[],"refunds":[],"entries":[],"events":[{"type":"ORDER.CREATED","createdAt":"2016-02-19T12:24:55.849-02","description":""}],"receivers":[{"moipAccount":{"id":"MPA-7ED9D2D0BC81","login":"ev@traca.com.br","fullname":"Carmen Elisabete de Menezes ME"},"type":"PRIMARY","amount":{"total":102470,"fees":0,"refunds":0}}],"shippingAddress":{"zipCode":"01234000","street":"Avenida Faria Lima","streetNumber":"2927","complement":"8","city":"Sao Paulo","district":"Itaim","state":"SP","country":"BRA"},"_links":{"self":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-HG479ZEIB7LV"},"checkout":{"payOnlineBankDebitItau":{"redirectHref":"https://checkout-sandbox.moip.com.br/debit/itau/ORD-HG479ZEIB7LV"},"payCreditCard":{"redirectHref":"https://checkout-sandbox.moip.com.br/creditcard/ORD-HG479ZEIB7LV"},"payBoleto":{"redirectHref":"https://checkout-sandbox.moip.com.br/boleto/ORD-HG479ZEIB7LV"}}}}'; + protected $body_order; /** * @var string response from moip API. */ - protected $body_cc_pay_pci = '{"id":"PAY-L6J2NKS9OGYU","status":"IN_ANALYSIS","delayCapture":false,"amount":{"total":102470,"fees":5695,"refunds":0,"liquid":96775,"currency":"BRL"},"installmentCount":1,"fundingInstrument":{"creditCard":{"id":"CRC-2TJ13YB4Y1WU","brand":"MASTERCARD","first6":"555566","last4":"8884","holder":{"birthdate":"1989-06-01","birthDate":"1989-06-01","taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Jose Silva"}},"method":"CREDIT_CARD"},"fees":[{"type":"TRANSACTION","amount":5695}],"events":[{"type":"PAYMENT.IN_ANALYSIS","createdAt":"2016-02-19T18:18:54.535-02"},{"type":"PAYMENT.CREATED","createdAt":"2016-02-19T18:18:51.946-02"}],"_links":{"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-8UDL4K9VRJTB","title":"ORD-8UDL4K9VRJTB"},"self":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-L6J2NKS9OGYU"}},"createdAt":"2016-02-19T18:18:51.944-02","updatedAt":"2016-02-19T18:18:54.535-02"}'; + protected $body_cc_pay_pci; /** * @var string response from moip API. */ - protected $body_cc_pay_pci_store = '{"id":"PAY-L6J2NKS9OGYU","status":"IN_ANALYSIS","delayCapture":false,"amount":{"total":102470,"fees":5695,"refunds":0,"liquid":96775,"currency":"BRL"},"installmentCount":1,"fundingInstrument":{"creditCard":{"id":"CRC-2TJ13YB4Y1WU","brand":"MASTERCARD","first6":"555566","last4":"8884","store":false,"holder":{"birthdate":"1989-06-01","birthDate":"1989-06-01","taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Jose Silva"}},"method":"CREDIT_CARD"},"fees":[{"type":"TRANSACTION","amount":5695}],"events":[{"type":"PAYMENT.IN_ANALYSIS","createdAt":"2016-02-19T18:18:54.535-02"},{"type":"PAYMENT.CREATED","createdAt":"2016-02-19T18:18:51.946-02"}],"_links":{"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-8UDL4K9VRJTB","title":"ORD-8UDL4K9VRJTB"},"self":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-L6J2NKS9OGYU"}},"createdAt":"2016-02-19T18:18:51.944-02","updatedAt":"2016-02-19T18:18:54.535-02"}'; + protected $body_cc_pay_pci_store; /** * @var string response from moip API. */ - protected $body_cc_pay_pci_escrow = '{"id":"PAY-DB5TBW0E0Z24","status":"IN_ANALYSIS","delayCapture":false,"amount":{"total":7300,"fees":0,"refunds":0,"liquid":7300,"currency":"BRL"},"installmentCount":1,"statementDescriptor":"minhaLoja.com","fundingInstrument":{"creditCard":{"id":"CRC-7D197TPTPYWQ","brand":"VISA","first6":"401200","last4":"1112","store":true,"holder":{"birthdate":"1988-12-30","birthDate":"1988-12-30","taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Jose Portador da Silva"}},"method":"CREDIT_CARD"},"fees":[{"type":"TRANSACTION","amount":0}],"escrows":[{"id":"ECW-MYB3UUWHHPM9","status":"HOLD_PENDING","description":"teste de descricao","amount":7300,"createdAt":"2017-07-05T10:19:19.156-03","updatedAt":"2017-07-05T10:19:19.156-03","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/escrows/ECW-MYB3UUWHHPM9"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-QDDLVRVO8ZTK","title":"ORD-QDDLVRVO8ZTK"},"payment":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-DB5TBW0E0Z24","title":"PAY-DB5TBW0E0Z24"}}}],"events":[{"type":"PAYMENT.IN_ANALYSIS","createdAt":"2017-07-05T10:19:19.299-03"},{"type":"PAYMENT.CREATED","createdAt":"2017-07-05T10:19:19.125-03"}],"receivers":[{"moipAccount":{"id":"MPA-7ED9D2D0BC81","login":"ev@traca.com.br","fullname":"Carmen Elisabete de Menezes ME"},"type":"PRIMARY","amount":{"total":7300,"refunds":0}}],"_links":{"self":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-DB5TBW0E0Z24"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-QDDLVRVO8ZTK","title":"ORD-QDDLVRVO8ZTK"}},"createdAt":"2017-07-05T10:19:19.117-03","updatedAt":"2017-07-05T10:19:19.299-03"}'; + protected $body_cc_pay_pci_escrow; /** * @var string response from moip API. */ - protected $body_release_escrow = '{"id":"ECW-H57H2GERO1WD","status":"RELEASED","description":"teste de descricao","amount":7300,"createdAt":"2017-07-06T10:57:33.000-03","updatedAt":"2017-07-06T10:57:33.000-03","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/escrows/ECW-H57H2GERO1WD"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-P7SAQDF3ZRK4","title":"ORD-P7SAQDF3ZRK4"},"payment":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-6UIWRQ6YA89A","title":"PAY-6UIWRQ6YA89A"}}}'; + protected $body_release_escrow; /** * @var string response from moip API. */ - protected $body_billet_pay = '{"id":"PAY-XNVIBO5MIQ9S","status":"WAITING","delayCapture":false,"amount":{"total":102470,"fees":3645,"refunds":0,"liquid":98825,"currency":"BRL"},"installmentCount":1,"fundingInstrument":{"boleto":{"expirationDate":"2016-05-21","lineCode":"23793.39126 60000.062608 32001.747909 7 68010000102470"},"method":"BOLETO"},"fees":[{"type":"TRANSACTION","amount":3645}],"events":[{"type":"PAYMENT.CREATED","createdAt":"2016-05-20T15:19:47.000-03"},{"type":"PAYMENT.WAITING","createdAt":"2016-05-20T15:19:47.000-03"}],"_links":{"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-3KSQDBJSTIF6","title":"ORD-3KSQDBJSTIF6"},"payBoleto":{"redirectHref":"https://checkout-sandbox.moip.com.br/boleto/PAY-XNVIBO5MIQ9S"},"self":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-XNVIBO5MIQ9S"}},"updatedAt":"2016-05-20T15:19:47.000-03","createdAt":"2016-05-20T15:19:47.000-03"}'; + protected $body_billet_pay; /** * @var string response from moip API. */ - protected $body_refund_full_bankaccount = '{"id":"REF-F60THFADO8N4","status":"REQUESTED","events":[{"type":"REFUND.REQUESTED","createdAt":"2017-06-27T08:52:36.000-03"}],"amount":{"total":45000,"fees":0,"currency":"BRL"},"type":"FULL","refundingInstrument":{"bankAccount":{"bankNumber":"001","bankName":"BANCO DO BRASIL S.A.","agencyNumber":"1584","agencyCheckNumber":"9","accountNumber":"00210169","accountCheckNumber":"6","type":"CHECKING","holder":{"taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Fulano de Tal"}},"method":"BANK_ACCOUNT"},"createdAt":"2017-06-27T08:52:36.000-03","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/refunds/REF-F60THFADO8N4"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-KNCJJINLN9QL","title":"ORD-KNCJJINLN9QL"},"payment":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-WRZLMJ8JZA9Q","title":"PAY-WRZLMJ8JZA9Q"}}}'; + protected $body_refund_full_bankaccount; /** * @var string response from moip API. */ - protected $body_refund_partial_bankaccount = '{"id":"REF-0R8FSCPTI5IS","status":"REQUESTED","events":[{"type":"REFUND.REQUESTED","createdAt":"2017-06-27T11:27:56.000-03"}],"amount":{"total":20000,"fees":0,"currency":"BRL"},"type":"PARTIAL","refundingInstrument":{"bankAccount":{"bankNumber":"001","bankName":"BANCO DO BRASIL S.A.","agencyNumber":"1584","agencyCheckNumber":"9","accountNumber":"00210169","accountCheckNumber":"6","type":"SAVING","holder":{"taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Fulano de Tal"}},"method":"BANK_ACCOUNT"},"createdAt":"2017-06-27T11:27:56.000-03","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/refunds/REF-0R8FSCPTI5IS"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-0HX56ERCBKWE","title":"ORD-0HX56ERCBKWE"},"payment":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-1177YNDVSO7W","title":"PAY-1177YNDVSO7W"}}}'; + protected $body_refund_partial_bankaccount; /** * @var string response from moip API. */ - protected $body_notification_preference = '{"events":["ORDER.*","PAYMENT.AUTHORIZED","PAYMENT.CANCELLED"],"target":"http://requestb.in/1dhjesw1","media":"WEBHOOK","token":"994e3ffae9214fbc806d01de2dd5d341","id":"NPR-N6QZE3223P98"}'; + protected $body_notification_preference; /** * @var string response from moip API. */ - protected $body_moip_account = '{"id":"MPA-CB428374873D","login":"fulano@email2.com","accessToken":"f16fee8779d84e8ba91588b443b665c6_v2","channelId":"APP-18JTHC3LEMT9","type":"MERCHANT","transparentAccount":true,"email":{"address":"fulano@email2.com","confirmed":false},"person":{"name":"Fulano","lastName":"De Tal","birthDate":"1988-12-30","taxDocument":{"type":"CPF","number":"162.621.310-00"},"address":{"street":"Rua de teste","streetNumber":"123","district":"Bairro","zipcode":"01234567","zipCode":"01234567","city":"Sao Paulo","state":"SP","country":"BRA","complement":"Apt. 23"},"phone":{"countryCode":"55","areaCode":"11","number":"66778899"},"identityDocument":{"number":"4737283560","issuer":"SSP","issueDate":"2015-06-23","type":"RG"},"alternativePhones":[{"countryCode":"55","areaCode":"11","number":"66448899"},{"countryCode":"55","areaCode":"11","number":"66338899"}]},"company":{"name":"Empresa Teste","businessName":"Teste Empresa ME","taxDocument":{"type":"CNPJ","number":"69.086.878/0001-98"},"address":{"street":"Rua de teste 2","streetNumber":"123","district":"Bairro Teste","zipcode":"01234567","zipCode":"01234567","city":"Sao Paulo","state":"SP","country":"BRA","complement":"Apt. 23"},"phone":{"countryCode":"55","areaCode":"11","number":"66558899"},"openingDate":"2011-01-01"},"createdAt":"2017-07-10T13:42:19.967Z","_links":{"self":{"href":"https://sandbox.moip.com.br/moipaccounts/MPA-CB428374873D","title":null}}}'; + protected $body_moip_account; /** * @var string response from moip API. */ - protected $body_order_list = '{"_links":{"next":{"href":"https://test.moip.com.br/v2/orders?filters=&limit=0&offset=0"},"previous":{"href":"https://test.moip.com.br/v2/orders?filters=&limit=0&offset=0"}},"summary":{"count":1410,"amount":143206880},"orders":[{"id":"ORD-YGTX9WA7LJH4","ownId":"ord-596d0a2f27afd","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-R4EVDK7XCWXO","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:17Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-YGTX9WA7LJH4"}},"createdAt":"2017-07-17T16:04:15-0300","updatedAt":"2017-07-17T16:04:17-0300"},{"id":"ORD-V3S4BJVZE498","ownId":"ord-596d0a2b8d761","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-VT4S5A8T7K3Q","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:14Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-V3S4BJVZE498"}},"createdAt":"2017-07-17T16:04:12-0300","updatedAt":"2017-07-17T16:04:14-0300"},{"id":"ORD-G0VSWOKU4XT6","ownId":"ord-596d0a29ccc20","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-8D4X9ORC3AQE","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:12Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-G0VSWOKU4XT6"}},"createdAt":"2017-07-17T16:04:10-0300","updatedAt":"2017-07-17T16:04:12-0300"},{"id":"ORD-X86V05B9C9KP","ownId":"ord-596d0a2817d20","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-ZZ6KTYGB0A3W","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:10Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-X86V05B9C9KP"}},"createdAt":"2017-07-17T16:04:08-0300","updatedAt":"2017-07-17T16:04:10-0300"},{"id":"ORD-CH5KC3651X0F","ownId":"ord-596d0a266f3b8","status":"WAITING","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-JJN5HE5UDBI8","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-CH5KC3651X0F"}},"createdAt":"2017-07-17T16:04:07-0300","updatedAt":"2017-07-17T16:04:07-0300"},{"id":"ORD-9K08IRRNFN7B","ownId":"ord-596d0a24ae966","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-R1TXXR77Q545","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:07Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-9K08IRRNFN7B"}},"createdAt":"2017-07-17T16:04:05-0300","updatedAt":"2017-07-17T16:04:07-0300"},{"id":"ORD-SM7XKXN7MIG5","ownId":"ord-596d0a1d285ad","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-01G3VA7E68Q6","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:00Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-SM7XKXN7MIG5"}},"createdAt":"2017-07-17T16:03:57-0300","updatedAt":"2017-07-17T16:04:00-0300"},{"id":"ORD-H8LPAPRTTAKZ","ownId":"ord-596cbf48d469e","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-T7L8KE7PQN5A","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:44Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-H8LPAPRTTAKZ"}},"createdAt":"2017-07-17T10:44:42-0300","updatedAt":"2017-07-17T10:44:44-0300"},{"id":"ORD-YW3TQK546YIC","ownId":"ord-596cbf4561215","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-9GIQDLRBOIV9","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:40Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-YW3TQK546YIC"}},"createdAt":"2017-07-17T10:44:38-0300","updatedAt":"2017-07-17T10:44:40-0300"},{"id":"ORD-HVR5MWIG0P34","ownId":"ord-596cbf4390fee","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-IVE2AOU9J2N8","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:38Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-HVR5MWIG0P34"}},"createdAt":"2017-07-17T10:44:37-0300","updatedAt":"2017-07-17T10:44:38-0300"},{"id":"ORD-2J5JLVU7EGKB","ownId":"ord-596cbf41d2fbc","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-UAFV8545206B","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:37Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-2J5JLVU7EGKB"}},"createdAt":"2017-07-17T10:44:35-0300","updatedAt":"2017-07-17T10:44:37-0300"},{"id":"ORD-HKRZQVRTRDH8","ownId":"ord-596cbf4010d6e","status":"WAITING","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-BCRX4I3AM9KB","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-HKRZQVRTRDH8"}},"createdAt":"2017-07-17T10:44:33-0300","updatedAt":"2017-07-17T10:44:34-0300"},{"id":"ORD-WLBSRO4P4OSN","ownId":"ord-596cbf3e68ecd","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-X55ILM54CJDD","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:33Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-WLBSRO4P4OSN"}},"createdAt":"2017-07-17T10:44:32-0300","updatedAt":"2017-07-17T10:44:33-0300"},{"id":"ORD-208TQQEBOVGK","ownId":"ord-596cbf370d5b9","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-4ERO22PR5KR0","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:26Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-208TQQEBOVGK"}},"createdAt":"2017-07-17T10:44:24-0300","updatedAt":"2017-07-17T10:44:26-0300"},{"id":"ORD-Y3BUNI0V0LSW","ownId":"ord-596cbc3254a14","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-J3S1516G5JVU","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:33Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-Y3BUNI0V0LSW"}},"createdAt":"2017-07-17T10:31:31-0300","updatedAt":"2017-07-17T10:31:33-0300"},{"id":"ORD-Q7NOC8REYY06","ownId":"ord-596cbc2e9590c","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-HT2FZDWICTK2","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:30Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-Q7NOC8REYY06"}},"createdAt":"2017-07-17T10:31:28-0300","updatedAt":"2017-07-17T10:31:30-0300"},{"id":"ORD-JU20ND03V5HC","ownId":"ord-596cbc2ce0a94","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-TCDRZ8EF41LL","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:28Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-JU20ND03V5HC"}},"createdAt":"2017-07-17T10:31:26-0300","updatedAt":"2017-07-17T10:31:28-0300"},{"id":"ORD-ZN18QTEJPH8V","ownId":"ord-596cbc2b4331f","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-PDF6SCXFCSXB","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:26Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-ZN18QTEJPH8V"}},"createdAt":"2017-07-17T10:31:24-0300","updatedAt":"2017-07-17T10:31:26-0300"},{"id":"ORD-ET4URMB22ZEB","ownId":"ord-596cbc299d9b8","status":"WAITING","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-4MKP4WM73M4V","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-ET4URMB22ZEB"}},"createdAt":"2017-07-17T10:31:23-0300","updatedAt":"2017-07-17T10:31:24-0300"},{"id":"ORD-7S9CWLEOMGSI","ownId":"ord-596cbc27c7853","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-KFPLX5TSEQ3B","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:22Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-7S9CWLEOMGSI"}},"createdAt":"2017-07-17T10:31:21-0300","updatedAt":"2017-07-17T10:31:22-0300"}]}'; + protected $body_order_list; /** * @var string holds the last generated customer ownId. In mock mode it'll be always the default, but it changes on sandbox mode. @@ -113,6 +113,36 @@ abstract class TestCase extends PHPUnit_Framework_TestCase protected $last_ord_id = 'meu_id_pedido'; protected $sandbox_mock = self::MOCK; + public function __construct() { + parent::__construct(); + + $this->body_client = $this->readJsonFile('jsons/customer/create'); + + $this->body_order = $this->readJsonFile('jsons/order/create'); + + $this->body_cc_pay_pci = $this->readJsonFile('jsons/payment/create_cc_pci'); + + $this->body_cc_pay_pci_store = $this->readJsonFile('jsons/payment/create_cc_pci_store'); + + $this->body_cc_pay_pci_escrow = $this->readJsonFile('jsons/payment/create_cc_pci_escrow'); + + $this->body_release_escrow = $this->readJsonFile('jsons/escrow/release'); + + $this->body_billet_pay = $this->readJsonFile('jsons/payment/create_billet'); + + $this->body_refund_full_bankaccount = $this->readJsonFile('jsons/refund/full_bankaccount'); + + $this->body_refund_partial_bankaccount = $this->readJsonFile('jsons/refund/partial_bankaccount'); + + $this->body_notification_preference = $this->readJsonFile('jsons/notification/create'); + + $this->body_moip_account = $this->readJsonFile('jsons/account/create'); + + $this->body_order_list = $this->readJsonFile('jsons/order/get_list'); + + $this->body_add_credit_card = $this->readJsonFile('jsons/customer/add_credit_card'); + } + /** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. @@ -132,6 +162,16 @@ public function setUp() $this->moip = new Moip($auth, Moip::ENDPOINT_SANDBOX); } + /** + * Method to read JSON from a file. + * + * @param string $filename location of file + */ + public function readJsonFile($filename) + { + return file_get_contents("$filename.json", FILE_USE_INCLUDE_PATH); + } + /** * If in MOCK mode returns a mocked Requests_Sessesion if in SANDBOX mode, creates a new session. * diff --git a/tests/jsons/account/create.json b/tests/jsons/account/create.json new file mode 100644 index 0000000..53b020b --- /dev/null +++ b/tests/jsons/account/create.json @@ -0,0 +1 @@ +{"id":"MPA-CB428374873D","login":"fulano@email2.com","accessToken":"f16fee8779d84e8ba91588b443b665c6_v2","channelId":"APP-18JTHC3LEMT9","type":"MERCHANT","transparentAccount":true,"email":{"address":"fulano@email2.com","confirmed":false},"person":{"name":"Fulano","lastName":"De Tal","birthDate":"1988-12-30","taxDocument":{"type":"CPF","number":"162.621.310-00"},"address":{"street":"Rua de teste","streetNumber":"123","district":"Bairro","zipcode":"01234567","zipCode":"01234567","city":"Sao Paulo","state":"SP","country":"BRA","complement":"Apt. 23"},"phone":{"countryCode":"55","areaCode":"11","number":"66778899"},"identityDocument":{"number":"4737283560","issuer":"SSP","issueDate":"2015-06-23","type":"RG"},"alternativePhones":[{"countryCode":"55","areaCode":"11","number":"66448899"},{"countryCode":"55","areaCode":"11","number":"66338899"}]},"company":{"name":"Empresa Teste","businessName":"Teste Empresa ME","taxDocument":{"type":"CNPJ","number":"69.086.878/0001-98"},"address":{"street":"Rua de teste 2","streetNumber":"123","district":"Bairro Teste","zipcode":"01234567","zipCode":"01234567","city":"Sao Paulo","state":"SP","country":"BRA","complement":"Apt. 23"},"phone":{"countryCode":"55","areaCode":"11","number":"66558899"},"openingDate":"2011-01-01"},"createdAt":"2017-07-10T13:42:19.967Z","_links":{"self":{"href":"https://sandbox.moip.com.br/moipaccounts/MPA-CB428374873D","title":null}}} \ No newline at end of file diff --git a/tests/jsons/customer/add_credit_card.json b/tests/jsons/customer/add_credit_card.json new file mode 100644 index 0000000..c3c282f --- /dev/null +++ b/tests/jsons/customer/add_credit_card.json @@ -0,0 +1 @@ +{"creditCard":{"id":"CRC-NMNW6VIY2L0T","brand":"VISA","first6":"401200","last4":"1112","store":true},"card":{"brand":"VISA","store":true},"method":"CREDIT_CARD"} \ No newline at end of file diff --git a/tests/jsons/customer/create.json b/tests/jsons/customer/create.json new file mode 100644 index 0000000..43ba50a --- /dev/null +++ b/tests/jsons/customer/create.json @@ -0,0 +1 @@ +{"id":"CUS-CFMKXQBZNJQQ","ownId":"meu_id_sandbox","fullname":"Jose Silva","email":"jose_silva0@email.com","phone":{"countryCode":"55","areaCode":"11","number":"66778899"},"birthDate":"1989-06-01","taxDocument":{"type":"CPF","number":"22222222222"},"shippingAddress":{"street":"Avenida Faria Lima","streetNumber":"2927","complement":"8","city":"Sao Paulo","state":"SP","country":"BRA","zipCode":"01234000"},"fundingInstruments":[],"createdAt":"2016-02-18T19:55:00.000-02","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/customers/CUS-CFMKXQBZNJQQ"}}} \ No newline at end of file diff --git a/tests/jsons/escrow/release.json b/tests/jsons/escrow/release.json new file mode 100644 index 0000000..22acc7b --- /dev/null +++ b/tests/jsons/escrow/release.json @@ -0,0 +1 @@ +{"id":"ECW-H57H2GERO1WD","status":"RELEASED","description":"teste de descricao","amount":7300,"createdAt":"2017-07-06T10:57:33.000-03","updatedAt":"2017-07-06T10:57:33.000-03","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/escrows/ECW-H57H2GERO1WD"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-P7SAQDF3ZRK4","title":"ORD-P7SAQDF3ZRK4"},"payment":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-6UIWRQ6YA89A","title":"PAY-6UIWRQ6YA89A"}}} \ No newline at end of file diff --git a/tests/jsons/notification/create.json b/tests/jsons/notification/create.json new file mode 100644 index 0000000..1992bcd --- /dev/null +++ b/tests/jsons/notification/create.json @@ -0,0 +1 @@ +{"events":["ORDER.*","PAYMENT.AUTHORIZED","PAYMENT.CANCELLED"],"target":"http://requestb.in/1dhjesw1","media":"WEBHOOK","token":"994e3ffae9214fbc806d01de2dd5d341","id":"NPR-N6QZE3223P98"} \ No newline at end of file diff --git a/tests/jsons/order/create.json b/tests/jsons/order/create.json new file mode 100644 index 0000000..de0f223 --- /dev/null +++ b/tests/jsons/order/create.json @@ -0,0 +1 @@ +{"id":"ORD-HG479ZEIB7LV","ownId":"meu_id_pedido","status":"CREATED","createdAt":"2016-02-19T12:24:55.849-02","updatedAt":"2016-02-19T12:24:55.849-02","amount":{"total":102470,"fees":0,"refunds":0,"liquid":0,"otherReceivers":0,"currency":"BRL","subtotals":{"shipping":1490,"addition":0,"discount":1000,"items":101980}},"items":[{"price":100000,"detail":"Mais info...","quantity":1,"product":"Nome do produto"},{"price":990,"detail":"Abacaxi de terra de areia","quantity":2,"product":"abacaxi"}],"customer":{"id":"CUS-7U5K9KWG8DBZ","ownId":"meu_id_saasdadadsnasdasddboxssssssssss","fullname":"Jose Silva","createdAt":"2016-02-18T20:03:28.000-02","birthDate":"1989-06-01T00:00:00.000-03","email":"jose_silva0@email.com","phone":{"countryCode":"55","areaCode":"11","number":"66778899"},"taxDocument":{"type":"CPF","number":"22222222222"},"shippingAddress":{"zipCode":"01234000","street":"Avenida Faria Lima","streetNumber":"2927","complement":"8","city":"Sao Paulo","district":"Itaim","state":"SP","country":"BRA"},"_links":{"self":{"href":"https://sandbox.moip.com.br/v2/customers/CUS-7U5K9KWG8DBZ"}}},"payments":[],"refunds":[],"entries":[],"events":[{"type":"ORDER.CREATED","createdAt":"2016-02-19T12:24:55.849-02","description":""}],"receivers":[{"moipAccount":{"id":"MPA-7ED9D2D0BC81","login":"ev@traca.com.br","fullname":"Carmen Elisabete de Menezes ME"},"type":"PRIMARY","amount":{"total":102470,"fees":0,"refunds":0}}],"shippingAddress":{"zipCode":"01234000","street":"Avenida Faria Lima","streetNumber":"2927","complement":"8","city":"Sao Paulo","district":"Itaim","state":"SP","country":"BRA"},"_links":{"self":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-HG479ZEIB7LV"},"checkout":{"payOnlineBankDebitItau":{"redirectHref":"https://checkout-sandbox.moip.com.br/debit/itau/ORD-HG479ZEIB7LV"},"payCreditCard":{"redirectHref":"https://checkout-sandbox.moip.com.br/creditcard/ORD-HG479ZEIB7LV"},"payBoleto":{"redirectHref":"https://checkout-sandbox.moip.com.br/boleto/ORD-HG479ZEIB7LV"}}}} \ No newline at end of file diff --git a/tests/jsons/order/get_list.json b/tests/jsons/order/get_list.json new file mode 100644 index 0000000..a26fb12 --- /dev/null +++ b/tests/jsons/order/get_list.json @@ -0,0 +1 @@ +{"_links":{"next":{"href":"https://test.moip.com.br/v2/orders?filters=&limit=0&offset=0"},"previous":{"href":"https://test.moip.com.br/v2/orders?filters=&limit=0&offset=0"}},"summary":{"count":1410,"amount":143206880},"orders":[{"id":"ORD-YGTX9WA7LJH4","ownId":"ord-596d0a2f27afd","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-R4EVDK7XCWXO","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:17Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-YGTX9WA7LJH4"}},"createdAt":"2017-07-17T16:04:15-0300","updatedAt":"2017-07-17T16:04:17-0300"},{"id":"ORD-V3S4BJVZE498","ownId":"ord-596d0a2b8d761","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-VT4S5A8T7K3Q","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:14Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-V3S4BJVZE498"}},"createdAt":"2017-07-17T16:04:12-0300","updatedAt":"2017-07-17T16:04:14-0300"},{"id":"ORD-G0VSWOKU4XT6","ownId":"ord-596d0a29ccc20","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-8D4X9ORC3AQE","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:12Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-G0VSWOKU4XT6"}},"createdAt":"2017-07-17T16:04:10-0300","updatedAt":"2017-07-17T16:04:12-0300"},{"id":"ORD-X86V05B9C9KP","ownId":"ord-596d0a2817d20","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-ZZ6KTYGB0A3W","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:10Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-X86V05B9C9KP"}},"createdAt":"2017-07-17T16:04:08-0300","updatedAt":"2017-07-17T16:04:10-0300"},{"id":"ORD-CH5KC3651X0F","ownId":"ord-596d0a266f3b8","status":"WAITING","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-JJN5HE5UDBI8","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-CH5KC3651X0F"}},"createdAt":"2017-07-17T16:04:07-0300","updatedAt":"2017-07-17T16:04:07-0300"},{"id":"ORD-9K08IRRNFN7B","ownId":"ord-596d0a24ae966","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-R1TXXR77Q545","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:07Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-9K08IRRNFN7B"}},"createdAt":"2017-07-17T16:04:05-0300","updatedAt":"2017-07-17T16:04:07-0300"},{"id":"ORD-SM7XKXN7MIG5","ownId":"ord-596d0a1d285ad","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-01G3VA7E68Q6","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T16:04:00Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-SM7XKXN7MIG5"}},"createdAt":"2017-07-17T16:03:57-0300","updatedAt":"2017-07-17T16:04:00-0300"},{"id":"ORD-H8LPAPRTTAKZ","ownId":"ord-596cbf48d469e","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-T7L8KE7PQN5A","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:44Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-H8LPAPRTTAKZ"}},"createdAt":"2017-07-17T10:44:42-0300","updatedAt":"2017-07-17T10:44:44-0300"},{"id":"ORD-YW3TQK546YIC","ownId":"ord-596cbf4561215","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-9GIQDLRBOIV9","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:40Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-YW3TQK546YIC"}},"createdAt":"2017-07-17T10:44:38-0300","updatedAt":"2017-07-17T10:44:40-0300"},{"id":"ORD-HVR5MWIG0P34","ownId":"ord-596cbf4390fee","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-IVE2AOU9J2N8","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:38Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-HVR5MWIG0P34"}},"createdAt":"2017-07-17T10:44:37-0300","updatedAt":"2017-07-17T10:44:38-0300"},{"id":"ORD-2J5JLVU7EGKB","ownId":"ord-596cbf41d2fbc","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-UAFV8545206B","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:37Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-2J5JLVU7EGKB"}},"createdAt":"2017-07-17T10:44:35-0300","updatedAt":"2017-07-17T10:44:37-0300"},{"id":"ORD-HKRZQVRTRDH8","ownId":"ord-596cbf4010d6e","status":"WAITING","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-BCRX4I3AM9KB","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-HKRZQVRTRDH8"}},"createdAt":"2017-07-17T10:44:33-0300","updatedAt":"2017-07-17T10:44:34-0300"},{"id":"ORD-WLBSRO4P4OSN","ownId":"ord-596cbf3e68ecd","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-X55ILM54CJDD","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:33Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-WLBSRO4P4OSN"}},"createdAt":"2017-07-17T10:44:32-0300","updatedAt":"2017-07-17T10:44:33-0300"},{"id":"ORD-208TQQEBOVGK","ownId":"ord-596cbf370d5b9","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-4ERO22PR5KR0","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:44:26Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-208TQQEBOVGK"}},"createdAt":"2017-07-17T10:44:24-0300","updatedAt":"2017-07-17T10:44:26-0300"},{"id":"ORD-Y3BUNI0V0LSW","ownId":"ord-596cbc3254a14","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-J3S1516G5JVU","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:33Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-Y3BUNI0V0LSW"}},"createdAt":"2017-07-17T10:31:31-0300","updatedAt":"2017-07-17T10:31:33-0300"},{"id":"ORD-Q7NOC8REYY06","ownId":"ord-596cbc2e9590c","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-HT2FZDWICTK2","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:30Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-Q7NOC8REYY06"}},"createdAt":"2017-07-17T10:31:28-0300","updatedAt":"2017-07-17T10:31:30-0300"},{"id":"ORD-JU20ND03V5HC","ownId":"ord-596cbc2ce0a94","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-TCDRZ8EF41LL","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:28Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-JU20ND03V5HC"}},"createdAt":"2017-07-17T10:31:26-0300","updatedAt":"2017-07-17T10:31:28-0300"},{"id":"ORD-ZN18QTEJPH8V","ownId":"ord-596cbc2b4331f","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-PDF6SCXFCSXB","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:26Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-ZN18QTEJPH8V"}},"createdAt":"2017-07-17T10:31:24-0300","updatedAt":"2017-07-17T10:31:26-0300"},{"id":"ORD-ET4URMB22ZEB","ownId":"ord-596cbc299d9b8","status":"WAITING","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-4MKP4WM73M4V","installmentCount":1,"fundingInstrument":{"method":"BOLETO","brand":null}}],"events":[],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-ET4URMB22ZEB"}},"createdAt":"2017-07-17T10:31:23-0300","updatedAt":"2017-07-17T10:31:24-0300"},{"id":"ORD-7S9CWLEOMGSI","ownId":"ord-596cbc27c7853","status":"PAID","blocked":false,"amount":{"total":102470,"addition":0,"fees":0,"deduction":0,"otherReceivers":0,"currency":"BRL"},"receivers":[{"type":"PRIMARY","moipAccount":{"id":"MPA-8D5DBB4EF8B8"}}],"customer":{"fullname":"jose silva","email":"jose_silva0@email.com"},"items":[{"product":null}],"payments":[{"id":"PAY-KFPLX5TSEQ3B","installmentCount":1,"fundingInstrument":{"method":"CREDIT_CARD","brand":"MASTERCARD"}}],"events":[{"type":"PAYMENT.AUTHORIZED","createdAt":"2017-07-17T10:31:22Z"}],"_links":{"self":{"href":"https://test.moip.com.br/v2/orders/ORD-7S9CWLEOMGSI"}},"createdAt":"2017-07-17T10:31:21-0300","updatedAt":"2017-07-17T10:31:22-0300"}]} \ No newline at end of file diff --git a/tests/jsons/payment/create_billet.json b/tests/jsons/payment/create_billet.json new file mode 100644 index 0000000..c8bccd9 --- /dev/null +++ b/tests/jsons/payment/create_billet.json @@ -0,0 +1 @@ +{"id":"PAY-XNVIBO5MIQ9S","status":"WAITING","delayCapture":false,"amount":{"total":102470,"fees":3645,"refunds":0,"liquid":98825,"currency":"BRL"},"installmentCount":1,"fundingInstrument":{"boleto":{"expirationDate":"2016-05-21","lineCode":"23793.39126 60000.062608 32001.747909 7 68010000102470"},"method":"BOLETO"},"fees":[{"type":"TRANSACTION","amount":3645}],"events":[{"type":"PAYMENT.CREATED","createdAt":"2016-05-20T15:19:47.000-03"},{"type":"PAYMENT.WAITING","createdAt":"2016-05-20T15:19:47.000-03"}],"_links":{"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-3KSQDBJSTIF6","title":"ORD-3KSQDBJSTIF6"},"payBoleto":{"redirectHref":"https://checkout-sandbox.moip.com.br/boleto/PAY-XNVIBO5MIQ9S"},"self":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-XNVIBO5MIQ9S"}},"updatedAt":"2016-05-20T15:19:47.000-03","createdAt":"2016-05-20T15:19:47.000-03"} \ No newline at end of file diff --git a/tests/jsons/payment/create_cc_pci.json b/tests/jsons/payment/create_cc_pci.json new file mode 100644 index 0000000..4cd0660 --- /dev/null +++ b/tests/jsons/payment/create_cc_pci.json @@ -0,0 +1 @@ +{"id":"PAY-L6J2NKS9OGYU","status":"IN_ANALYSIS","delayCapture":false,"amount":{"total":102470,"fees":5695,"refunds":0,"liquid":96775,"currency":"BRL"},"installmentCount":1,"fundingInstrument":{"creditCard":{"id":"CRC-2TJ13YB4Y1WU","brand":"MASTERCARD","first6":"555566","last4":"8884","holder":{"birthdate":"1989-06-01","birthDate":"1989-06-01","taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Jose Silva"}},"method":"CREDIT_CARD"},"fees":[{"type":"TRANSACTION","amount":5695}],"events":[{"type":"PAYMENT.IN_ANALYSIS","createdAt":"2016-02-19T18:18:54.535-02"},{"type":"PAYMENT.CREATED","createdAt":"2016-02-19T18:18:51.946-02"}],"_links":{"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-8UDL4K9VRJTB","title":"ORD-8UDL4K9VRJTB"},"self":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-L6J2NKS9OGYU"}},"createdAt":"2016-02-19T18:18:51.944-02","updatedAt":"2016-02-19T18:18:54.535-02"} \ No newline at end of file diff --git a/tests/jsons/payment/create_cc_pci_escrow.json b/tests/jsons/payment/create_cc_pci_escrow.json new file mode 100644 index 0000000..c5c6179 --- /dev/null +++ b/tests/jsons/payment/create_cc_pci_escrow.json @@ -0,0 +1 @@ +{"id":"PAY-DB5TBW0E0Z24","status":"IN_ANALYSIS","delayCapture":false,"amount":{"total":7300,"fees":0,"refunds":0,"liquid":7300,"currency":"BRL"},"installmentCount":1,"statementDescriptor":"minhaLoja.com","fundingInstrument":{"creditCard":{"id":"CRC-7D197TPTPYWQ","brand":"VISA","first6":"401200","last4":"1112","store":true,"holder":{"birthdate":"1988-12-30","birthDate":"1988-12-30","taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Jose Portador da Silva"}},"method":"CREDIT_CARD"},"fees":[{"type":"TRANSACTION","amount":0}],"escrows":[{"id":"ECW-MYB3UUWHHPM9","status":"HOLD_PENDING","description":"teste de descricao","amount":7300,"createdAt":"2017-07-05T10:19:19.156-03","updatedAt":"2017-07-05T10:19:19.156-03","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/escrows/ECW-MYB3UUWHHPM9"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-QDDLVRVO8ZTK","title":"ORD-QDDLVRVO8ZTK"},"payment":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-DB5TBW0E0Z24","title":"PAY-DB5TBW0E0Z24"}}}],"events":[{"type":"PAYMENT.IN_ANALYSIS","createdAt":"2017-07-05T10:19:19.299-03"},{"type":"PAYMENT.CREATED","createdAt":"2017-07-05T10:19:19.125-03"}],"receivers":[{"moipAccount":{"id":"MPA-7ED9D2D0BC81","login":"ev@traca.com.br","fullname":"Carmen Elisabete de Menezes ME"},"type":"PRIMARY","amount":{"total":7300,"refunds":0}}],"_links":{"self":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-DB5TBW0E0Z24"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-QDDLVRVO8ZTK","title":"ORD-QDDLVRVO8ZTK"}},"createdAt":"2017-07-05T10:19:19.117-03","updatedAt":"2017-07-05T10:19:19.299-03"} \ No newline at end of file diff --git a/tests/jsons/payment/create_cc_pci_store.json b/tests/jsons/payment/create_cc_pci_store.json new file mode 100644 index 0000000..8d7940c --- /dev/null +++ b/tests/jsons/payment/create_cc_pci_store.json @@ -0,0 +1 @@ +{"id":"PAY-L6J2NKS9OGYU","status":"IN_ANALYSIS","delayCapture":false,"amount":{"total":102470,"fees":5695,"refunds":0,"liquid":96775,"currency":"BRL"},"installmentCount":1,"fundingInstrument":{"creditCard":{"id":"CRC-2TJ13YB4Y1WU","brand":"MASTERCARD","first6":"555566","last4":"8884","store":false,"holder":{"birthdate":"1989-06-01","birthDate":"1989-06-01","taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Jose Silva"}},"method":"CREDIT_CARD"},"fees":[{"type":"TRANSACTION","amount":5695}],"events":[{"type":"PAYMENT.IN_ANALYSIS","createdAt":"2016-02-19T18:18:54.535-02"},{"type":"PAYMENT.CREATED","createdAt":"2016-02-19T18:18:51.946-02"}],"_links":{"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-8UDL4K9VRJTB","title":"ORD-8UDL4K9VRJTB"},"self":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-L6J2NKS9OGYU"}},"createdAt":"2016-02-19T18:18:51.944-02","updatedAt":"2016-02-19T18:18:54.535-02"} \ No newline at end of file diff --git a/tests/jsons/refund/full_bankaccount.json b/tests/jsons/refund/full_bankaccount.json new file mode 100644 index 0000000..f63aea4 --- /dev/null +++ b/tests/jsons/refund/full_bankaccount.json @@ -0,0 +1 @@ +{"id":"REF-F60THFADO8N4","status":"REQUESTED","events":[{"type":"REFUND.REQUESTED","createdAt":"2017-06-27T08:52:36.000-03"}],"amount":{"total":45000,"fees":0,"currency":"BRL"},"type":"FULL","refundingInstrument":{"bankAccount":{"bankNumber":"001","bankName":"BANCO DO BRASIL S.A.","agencyNumber":"1584","agencyCheckNumber":"9","accountNumber":"00210169","accountCheckNumber":"6","type":"CHECKING","holder":{"taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Fulano de Tal"}},"method":"BANK_ACCOUNT"},"createdAt":"2017-06-27T08:52:36.000-03","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/refunds/REF-F60THFADO8N4"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-KNCJJINLN9QL","title":"ORD-KNCJJINLN9QL"},"payment":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-WRZLMJ8JZA9Q","title":"PAY-WRZLMJ8JZA9Q"}}} \ No newline at end of file diff --git a/tests/jsons/refund/partial_bankaccount.json b/tests/jsons/refund/partial_bankaccount.json new file mode 100644 index 0000000..37b306d --- /dev/null +++ b/tests/jsons/refund/partial_bankaccount.json @@ -0,0 +1 @@ +{"id":"REF-0R8FSCPTI5IS","status":"REQUESTED","events":[{"type":"REFUND.REQUESTED","createdAt":"2017-06-27T11:27:56.000-03"}],"amount":{"total":20000,"fees":0,"currency":"BRL"},"type":"PARTIAL","refundingInstrument":{"bankAccount":{"bankNumber":"001","bankName":"BANCO DO BRASIL S.A.","agencyNumber":"1584","agencyCheckNumber":"9","accountNumber":"00210169","accountCheckNumber":"6","type":"SAVING","holder":{"taxDocument":{"type":"CPF","number":"22222222222"},"fullname":"Fulano de Tal"}},"method":"BANK_ACCOUNT"},"createdAt":"2017-06-27T11:27:56.000-03","_links":{"self":{"href":"https://sandbox.moip.com.br/v2/refunds/REF-0R8FSCPTI5IS"},"order":{"href":"https://sandbox.moip.com.br/v2/orders/ORD-0HX56ERCBKWE","title":"ORD-0HX56ERCBKWE"},"payment":{"href":"https://sandbox.moip.com.br/v2/payments/PAY-1177YNDVSO7W","title":"PAY-1177YNDVSO7W"}}} \ No newline at end of file From 946f4061acdeb345d3efd2385eebe520e369c263 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Tue, 19 Sep 2017 15:39:52 -0300 Subject: [PATCH 02/22] docs(README): Update readme Update readme --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 41b767a..e47c3ff 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ - [Clientes](#clientes) - [Criação](#criando-um-comprador) - [Consulta](#consultando-os-dados-de-um-comprador) + - [Adicionar cartão de crédito](#adicionar-cartão-de-crédito) + - [Deletar cartão de crédito](#deletar-cartão-de-crédito) - [Pedidos](#pedidos) - [Criação](#criando-um-pedido-com-o-comprador-que-acabamos-de-criar) - [Consulta](#consultando-um-pedido) @@ -144,6 +146,33 @@ try { } ``` +### Adicionar cartão de crédito +```php +try { + $customer = $moip->customers()->creditCard() + ->setExpirationMonth('05') + ->setExpirationYear(2018) + ->setNumber('4012001037141112') + ->setCVC('123') + ->setFullName('Jose Portador da Silva') + ->setBirthDate('1988-12-30') + ->setTaxDocument('CPF', '33333333333') + ->setPhone('55','11','66778899') + ->create(CUSTOMER_ID); +} catch (Exception $e) { + printf($e->__toString()); +} +``` + +### Deletar cartão de crédito +```php +try { + $moip->customers()->creditCard()->delete(CREDIT_CARD_ID); +} catch (Exception $e) { + printf($e->__toString()); +} +``` + ## Pedidos ### Criando um pedido com o comprador que acabamos de criar Nesse exemplo com vários produtos e ainda especificando valor de frete, valor adicional e ainda valor de desconto. From 17e6cd23a99799085eaeab1c0770fcc994b2d1e4 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Tue, 19 Sep 2017 16:53:31 -0300 Subject: [PATCH 03/22] feat(Account): Create method to check if an account exists Create method to check if an account exists --- src/Resource/Account.php | 12 ++++++++++++ tests/Resource/AccountTest.php | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Resource/Account.php b/src/Resource/Account.php index 1db9f29..b156dc8 100644 --- a/src/Resource/Account.php +++ b/src/Resource/Account.php @@ -130,6 +130,18 @@ public function get($moip_id) return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $moip_id)); } + /** + * Check if an account exists. + * + * @param string $moip_id + * + * @return stdClass + */ + public function checkAccountExists($moip_id) + { + return $this->getByPath(sprintf('/%s/%s/%s?tax_document=%s', MoipResource::VERSION, self::PATH, 'exists', $moip_id)); + } + /** * Get account id. * diff --git a/tests/Resource/AccountTest.php b/tests/Resource/AccountTest.php index eef6bfa..9719e3c 100644 --- a/tests/Resource/AccountTest.php +++ b/tests/Resource/AccountTest.php @@ -60,4 +60,15 @@ public function testShouldCreateAccountWithCompany() $this->assertEquals('66448899', $account->getAlternativePhones()[0]->number); $this->assertEquals('Teste Empresa ME', $account->getCompany()->businessName); } + + public function testCheckExistingAccount() + { + + } + + public function testCheckNonExistingAccount() + { + + } + } From 157f4887304ee5d418c968a01dd0a7efbe25de10 Mon Sep 17 00:00:00 2001 From: Bruno Date: Wed, 20 Sep 2017 11:49:25 -0300 Subject: [PATCH 04/22] =?UTF-8?q?Novas=20fun=C3=A7=C3=B5es=20para=20o=20bo?= =?UTF-8?q?leto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Novas funções para o boleto: getLineCodeBoleto() -> Código de Barras getHrefPrintBoleto() -> Link da versão /print getExpirationDateBoleto() -> Vencimento do boleto --- src/Resource/Payment.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/Resource/Payment.php b/src/Resource/Payment.php index b6d8a74..f4f684e 100644 --- a/src/Resource/Payment.php +++ b/src/Resource/Payment.php @@ -277,6 +277,39 @@ public function getHrefBoleto() return $this->getIfSet('_links')->payBoleto->redirectHref; } + /** + * Get LineCode to Boleto + * *. + * + * @return stdClass + */ + public function getLineCodeBoleto() + { + return $this->getIfSet('fundingInstrument')->boleto->lineCode; + } + + /** + * Get href from print to Boleto + * *. + * + * @return stdClass + */ + public function getHrefPrintBoleto() + { + return $this->getIfSet('_links')->payBoleto->printHref; + } + + /** + * Get Expirate Date to Boleto + * *. + * + * @return stdClass + */ + public function getExpirationDateBoleto() + { + return $this->getIfSet('fundingInstrument')->boleto->expirationDate; + } + /** * Returns payment amount. * From ec4fb466d61bfd7d4103a5fee6cfee46ed5e9c4c Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Wed, 20 Sep 2017 12:45:46 -0300 Subject: [PATCH 05/22] refactor(Account): Complete tests and fix request without response --- src/Resource/Account.php | 16 +++++++++++++--- src/Resource/MoipResource.php | 16 ++++++++++++++-- tests/Resource/AccountTest.php | 7 +++++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/Resource/Account.php b/src/Resource/Account.php index b156dc8..24494a0 100644 --- a/src/Resource/Account.php +++ b/src/Resource/Account.php @@ -2,6 +2,7 @@ namespace Moip\Resource; +use Moip\Exceptions\ValidationException; use stdClass; /** @@ -133,13 +134,22 @@ public function get($moip_id) /** * Check if an account exists. * - * @param string $moip_id + * @param string $tax_document * * @return stdClass */ - public function checkAccountExists($moip_id) + public function checkAccountExists($tax_document) { - return $this->getByPath(sprintf('/%s/%s/%s?tax_document=%s', MoipResource::VERSION, self::PATH, 'exists', $moip_id)); + try { + $this->getByPathNoPopulate(sprintf('/%s/%s/%s?tax_document=%s', MoipResource::VERSION, self::PATH, 'exists', $tax_document)); + + return true; + } catch (ValidationException $e) { + if ($e->getStatusCode() != 404) { + throw new ValidationException($e->getStatusCode(), $e->getErrors()); + } + } + return false; } /** diff --git a/src/Resource/MoipResource.php b/src/Resource/MoipResource.php index 88e213e..fc29366 100644 --- a/src/Resource/MoipResource.php +++ b/src/Resource/MoipResource.php @@ -260,11 +260,23 @@ protected function httpRequest($path, $method, $payload = null) */ public function getByPath($path) { - $response = $this->httpRequest($path, Requests::GET); - + $response = $this->httpRequest($path, Requests::GET); + return $this->populate($response); } + /** + * Find by path with no populate method. + * + * @param string $path + * + * @return stdClass + */ + public function getByPathNoPopulate($path) + { + return $this->httpRequest($path, Requests::GET); + } + /** * Create a new item in Moip. * diff --git a/tests/Resource/AccountTest.php b/tests/Resource/AccountTest.php index 9719e3c..0057525 100644 --- a/tests/Resource/AccountTest.php +++ b/tests/Resource/AccountTest.php @@ -2,6 +2,7 @@ namespace Moip\Tests\Resource; +use Moip\Exceptions; use Moip\Tests\TestCase; /** @@ -63,12 +64,14 @@ public function testShouldCreateAccountWithCompany() public function testCheckExistingAccount() { - + $this->mockHttpSession('', 200); + $this->assertTrue($this->moip->accounts()->checkAccountExists('123.456.798-91')); } public function testCheckNonExistingAccount() { - + $this->mockHttpSession('', 404); + $this->assertFalse($this->moip->accounts()->checkAccountExists('412.309.725-10')); } } From 0fb597d318a3ef69aec19b5f421fdfa13cfa3bca Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Wed, 20 Sep 2017 15:29:13 -0300 Subject: [PATCH 06/22] docs: Update readme --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e47c3ff..b560bcb 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/9e877cf78f844b9a9e40cec175c3aa5a)](https://www.codacy.com/app/jeancesargarcia/moip-sdk-php?utm_source=github.com&utm_medium=referral&utm_content=moip/moip-sdk-php&utm_campaign=Badge_Grade) [![StyleCI](https://styleci.io/repos/19941899/shield)](https://styleci.io/repos/19941899) [![Build Status](https://travis-ci.org/moip/moip-sdk-php.svg?branch=master)](https://travis-ci.org/moip/moip-sdk-php) -[![Circleci Status](https://circleci.com/gh/moip/moip-sdk-php/tree/analysis-qg67K6.svg?style=shield)](#) > Estatísticas @@ -57,6 +56,10 @@ - [Consulta](#consultando-um-multipedido) - [Multipagamentos](#multipagamentos) - [Criação](#criando-um-multipagamento) + - [Conta Moip](#conta-moip) + - [Criação](#criação) + - [Consulta](#consulta-3) + - [Verifica se usuário já possui Conta Moip](#verifica-se-usuário-já-possui-conta-moip) - [Webhooks](#webhooks) - [Packages](#packages) - [Documentação](#documentação) @@ -379,16 +382,75 @@ try { $hash = 'i1naupwpTLrCSXDnigLLTlOgtm+xBWo6iX54V/hSyfBeFv3rvqa1VyQ8/pqWB2JRQX2GhzfGppXFPCmd/zcmMyDSpdnf1GxHQHmVemxu4AZeNxs+TUAbFWsqEWBa6s95N+O4CsErzemYZHDhsjEgJDe17EX9MqgbN3RFzRmZpJqRvqKXw9abze8hZfEuUJjC6ysnKOYkzDBEyQibvGJjCv3T/0Lz9zFruSrWBw+NxWXNZjXSY0KF8MKmW2Gx1XX1znt7K9bYNfhA/QO+oD+v42hxIeyzneeRcOJ/EXLEmWUsHDokevOkBeyeN4nfnET/BatcDmv8dpGXrTPEoxmmGQ=='; $payment = $multiorder->multipayments() ->setCreditCardHash($hash, $customer) - ->setInstallmentCount(3) - ->setStatementDescriptor('teste de pag') - ->setDelayCapture(false) - ->execute(); - print_r($payment); + ->setInstallmentCount(3) + ->setStatementDescriptor('teste de pag') + ->setDelayCapture(false) + ->execute(); + print_r($payment); } catch (Exception $e) { printf($e->__toString()); } ``` +## Conta Moip + +### Criação +```php +try { + $street = 'Rua de teste'; + $number = 123; + $district = 'Bairro'; + $city = 'Sao Paulo'; + $state = 'SP'; + $zip = '01234567'; + $complement = 'Apt. 23'; + $country = 'BRA'; + $area_code = 11; + $phone_number = 66778899; + $country_code = 55; + $identity_document = '4737283560'; + $issuer = 'SSP'; + $issue_date = '2015-06-23'; + $account = $moip->accounts() + ->setName('Fulano') + ->setLastName('De Tal') + ->setEmail('fulano@email2.com') + ->setIdentityDocument($identity_document, $issuer, $issue_date) + ->setBirthDate('1988-12-30') + ->setTaxDocument('16262131000') + ->setType('MERCHANT') + ->setPhone($area_code, $phone_number, $country_code) + ->addAlternativePhone(11, 66448899, 55) + ->addAddress($street, $number, $district, $city, $state, $zip, $complement, $country) + ->setCompanyName('Empresa Teste', 'Teste Empresa ME') + ->setCompanyOpeningDate('2011-01-01') + ->setCompanyPhone(11, 66558899, 55) + ->setCompanyTaxDocument('69086878000198') + ->setCompanyAddress('Rua de teste 2', 123, 'Bairro Teste', 'Sao Paulo', 'SP', '01234567', 'Apt. 23', 'BRA') + ->setCompanyMainActivity('82.91-1/00', 'Atividades de cobranças e informações cadastrais') + ->create(); + print_r($account); +} catch (Exception $e) { + printf($e->__toString()); +} +``` + +### Consulta +```php +try { + $account = $moip->accounts()->get(ACCOUNT_ID); + print_r($account); +} catch (Exception $e) { + printf($e->__toString()); +} +``` + +### Verifica se usuário já possui conta Moip +```php +// retorna verdadeiro se já possui e falso caso não possuir conta Moip +$moip->accounts()->checkAccountExists(CPF); +``` + ## Webhooks > O PHP, por padrão, está preparado para receber apenas alguns tipos de `content-type` (`application/x-www-form-urlencoded` e `multipart/form-data`). A plataforma do Moip, no entanto, envia dados no formato JSON, o qual a linguagem não está preparada para receber por padrão. Para receber e acessar os dados enviados pelo Moip, você precisa adicionar o seguinte código ao seu arquivo que receberá os webhooks: From b217e78380a8be8398f8f66cf2db5afa0c45865e Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Wed, 20 Sep 2017 15:39:14 -0300 Subject: [PATCH 07/22] style: Fix white-space --- src/Resource/Account.php | 8 ++++---- src/Resource/CustomerCreditCard.php | 10 +++++----- src/Resource/MoipResource.php | 12 ++++++------ tests/Resource/AccountTest.php | 3 +-- tests/Resource/CustomerTest.php | 9 +++++---- tests/TestCase.php | 11 ++++++----- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/Resource/Account.php b/src/Resource/Account.php index 24494a0..fd33b0f 100644 --- a/src/Resource/Account.php +++ b/src/Resource/Account.php @@ -138,19 +138,19 @@ public function get($moip_id) * * @return stdClass */ - public function checkAccountExists($tax_document) - { + public function checkAccountExists($tax_document) + { try { $this->getByPathNoPopulate(sprintf('/%s/%s/%s?tax_document=%s', MoipResource::VERSION, self::PATH, 'exists', $tax_document)); return true; - } catch (ValidationException $e) { + } catch (ValidationException $e) { if ($e->getStatusCode() != 404) { throw new ValidationException($e->getStatusCode(), $e->getErrors()); } } return false; - } + } /** * Get account id. diff --git a/src/Resource/CustomerCreditCard.php b/src/Resource/CustomerCreditCard.php index 681d49f..a3db9c5 100644 --- a/src/Resource/CustomerCreditCard.php +++ b/src/Resource/CustomerCreditCard.php @@ -257,10 +257,10 @@ public function getLast4() /** * Get if a credit card was stored or not. * - * @return boolean + * @return bool */ - public function getStore() - { - return $this->data->creditCard->store; - } + public function getStore() + { + return $this->data->creditCard->store; + } } diff --git a/src/Resource/MoipResource.php b/src/Resource/MoipResource.php index fc29366..ab17284 100644 --- a/src/Resource/MoipResource.php +++ b/src/Resource/MoipResource.php @@ -260,8 +260,8 @@ protected function httpRequest($path, $method, $payload = null) */ public function getByPath($path) { - $response = $this->httpRequest($path, Requests::GET); - + $response = $this->httpRequest($path, Requests::GET); + return $this->populate($response); } @@ -272,10 +272,10 @@ public function getByPath($path) * * @return stdClass */ - public function getByPathNoPopulate($path) - { - return $this->httpRequest($path, Requests::GET); - } + public function getByPathNoPopulate($path) + { + return $this->httpRequest($path, Requests::GET); + } /** * Create a new item in Moip. diff --git a/tests/Resource/AccountTest.php b/tests/Resource/AccountTest.php index 0057525..9fb802f 100644 --- a/tests/Resource/AccountTest.php +++ b/tests/Resource/AccountTest.php @@ -2,7 +2,6 @@ namespace Moip\Tests\Resource; -use Moip\Exceptions; use Moip\Tests\TestCase; /** @@ -70,7 +69,7 @@ public function testCheckExistingAccount() public function testCheckNonExistingAccount() { - $this->mockHttpSession('', 404); + $this->mockHttpSession('', 404); $this->assertFalse($this->moip->accounts()->checkAccountExists('412.309.725-10')); } diff --git a/tests/Resource/CustomerTest.php b/tests/Resource/CustomerTest.php index 1b29bc5..38eeeae 100644 --- a/tests/Resource/CustomerTest.php +++ b/tests/Resource/CustomerTest.php @@ -68,9 +68,10 @@ public function testShippingAddress() } /** - * MoipTest create credit card for customer. - */ - public function testCreateCreditCard() { + * MoipTest create credit card for customer. + */ + public function testCreateCreditCard() + { $this->mockHttpSession($this->body_client); $customer = $this->createCustomer()->create(); @@ -84,7 +85,7 @@ public function testCreateCreditCard() { ->setFullName('Jose Portador da Silva') ->setBirthDate('1988-12-30') ->setTaxDocument('CPF', '33333333333') - ->setPhone('55','11','66778899') + ->setPhone('55', '11', '66778899') ->create($customer->getId()); $this->assertNotEmpty($creditCard->getId()); diff --git a/tests/TestCase.php b/tests/TestCase.php index 9b7856c..5034f51 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -113,7 +113,8 @@ abstract class TestCase extends PHPUnit_Framework_TestCase protected $last_ord_id = 'meu_id_pedido'; protected $sandbox_mock = self::MOCK; - public function __construct() { + public function __construct() + { parent::__construct(); $this->body_client = $this->readJsonFile('jsons/customer/create'); @@ -163,10 +164,10 @@ public function setUp() } /** - * Method to read JSON from a file. - * - * @param string $filename location of file - */ + * Method to read JSON from a file. + * + * @param string $filename location of file + */ public function readJsonFile($filename) { return file_get_contents("$filename.json", FILE_USE_INCLUDE_PATH); From bf344e0732a6c10a25a15670a3ff5f232f63004e Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Wed, 20 Sep 2017 15:45:46 -0300 Subject: [PATCH 08/22] style: Fix white-space --- src/Resource/Account.php | 1 + tests/Resource/AccountTest.php | 1 - tests/Resource/CustomerTest.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Resource/Account.php b/src/Resource/Account.php index fd33b0f..405fc1a 100644 --- a/src/Resource/Account.php +++ b/src/Resource/Account.php @@ -149,6 +149,7 @@ public function checkAccountExists($tax_document) throw new ValidationException($e->getStatusCode(), $e->getErrors()); } } + return false; } diff --git a/tests/Resource/AccountTest.php b/tests/Resource/AccountTest.php index 9fb802f..ed60498 100644 --- a/tests/Resource/AccountTest.php +++ b/tests/Resource/AccountTest.php @@ -72,5 +72,4 @@ public function testCheckNonExistingAccount() $this->mockHttpSession('', 404); $this->assertFalse($this->moip->accounts()->checkAccountExists('412.309.725-10')); } - } diff --git a/tests/Resource/CustomerTest.php b/tests/Resource/CustomerTest.php index 38eeeae..b060266 100644 --- a/tests/Resource/CustomerTest.php +++ b/tests/Resource/CustomerTest.php @@ -87,7 +87,7 @@ public function testCreateCreditCard() ->setTaxDocument('CPF', '33333333333') ->setPhone('55', '11', '66778899') ->create($customer->getId()); - + $this->assertNotEmpty($creditCard->getId()); $this->assertEquals($creditCard->getFirst6(), '401200'); $this->assertEquals($creditCard->getLast4(), '1112'); From e33af8009276de2834678707df97816f5b0a70ed Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Thu, 21 Sep 2017 11:35:47 -0300 Subject: [PATCH 09/22] refactor(Account): Apply suggested fixes from PR Apply suggested fixes from PR --- src/Resource/Account.php | 4 ++-- tests/Resource/AccountTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Resource/Account.php b/src/Resource/Account.php index 405fc1a..12f6058 100644 --- a/src/Resource/Account.php +++ b/src/Resource/Account.php @@ -136,9 +136,9 @@ public function get($moip_id) * * @param string $tax_document * - * @return stdClass + * @return bool */ - public function checkAccountExists($tax_document) + public function checkExistence($tax_document) { try { $this->getByPathNoPopulate(sprintf('/%s/%s/%s?tax_document=%s', MoipResource::VERSION, self::PATH, 'exists', $tax_document)); diff --git a/tests/Resource/AccountTest.php b/tests/Resource/AccountTest.php index ed60498..2e04ad1 100644 --- a/tests/Resource/AccountTest.php +++ b/tests/Resource/AccountTest.php @@ -64,12 +64,12 @@ public function testShouldCreateAccountWithCompany() public function testCheckExistingAccount() { $this->mockHttpSession('', 200); - $this->assertTrue($this->moip->accounts()->checkAccountExists('123.456.798-91')); + $this->assertTrue($this->moip->accounts()->checkExistence('123.456.798-91')); } public function testCheckNonExistingAccount() { $this->mockHttpSession('', 404); - $this->assertFalse($this->moip->accounts()->checkAccountExists('412.309.725-10')); + $this->assertFalse($this->moip->accounts()->checkExistence('412.309.725-10')); } } From fa4a7d49c2650813592a1f764be51e336247a9f5 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Thu, 21 Sep 2017 15:58:09 -0300 Subject: [PATCH 10/22] BREAKING CHANGE: Create method to get a list of webhooks and change method to generate URL Create method to get a list of webhooks and change method to generate URL --- src/Moip.php | 11 +++ src/Resource/MoipResource.php | 13 ++-- src/Resource/Webhook.php | 58 ++++++++++++++++ src/Resource/WebhookList.php | 81 +++++++++++++++++++++++ tests/Resource/MoipResourceTest.php | 4 +- tests/Resource/OrdersListTest.php | 2 +- tests/Resource/WebhookListTest.php | 33 +++++++++ tests/TestCase.php | 6 ++ tests/jsons/webhooks/get_all_filters.json | 1 + tests/jsons/webhooks/get_no_filter.json | 1 + tests/jsons/webhooks/get_pagination.json | 1 + 11 files changed, 204 insertions(+), 7 deletions(-) create mode 100644 src/Resource/Webhook.php create mode 100644 src/Resource/WebhookList.php create mode 100644 tests/Resource/WebhookListTest.php create mode 100644 tests/jsons/webhooks/get_all_filters.json create mode 100644 tests/jsons/webhooks/get_no_filter.json create mode 100644 tests/jsons/webhooks/get_pagination.json diff --git a/src/Moip.php b/src/Moip.php index 3709b45..8a60816 100644 --- a/src/Moip.php +++ b/src/Moip.php @@ -11,6 +11,7 @@ use Moip\Resource\Orders; use Moip\Resource\Payment; use Moip\Resource\Transfers; +use Moip\Resource\WebhookList; use Requests_Session; /** @@ -202,6 +203,16 @@ public function notifications() return new NotificationPreferences($this); } + /** + * Create a new WebhookList instance. + * + * @return WebhookList + */ + public function webhooks() + { + return new WebhookList($this); + } + /** * Get the endpoint. * diff --git a/src/Resource/MoipResource.php b/src/Resource/MoipResource.php index ab17284..ced05e2 100644 --- a/src/Resource/MoipResource.php +++ b/src/Resource/MoipResource.php @@ -177,7 +177,7 @@ public function generatePath($action, $id = null) * * @return string */ - public function generateListPath(Pagination $pagination = null, Filters $filters = null, $qParam = '') + public function generateListPath(Pagination $pagination = null, Filters $filters = null, $otherParams = []) { $queryParams = []; @@ -195,11 +195,16 @@ public function generateListPath(Pagination $pagination = null, Filters $filters $queryParams['filters'] = $filters->__toString(); } - if (!empty($qParam)) { - $queryParams['q'] = $qParam; + if (!empty($otherParams)) { + $queryParams = array_merge($queryParams, $otherParams); } - return sprintf('/%s/%s?%s', self::VERSION, static::PATH, http_build_query($queryParams)); + if (!empty($queryParams)) + { + return sprintf('/%s/%s?%s', self::VERSION, static::PATH, http_build_query($queryParams)); + } + + return sprintf('/%s/%s', self::VERSION, static::PATH); } /** diff --git a/src/Resource/Webhook.php b/src/Resource/Webhook.php new file mode 100644 index 0000000..f7c6d1f --- /dev/null +++ b/src/Resource/Webhook.php @@ -0,0 +1,58 @@ +getIfSet('id'); + } + + /** + * Get resource id. + * + * @return string The webhook id. + */ + public function getResourceId() + { + return $this->getIfSet('resourceId'); + } + + /** + * Get event. + * + * @return string event. + */ + public function getEvent() + { + return $this->getIfSet('event'); + } + + /** + * Get url. + * + * @return string url. + */ + public function getUrl() + { + return $this->getIfSet('url'); + } + + /** + * Get webhook status. + * + * @return string webhook status. + */ + public function getStatus() + { + return $this->getIfSet('status'); + } +} \ No newline at end of file diff --git a/src/Resource/WebhookList.php b/src/Resource/WebhookList.php new file mode 100644 index 0000000..42edd26 --- /dev/null +++ b/src/Resource/WebhookList.php @@ -0,0 +1,81 @@ +data = new stdClass(); + $this->data->webhooks = []; + } + + /** + * Get webhooks. + * + * @return array + */ + public function getWebhooks() + { + return $this->getIfSet('webhooks'); + } + + /** + * Get a webhook. + * + * @param Pagination $pagination + * @param string $resource_id + * @param string $event + * + * @return stdClass + */ + public function get(Pagination $pagination = null, $resource_id = null, $event = null) + { + $params = []; + + if (!is_null($resource_id)) + { + $params['resourceId'] = $resource_id; + } + + if (!is_null($event)) + { + $params['event'] = $event; + } + + return $this->getByPath($this->generateListPath($pagination, null, $params)); + } + + /** + * Mount the seller structure from account. + * + * @param \stdClass $response + * + * @return \Moip\Resource\Webhook Webhook List + */ + protected function populate(stdClass $response) + { + $webhookList = clone $this; + $webhookList->data = new stdClass(); + + $webhookList->data->webhooks = $response->webhooks; + + return $webhookList; + } +} diff --git a/tests/Resource/MoipResourceTest.php b/tests/Resource/MoipResourceTest.php index 38ea500..78bbea2 100644 --- a/tests/Resource/MoipResourceTest.php +++ b/tests/Resource/MoipResourceTest.php @@ -33,7 +33,7 @@ public function testEndpointGeneratePath() public function testEndpointGenerateListPathNoParams() { $path = $this->moip->orders()->generateListPath(); - $this->assertEquals(sprintf('/%s/%s?%s', MoipResource::VERSION, OrdersList::PATH, ''), $path); + $this->assertEquals(sprintf('/%s/%s', MoipResource::VERSION, OrdersList::PATH), $path); } public function testEndpointGenerateListPaginationFilter() @@ -44,7 +44,7 @@ public function testEndpointGenerateListPaginationFilter() public function testEndpointGenerateListAllParams() { - $path = $this->moip->orders()->generateListPath($this->pagination, $this->filter, 'jose augusto'); + $path = $this->moip->orders()->generateListPath($this->pagination, $this->filter, ['q' => 'jose augusto']); $this->assertEquals(sprintf('/%s/%s?%s', MoipResource::VERSION, OrdersList::PATH, 'limit=10&offset=0&filters='.urlencode('amount::bt(1000,10000)|status::in(NOT_PAID,WAITING)').'&q='.urlencode('jose augusto')), $path); } } diff --git a/tests/Resource/OrdersListTest.php b/tests/Resource/OrdersListTest.php index 78a2c47..bd67b31 100644 --- a/tests/Resource/OrdersListTest.php +++ b/tests/Resource/OrdersListTest.php @@ -15,7 +15,7 @@ public function testShouldGetOrderListNoFilter() $filter = new Filters(); $filter->between('value', 1000, 10000); - $orders = $this->moip->orders()->getList(new Pagination(10, 0), $filter, 'jose'); + $orders = $this->moip->orders()->getList(new Pagination(10, 0), $filter, ['q' => 'jose']); $this->assertNotNull($orders->getOrders()); } diff --git a/tests/Resource/WebhookListTest.php b/tests/Resource/WebhookListTest.php new file mode 100644 index 0000000..60d6d36 --- /dev/null +++ b/tests/Resource/WebhookListTest.php @@ -0,0 +1,33 @@ +mockHttpSession($this->body_list_webhook_no_filter); + $webhooks = $this->moip->webhooks()->get(); + + $this->assertNotEmpty($webhooks->getWebhooks()); + } + + public function testGetWebhookPagination() + { + $this->mockHttpSession($this->body_list_webhook_pagination); + $webhooks = $this->moip->webhooks()->get(new Pagination(100, 0)); + + $this->assertNotEmpty($webhooks->getWebhooks()); + } + + public function testGetWebhookParams() + { + $this->mockHttpSession($this->body_list_webhook_all_filters); + $webhooks = $this->moip->webhooks()->get(new Pagination(10, 0), 'ORD-EE5XP23RMLSS', 'ORDER.PAID'); + + $this->assertNotEmpty($webhooks->getWebhooks()); + } +} \ No newline at end of file diff --git a/tests/TestCase.php b/tests/TestCase.php index 5034f51..718e6db 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -142,6 +142,12 @@ public function __construct() $this->body_order_list = $this->readJsonFile('jsons/order/get_list'); $this->body_add_credit_card = $this->readJsonFile('jsons/customer/add_credit_card'); + + $this->body_list_webhook_no_filter = $this->readJsonFile('jsons/webhooks/get_no_filter'); + + $this->body_list_webhook_pagination = $this->readJsonFile('jsons/webhooks/get_pagination'); + + $this->body_list_webhook_all_filters = $this->readJsonFile('jsons/webhooks/get_all_filters'); } /** diff --git a/tests/jsons/webhooks/get_all_filters.json b/tests/jsons/webhooks/get_all_filters.json new file mode 100644 index 0000000..4fbb10f --- /dev/null +++ b/tests/jsons/webhooks/get_all_filters.json @@ -0,0 +1 @@ +{"webhooks":[{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-1HI4ZWSZ2TFG","sentAt":"2017-09-21T17:27:59.808Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-MFQHUUOSWGN8","sentAt":"2017-09-21T17:27:59.793Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-YSZ6A1GJ2Y24","sentAt":"2017-09-21T17:27:59.777Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-1NL18LE0BALA","sentAt":"2017-09-21T17:27:59.762Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-VYGP5VO5O6PA","sentAt":"2017-09-21T17:27:59.745Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-KFPQUFTSMMI3","sentAt":"2017-09-21T17:27:59.730Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-8WD2921EZH7C","sentAt":"2017-09-21T17:27:59.714Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-ORLXOYPZOWGE","sentAt":"2017-09-21T17:27:59.699Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-9OZBRRSBIZP2","sentAt":"2017-09-21T17:27:59.683Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-95DBVE5BXG9S","sentAt":"2017-09-21T17:27:59.668Z"}]} \ No newline at end of file diff --git a/tests/jsons/webhooks/get_no_filter.json b/tests/jsons/webhooks/get_no_filter.json new file mode 100644 index 0000000..597ea8a --- /dev/null +++ b/tests/jsons/webhooks/get_no_filter.json @@ -0,0 +1 @@ +{"webhooks":[{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-TLGHOSCM5MCH","sentAt":"2017-09-21T14:23:25.271Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-UYHV4C146TBB","sentAt":"2017-09-21T14:23:25.255Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-VNDHN9SVSKI4","sentAt":"2017-09-21T14:23:25.238Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-Y6M5S4WRSA1V","sentAt":"2017-09-21T14:23:25.222Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-F2TPZG6WZN0S","sentAt":"2017-09-21T14:23:25.204Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-3EXEWSL4YA8Z","sentAt":"2017-09-21T14:23:25.189Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-9EANR3ERQVR2","sentAt":"2017-09-21T14:23:25.172Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-IHKW3NSM6T56","sentAt":"2017-09-21T14:23:25.157Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-MWH852U5S0Y7","sentAt":"2017-09-21T14:23:25.141Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-2DD9OEGQRG16","sentAt":"2017-09-21T14:23:25.125Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-BRGCSQXDTO20","sentAt":"2017-09-21T14:23:25.109Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-E3II6BXY3XG6","sentAt":"2017-09-21T14:23:25.093Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-XJGD9QIRWSTF","sentAt":"2017-09-21T14:23:25.076Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-6A4C8Q6C0L5U","sentAt":"2017-09-21T14:23:25.037Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-I3E77D4O37RX","sentAt":"2017-09-21T14:23:25.020Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-C8D0XUYDYCQO","sentAt":"2017-09-21T14:23:24.998Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-D0W2778M9T54","sentAt":"2017-09-21T14:23:24.982Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-RXHG2021HDI6","sentAt":"2017-09-21T14:23:24.966Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-VJCR8O8UGXTV","sentAt":"2017-09-21T14:23:24.942Z"},{"resourceId":"ORD-1ZIMX7O2AC47","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-406BHBROHVIO","sentAt":"2017-09-21T14:23:24.927Z"}]} \ No newline at end of file diff --git a/tests/jsons/webhooks/get_pagination.json b/tests/jsons/webhooks/get_pagination.json new file mode 100644 index 0000000..367df95 --- /dev/null +++ b/tests/jsons/webhooks/get_pagination.json @@ -0,0 +1 @@ +{"webhooks":[{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-FJJNMGUG1E35","sentAt":"2017-09-21T17:27:59.003Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-45KZKR11Y0X6","sentAt":"2017-09-21T17:27:59.002Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-P0TZGY02KJFZ","sentAt":"2017-09-21T17:27:58.987Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-AWVLT3QT3PUW","sentAt":"2017-09-21T17:27:58.983Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-PKWALAI2F8LL","sentAt":"2017-09-21T17:27:58.973Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-UP6T7W8K6NYR","sentAt":"2017-09-21T17:27:58.967Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-WK60Z62M05HF","sentAt":"2017-09-21T17:27:58.959Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-FCHXOMQ3OJXC","sentAt":"2017-09-21T17:27:58.950Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-HX9TUZVEAVUP","sentAt":"2017-09-21T17:27:58.944Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-EVJ1K2KAAD4M","sentAt":"2017-09-21T17:27:58.935Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-N606YPQ4KPFV","sentAt":"2017-09-21T17:27:58.930Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-XPH5YYTIW8UX","sentAt":"2017-09-21T17:27:58.919Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-KTUCF4RKNA1V","sentAt":"2017-09-21T17:27:58.914Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-05LZOC443I3K","sentAt":"2017-09-21T17:27:58.903Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-EQPZ26LWW47H","sentAt":"2017-09-21T17:27:58.900Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-YHG93DZTHJV3","sentAt":"2017-09-21T17:27:58.886Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-2UT85BL18HIG","sentAt":"2017-09-21T17:27:58.884Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-AD3JD5EIJ82N","sentAt":"2017-09-21T17:27:58.871Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-N0T56Z7V3WIR","sentAt":"2017-09-21T17:27:58.870Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-IKT4LVUVDRGU","sentAt":"2017-09-21T17:27:58.855Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-9AAMLJAJ9KDQ","sentAt":"2017-09-21T17:27:58.853Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-JVSKAPG1QM44","sentAt":"2017-09-21T17:27:58.839Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-2SZ3RFK1EIAS","sentAt":"2017-09-21T17:27:58.838Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-6X9KXCWK972W","sentAt":"2017-09-21T17:27:58.824Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-VZIC5MQKD2FT","sentAt":"2017-09-21T17:27:58.822Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-5Q6YJQ8BIYGW","sentAt":"2017-09-21T17:27:58.810Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-4L62R3FXBAMT","sentAt":"2017-09-21T17:27:58.806Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-6VA1GBM3G4JL","sentAt":"2017-09-21T17:27:58.795Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-MBLDR4L1L385","sentAt":"2017-09-21T17:27:58.790Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-VJ8AEISF37KW","sentAt":"2017-09-21T17:27:58.780Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-OG1K6JEZ7FY5","sentAt":"2017-09-21T17:27:58.773Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-1VO1DZ29F4JS","sentAt":"2017-09-21T17:27:58.765Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-BX2FWOZ3DR53","sentAt":"2017-09-21T17:27:58.757Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-QG9K64VUYMSQ","sentAt":"2017-09-21T17:27:58.751Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-36TOFZ2NQTKX","sentAt":"2017-09-21T17:27:58.739Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-3SI7MT5EUZV1","sentAt":"2017-09-21T17:27:58.736Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-NDJ1SY2LJNDZ","sentAt":"2017-09-21T17:27:58.722Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-FK97M26DAL3G","sentAt":"2017-09-21T17:27:58.721Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-MEP8VM6OI9B6","sentAt":"2017-09-21T17:27:58.706Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-ZE7MKEYAXNG6","sentAt":"2017-09-21T17:27:58.702Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-AROP17GFYK40","sentAt":"2017-09-21T17:27:58.691Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-09XC7Z0ADOL2","sentAt":"2017-09-21T17:27:58.686Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-DC2JQEB4IXFE","sentAt":"2017-09-21T17:27:58.675Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-02FCN6CVINSJ","sentAt":"2017-09-21T17:27:58.668Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-P629HBLWYKCX","sentAt":"2017-09-21T17:27:58.656Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-48ID6IDLD58G","sentAt":"2017-09-21T17:27:58.652Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-O97OJ7H1K8OG","sentAt":"2017-09-21T17:27:58.641Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-HOZ6Z6TMY84E","sentAt":"2017-09-21T17:27:58.636Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-PJETY5CGRTFA","sentAt":"2017-09-21T17:27:58.627Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-XSJ0457ZIZ2T","sentAt":"2017-09-21T17:27:58.620Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-F8MDV4B85R4U","sentAt":"2017-09-21T17:27:58.611Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-TDTMOXLVOPI7","sentAt":"2017-09-21T17:27:58.603Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-6JLPHOUO8FPJ","sentAt":"2017-09-21T17:27:58.597Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-9NWGPNATYNY1","sentAt":"2017-09-21T17:27:58.587Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-GUDG43LI7482","sentAt":"2017-09-21T17:27:58.580Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-5EIUPHNAAEYQ","sentAt":"2017-09-21T17:27:58.570Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-DW221SN70OTZ","sentAt":"2017-09-21T17:27:58.566Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-3JSTO2MIMJM1","sentAt":"2017-09-21T17:27:58.554Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-LK7BKSHKJKPM","sentAt":"2017-09-21T17:27:58.551Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-WJFH9OBQOK4V","sentAt":"2017-09-21T17:27:58.537Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-5QGZSF48XP0D","sentAt":"2017-09-21T17:27:58.535Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-SXRKQEB0JXZ0","sentAt":"2017-09-21T17:27:58.521Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-1S6YA145E2O0","sentAt":"2017-09-21T17:27:58.520Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-CXZZM5E8KNL1","sentAt":"2017-09-21T17:27:58.520Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-6J0CHGVCBE4J","sentAt":"2017-09-21T17:27:58.503Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-QG8I3JZDFEBS","sentAt":"2017-09-21T17:27:58.502Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-IIPTGDMYYFNQ","sentAt":"2017-09-21T17:27:58.501Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-ONO1E4A8QZ3Q","sentAt":"2017-09-21T17:27:58.488Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-62FC21BHQAH9","sentAt":"2017-09-21T17:27:58.485Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-S9C2JHI6WIKD","sentAt":"2017-09-21T17:27:58.484Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-2Q7L6L5BOFJX","sentAt":"2017-09-21T17:27:58.472Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-NB4S7R6PTLPI","sentAt":"2017-09-21T17:27:58.464Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-J8RBGRJQIR6O","sentAt":"2017-09-21T17:27:58.464Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-L729FNI1RNZ0","sentAt":"2017-09-21T17:27:58.458Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-4RHMJUFXSBLA","sentAt":"2017-09-21T17:27:58.448Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-57P7INJWS1JB","sentAt":"2017-09-21T17:27:58.447Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-O506OMJCBNLD","sentAt":"2017-09-21T17:27:58.443Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-M3X62Q867RZ5","sentAt":"2017-09-21T17:27:58.431Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-1XCGNQ467KWA","sentAt":"2017-09-21T17:27:58.430Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-OVC6OTVHXBRS","sentAt":"2017-09-21T17:27:58.428Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-YMJ929ASA9T6","sentAt":"2017-09-21T17:27:58.414Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-YSNS6S63D0T2","sentAt":"2017-09-21T17:27:58.413Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-RPYP7MHDQSIO","sentAt":"2017-09-21T17:27:58.412Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-UWNORURHRVL7","sentAt":"2017-09-21T17:27:58.399Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-X7JLSSYT575L","sentAt":"2017-09-21T17:27:58.398Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-WM955O88MM9B","sentAt":"2017-09-21T17:27:58.397Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-VY2STQ62KPBA","sentAt":"2017-09-21T17:27:58.382Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-W0M4WKAHAW4L","sentAt":"2017-09-21T17:27:58.381Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-2JV2EY00PWGD","sentAt":"2017-09-21T17:27:58.378Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-KWBMCGOSXF0V","sentAt":"2017-09-21T17:27:58.367Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-9NWPLJP0X7U3","sentAt":"2017-09-21T17:27:58.366Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-ZPSEUZYN2MP3","sentAt":"2017-09-21T17:27:58.360Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-PDMVFPFRC4VP","sentAt":"2017-09-21T17:27:58.352Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-ZFAIL61G9T45","sentAt":"2017-09-21T17:27:58.351Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-A28T0AFAK19R","sentAt":"2017-09-21T17:27:58.342Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-J6SYLOOWWYL1","sentAt":"2017-09-21T17:27:58.337Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-R2X9IG1LZD0N","sentAt":"2017-09-21T17:27:58.335Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.PAID","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-KYT21Z69T6BT","sentAt":"2017-09-21T17:27:58.325Z"},{"resourceId":"PAY-DXBCZGSZ6UPR","event":"PAYMENT.AUTHORIZED","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-GNAPVTBZ9UOW","sentAt":"2017-09-21T17:27:58.322Z"},{"resourceId":"ORD-EE5XP23RMLSS","event":"ORDER.WAITING","url":"http://requestb.in/1dhjesw1","status":"CREATED","id":"EVE-EOWWQWGAOXX0","sentAt":"2017-09-21T17:27:58.319Z"}]} \ No newline at end of file From 1f2dceeb584ad9b71d20696c12cb98d727833b00 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Thu, 21 Sep 2017 16:33:42 -0300 Subject: [PATCH 11/22] style: Removing white-spaces --- src/Moip.php | 8 +-- src/Resource/MoipResource.php | 3 +- src/Resource/Webhook.php | 111 ++++++++++++++++++----------- src/Resource/WebhookList.php | 38 +++++----- tests/Resource/WebhookListTest.php | 2 +- 5 files changed, 94 insertions(+), 68 deletions(-) diff --git a/src/Moip.php b/src/Moip.php index 8a60816..b969384 100644 --- a/src/Moip.php +++ b/src/Moip.php @@ -208,10 +208,10 @@ public function notifications() * * @return WebhookList */ - public function webhooks() - { - return new WebhookList($this); - } + public function webhooks() + { + return new WebhookList($this); + } /** * Get the endpoint. diff --git a/src/Resource/MoipResource.php b/src/Resource/MoipResource.php index ced05e2..4fd9b7c 100644 --- a/src/Resource/MoipResource.php +++ b/src/Resource/MoipResource.php @@ -199,8 +199,7 @@ public function generateListPath(Pagination $pagination = null, Filters $filters $queryParams = array_merge($queryParams, $otherParams); } - if (!empty($queryParams)) - { + if (!empty($queryParams)) { return sprintf('/%s/%s?%s', self::VERSION, static::PATH, http_build_query($queryParams)); } diff --git a/src/Resource/Webhook.php b/src/Resource/Webhook.php index f7c6d1f..48c299f 100644 --- a/src/Resource/Webhook.php +++ b/src/Resource/Webhook.php @@ -6,53 +6,82 @@ class Webhook extends MoipResource { + /** + * Initialize a new instance. + */ + public function initialize() + { + $this->data = new stdClass(); + } + /** * Get webhook id. * * @return string The webhook id. */ - public function getId() - { - return $this->getIfSet('id'); - } + public function getId() + { + return $this->getIfSet('id'); + } - /** - * Get resource id. - * - * @return string The webhook id. - */ - public function getResourceId() - { - return $this->getIfSet('resourceId'); - } + /** + * Get resource id. + * + * @return string The webhook id. + */ + public function getResourceId() + { + return $this->getIfSet('resourceId'); + } - /** - * Get event. - * - * @return string event. - */ - public function getEvent() - { - return $this->getIfSet('event'); - } + /** + * Get event. + * + * @return string event. + */ + public function getEvent() + { + return $this->getIfSet('event'); + } - /** - * Get url. - * - * @return string url. - */ - public function getUrl() - { - return $this->getIfSet('url'); - } + /** + * Get url. + * + * @return string url. + */ + public function getUrl() + { + return $this->getIfSet('url'); + } - /** - * Get webhook status. - * - * @return string webhook status. - */ - public function getStatus() - { - return $this->getIfSet('status'); - } -} \ No newline at end of file + /** + * Get webhook status. + * + * @return string webhook status. + */ + public function getStatus() + { + return $this->getIfSet('status'); + } + + /** + * Mount structure of Webhook. + * + * @param \stdClass $response + * + * @return \Moip\Resource\Webhook Webhook + */ + protected function populate(stdClass $response) + { + $webhook = clone $this; + $webhook->data = new stdClass(); + + $webhook->data->id = $response->id; + $webhook->data->event = $response->event; + $webhook->data->url = $response->url; + $webhook->data->resourceId = $response->resourceId; + $webhook->data->status = $response->status; + + return $webhook; + } +} diff --git a/src/Resource/WebhookList.php b/src/Resource/WebhookList.php index 42edd26..7665569 100644 --- a/src/Resource/WebhookList.php +++ b/src/Resource/WebhookList.php @@ -15,26 +15,26 @@ class WebhookList extends MoipResource * * @const string */ - const PATH = 'webhooks'; + const PATH = 'webhooks'; /** * Initialize a new instance. */ public function initialize() { - $this->data = new stdClass(); + $this->data = new stdClass(); $this->data->webhooks = []; - } + } /** * Get webhooks. * * @return array */ - public function getWebhooks() - { - return $this->getIfSet('webhooks'); - } + public function getWebhooks() + { + return $this->getIfSet('webhooks'); + } /** * Get a webhook. @@ -49,13 +49,11 @@ public function get(Pagination $pagination = null, $resource_id = null, $event = { $params = []; - if (!is_null($resource_id)) - { + if (!is_null($resource_id)) { $params['resourceId'] = $resource_id; } - if (!is_null($event)) - { + if (!is_null($event)) { $params['event'] = $event; } @@ -63,19 +61,19 @@ public function get(Pagination $pagination = null, $resource_id = null, $event = } /** - * Mount the seller structure from account. + * Mount structure of Webhook List. * * @param \stdClass $response * - * @return \Moip\Resource\Webhook Webhook List + * @return \Moip\Resource\WebhookList Webhook List */ - protected function populate(stdClass $response) - { - $webhookList = clone $this; - $webhookList->data = new stdClass(); + protected function populate(stdClass $response) + { + $webhookList = clone $this; + $webhookList->data = new stdClass(); - $webhookList->data->webhooks = $response->webhooks; + $webhookList->data->webhooks = $response->webhooks; - return $webhookList; - } + return $webhookList; + } } diff --git a/tests/Resource/WebhookListTest.php b/tests/Resource/WebhookListTest.php index 60d6d36..60dfcb8 100644 --- a/tests/Resource/WebhookListTest.php +++ b/tests/Resource/WebhookListTest.php @@ -30,4 +30,4 @@ public function testGetWebhookParams() $this->assertNotEmpty($webhooks->getWebhooks()); } -} \ No newline at end of file +} From c3ba2d0b152cd7fb2fd9a382126b75107397fc78 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Thu, 21 Sep 2017 16:37:56 -0300 Subject: [PATCH 12/22] style: Fixing style --- src/Resource/Webhook.php | 12 ++++++------ src/Resource/WebhookList.php | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Resource/Webhook.php b/src/Resource/Webhook.php index 48c299f..94dfe87 100644 --- a/src/Resource/Webhook.php +++ b/src/Resource/Webhook.php @@ -23,7 +23,7 @@ public function getId() { return $this->getIfSet('id'); } - + /** * Get resource id. * @@ -33,7 +33,7 @@ public function getResourceId() { return $this->getIfSet('resourceId'); } - + /** * Get event. * @@ -43,7 +43,7 @@ public function getEvent() { return $this->getIfSet('event'); } - + /** * Get url. * @@ -53,7 +53,7 @@ public function getUrl() { return $this->getIfSet('url'); } - + /** * Get webhook status. * @@ -75,13 +75,13 @@ protected function populate(stdClass $response) { $webhook = clone $this; $webhook->data = new stdClass(); - + $webhook->data->id = $response->id; $webhook->data->event = $response->event; $webhook->data->url = $response->url; $webhook->data->resourceId = $response->resourceId; $webhook->data->status = $response->status; - + return $webhook; } } diff --git a/src/Resource/WebhookList.php b/src/Resource/WebhookList.php index 7665569..50b61bc 100644 --- a/src/Resource/WebhookList.php +++ b/src/Resource/WebhookList.php @@ -40,8 +40,8 @@ public function getWebhooks() * Get a webhook. * * @param Pagination $pagination - * @param string $resource_id - * @param string $event + * @param string $resource_id + * @param string $event * * @return stdClass */ @@ -71,9 +71,9 @@ protected function populate(stdClass $response) { $webhookList = clone $this; $webhookList->data = new stdClass(); - + $webhookList->data->webhooks = $response->webhooks; - + return $webhookList; } } From 9f5c21e70ae308dc05575cbd41838e1974b323b0 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Thu, 21 Sep 2017 16:46:00 -0300 Subject: [PATCH 13/22] docs: Update readme Update readme --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b560bcb..ebbd10f 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,8 @@ - [Criação](#criação) - [Consulta](#consulta-3) - [Verifica se usuário já possui Conta Moip](#verifica-se-usuário-já-possui-conta-moip) - - [Webhooks](#webhooks) + - [Webhooks](#webhooks) + - [Consulta](#consulta-4) - [Packages](#packages) - [Documentação](#documentação) - [Testes](#testes) @@ -462,6 +463,18 @@ $json = file_get_contents('php://input'); $response = json_decode($json, true); ``` +### Consulta + +#### Sem paginação ou filtro por resource/evento +```php +$moip->webhooks()->get(); +``` + +#### Com paginação e filtros por resource/evento +```php +$moip->webhooks()->get(new Pagination(10, 0), 'ORD-ID', 'ORDER.PAID'); +``` + ## Documentação [Documentação oficial](https://documentao-moip.readme.io/v2.0/reference) From e8483507901f91ce49748a839f6d06479c36c016 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Fri, 22 Sep 2017 16:02:40 -0300 Subject: [PATCH 14/22] refactor: Trigger a notice if a string is passed as an argument to function generateListPath Trigger a notice if a string is passed as an argument to function generateListPath --- src/Resource/MoipResource.php | 12 ++++++++---- src/Resource/OrdersList.php | 2 +- tests/Resource/OrdersListTest.php | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Resource/MoipResource.php b/src/Resource/MoipResource.php index 4fd9b7c..6450ffa 100644 --- a/src/Resource/MoipResource.php +++ b/src/Resource/MoipResource.php @@ -173,12 +173,16 @@ public function generatePath($action, $id = null) * * @param Pagination $pagination * @param Filters $filters - * @param string $qParam Query a specific value. + * @param array $params * * @return string */ - public function generateListPath(Pagination $pagination = null, Filters $filters = null, $otherParams = []) + public function generateListPath(Pagination $pagination = null, Filters $filters = null, $params = []) { + if (is_string($params)) { + trigger_error("The method generateListPath(Pagination, Filters, string) is deprecated, use generateListPath(Pagination, Filters, array) instead. The method will become private in the next release.", E_USER_NOTICE); + } + $queryParams = []; if (!is_null($pagination)) { @@ -195,8 +199,8 @@ public function generateListPath(Pagination $pagination = null, Filters $filters $queryParams['filters'] = $filters->__toString(); } - if (!empty($otherParams)) { - $queryParams = array_merge($queryParams, $otherParams); + if (!empty($params)) { + $queryParams = array_merge($queryParams, $params); } if (!empty($queryParams)) { diff --git a/src/Resource/OrdersList.php b/src/Resource/OrdersList.php index c1bf8cb..1d225f0 100644 --- a/src/Resource/OrdersList.php +++ b/src/Resource/OrdersList.php @@ -60,7 +60,7 @@ public function getOrders() */ public function get(Pagination $pagination = null, Filters $filters = null, $qParam = '') { - return $this->getByPath($this->generateListPath($pagination, $filters, $qParam)); + return $this->getByPath($this->generateListPath($pagination, $filters, ['q' => $qParam])); } protected function populate(stdClass $response) diff --git a/tests/Resource/OrdersListTest.php b/tests/Resource/OrdersListTest.php index bd67b31..78a2c47 100644 --- a/tests/Resource/OrdersListTest.php +++ b/tests/Resource/OrdersListTest.php @@ -15,7 +15,7 @@ public function testShouldGetOrderListNoFilter() $filter = new Filters(); $filter->between('value', 1000, 10000); - $orders = $this->moip->orders()->getList(new Pagination(10, 0), $filter, ['q' => 'jose']); + $orders = $this->moip->orders()->getList(new Pagination(10, 0), $filter, 'jose'); $this->assertNotNull($orders->getOrders()); } From ede32c82bb3cea80140e6c034772c902123f31c2 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Fri, 22 Sep 2017 16:05:03 -0300 Subject: [PATCH 15/22] style(MoipResource): Change double to single quotation marks Change double to single quotation marks --- src/Resource/MoipResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resource/MoipResource.php b/src/Resource/MoipResource.php index 6450ffa..92c67f4 100644 --- a/src/Resource/MoipResource.php +++ b/src/Resource/MoipResource.php @@ -180,7 +180,7 @@ public function generatePath($action, $id = null) public function generateListPath(Pagination $pagination = null, Filters $filters = null, $params = []) { if (is_string($params)) { - trigger_error("The method generateListPath(Pagination, Filters, string) is deprecated, use generateListPath(Pagination, Filters, array) instead. The method will become private in the next release.", E_USER_NOTICE); + trigger_error('The method generateListPath(Pagination, Filters, string) is deprecated, use generateListPath(Pagination, Filters, array) instead. The method will become private in the next release.', E_USER_NOTICE); } $queryParams = []; From 073ca9ef5acee3786d1b832250844863b21dd054 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Mon, 25 Sep 2017 08:45:21 -0300 Subject: [PATCH 16/22] refactor(MoipResource): Remove warning to deprecated function Remove warning to deprecated function --- src/Resource/MoipResource.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Resource/MoipResource.php b/src/Resource/MoipResource.php index 92c67f4..f6def8c 100644 --- a/src/Resource/MoipResource.php +++ b/src/Resource/MoipResource.php @@ -179,10 +179,6 @@ public function generatePath($action, $id = null) */ public function generateListPath(Pagination $pagination = null, Filters $filters = null, $params = []) { - if (is_string($params)) { - trigger_error('The method generateListPath(Pagination, Filters, string) is deprecated, use generateListPath(Pagination, Filters, array) instead. The method will become private in the next release.', E_USER_NOTICE); - } - $queryParams = []; if (!is_null($pagination)) { From ee71176b649a9980ca62ea611b25deb48adad433 Mon Sep 17 00:00:00 2001 From: Bruno Date: Thu, 28 Sep 2017 12:13:21 -0300 Subject: [PATCH 17/22] =?UTF-8?q?Fun=C3=A7=C3=A3o=20getToken()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O token é essencial para validar a comunicação moip recebida na url de preference. --- src/Resource/NotificationPreferences.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Resource/NotificationPreferences.php b/src/Resource/NotificationPreferences.php index c2c834e..4156891 100644 --- a/src/Resource/NotificationPreferences.php +++ b/src/Resource/NotificationPreferences.php @@ -81,6 +81,16 @@ public function getId() return $this->data->id; } + /** + * Returns notification token. + * + * @return stdClass + */ + public function getToken() + { + return $this->data->token; + } + /** * Create a new notification preference. * From 4d10889cde765e592a5041351614c587d87d8189 Mon Sep 17 00:00:00 2001 From: Bruno Date: Thu, 28 Sep 2017 12:17:27 -0300 Subject: [PATCH 18/22] Obeter token do webhooks cadastrado --- src/Resource/Preference.php | 156 ++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 src/Resource/Preference.php diff --git a/src/Resource/Preference.php b/src/Resource/Preference.php new file mode 100644 index 0000000..deaa5a2 --- /dev/null +++ b/src/Resource/Preference.php @@ -0,0 +1,156 @@ +_moipHelper = $moipHelper; + $this->_configInterface = $configInterface; + $this->_resourceConfig = $resourceConfig; + $this->_storeManager = $storeManager; + parent::__construct($context); + } + + protected function _isAllowed() + { + return $this->_authorization->isAllowed('Moip_Transparentev2::preference'); + } + + public function execute() + { + $params = $this->getRequest()->getParams(); + $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); + + $moip = $this->_moipHelper->AuthorizationValidate(); + + + $url_refund = $this->urlNoticationRefunded($moip); + $this->setUrlInfoRefund($url_refund); + + $url_cancel = $this->urlNoticationCancel($moip); + $this->setUrlInfoCancel($url_cancel); + + $url_capture = $this->urlNoticationCapture($moip); + $this->setUrlInfoCapture($url_capture); + $authorize = "success"; + + $this->messageManager->addSuccess(__('Seu módulo está autorizado. =)')); + $resultRedirect->setUrl($this->getUrlConfig()); + return $resultRedirect; + } + + public function getUrlConfig() + { + return $this->getUrl('adminhtml/system_config/edit/section/payment/'); + } + + public function setUrlInfoRefund($url_refund){ + + $_environment = $this->_moipHelper->getEnvironmentMode(); + $this->_resourceConfig->saveConfig( + 'payment/moipbase/refund_id_'.$_environment, + $url_refund->getId(), + 'default', + 0 + ); + $this->_resourceConfig->saveConfig( + 'payment/moipbase/refund_token_'.$_environment, + $url_refund->getToken(), + 'default', + 0 + ); + return $this; + } + + public function setUrlInfoCancel($url_cancel){ + + $_environment = $this->_moipHelper->getEnvironmentMode(); + $this->_resourceConfig->saveConfig( + 'payment/moipbase/cancel_id_'.$_environment, + $url_cancel->getId(), + 'default', + 0 + ); + $this->_resourceConfig->saveConfig( + 'payment/moipbase/cancel_token_'.$_environment, + $url_cancel->getToken(), + 'default', + 0 + ); + return $this; + } + + public function setUrlInfoCapture($url_capture){ + + $_environment = $this->_moipHelper->getEnvironmentMode(); + $this->_resourceConfig->saveConfig( + 'payment/moipbase/capture_id_'.$_environment, + $url_capture->getId(), + 'default', + 0 + ); + $this->_resourceConfig->saveConfig( + 'payment/moipbase/capture_token_'.$_environment, + $url_capture->getToken(), + 'default', + 0 + ); + return $this; + } + + + + public function urlNoticationRefunded($moip){ + + $domainName = $this->_storeManager->getStore()->getBaseUrl(); + + $webhooks = $moip->notifications() + ->addEvent('PAYMENT.REFUNDED') + ->setTarget($domainName.'/moip/notification/Refund') + ->create(); + return $webhooks; + } + + public function urlNoticationCancel($moip){ + + $domainName = $this->_storeManager->getStore()->getBaseUrl(); + + $webhooks = $moip->notifications() + ->addEvent('PAYMENT.CANCELLED') + ->setTarget($domainName.'/moip/notification/Cancel') + ->create(); + return $webhooks; + } + + public function urlNoticationCapture($moip){ + + $domainName = $this->_storeManager->getStore()->getBaseUrl(); + + $webhooks = $moip->notifications() + ->addEvent('PAYMENT.AUTHORIZED') + ->setTarget($domainName.'/moip/notification/Capture') + ->create(); + return $webhooks; + } + +} +?> \ No newline at end of file From 8ea223f70b1bebd06c6cb0996182a7263f51cb74 Mon Sep 17 00:00:00 2001 From: Bruno Date: Thu, 28 Sep 2017 12:19:17 -0300 Subject: [PATCH 19/22] Obter token do webhooks cadastrado --- src/Resource/Preference.php | 156 ------------------------------------ 1 file changed, 156 deletions(-) delete mode 100644 src/Resource/Preference.php diff --git a/src/Resource/Preference.php b/src/Resource/Preference.php deleted file mode 100644 index deaa5a2..0000000 --- a/src/Resource/Preference.php +++ /dev/null @@ -1,156 +0,0 @@ -_moipHelper = $moipHelper; - $this->_configInterface = $configInterface; - $this->_resourceConfig = $resourceConfig; - $this->_storeManager = $storeManager; - parent::__construct($context); - } - - protected function _isAllowed() - { - return $this->_authorization->isAllowed('Moip_Transparentev2::preference'); - } - - public function execute() - { - $params = $this->getRequest()->getParams(); - $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - - $moip = $this->_moipHelper->AuthorizationValidate(); - - - $url_refund = $this->urlNoticationRefunded($moip); - $this->setUrlInfoRefund($url_refund); - - $url_cancel = $this->urlNoticationCancel($moip); - $this->setUrlInfoCancel($url_cancel); - - $url_capture = $this->urlNoticationCapture($moip); - $this->setUrlInfoCapture($url_capture); - $authorize = "success"; - - $this->messageManager->addSuccess(__('Seu módulo está autorizado. =)')); - $resultRedirect->setUrl($this->getUrlConfig()); - return $resultRedirect; - } - - public function getUrlConfig() - { - return $this->getUrl('adminhtml/system_config/edit/section/payment/'); - } - - public function setUrlInfoRefund($url_refund){ - - $_environment = $this->_moipHelper->getEnvironmentMode(); - $this->_resourceConfig->saveConfig( - 'payment/moipbase/refund_id_'.$_environment, - $url_refund->getId(), - 'default', - 0 - ); - $this->_resourceConfig->saveConfig( - 'payment/moipbase/refund_token_'.$_environment, - $url_refund->getToken(), - 'default', - 0 - ); - return $this; - } - - public function setUrlInfoCancel($url_cancel){ - - $_environment = $this->_moipHelper->getEnvironmentMode(); - $this->_resourceConfig->saveConfig( - 'payment/moipbase/cancel_id_'.$_environment, - $url_cancel->getId(), - 'default', - 0 - ); - $this->_resourceConfig->saveConfig( - 'payment/moipbase/cancel_token_'.$_environment, - $url_cancel->getToken(), - 'default', - 0 - ); - return $this; - } - - public function setUrlInfoCapture($url_capture){ - - $_environment = $this->_moipHelper->getEnvironmentMode(); - $this->_resourceConfig->saveConfig( - 'payment/moipbase/capture_id_'.$_environment, - $url_capture->getId(), - 'default', - 0 - ); - $this->_resourceConfig->saveConfig( - 'payment/moipbase/capture_token_'.$_environment, - $url_capture->getToken(), - 'default', - 0 - ); - return $this; - } - - - - public function urlNoticationRefunded($moip){ - - $domainName = $this->_storeManager->getStore()->getBaseUrl(); - - $webhooks = $moip->notifications() - ->addEvent('PAYMENT.REFUNDED') - ->setTarget($domainName.'/moip/notification/Refund') - ->create(); - return $webhooks; - } - - public function urlNoticationCancel($moip){ - - $domainName = $this->_storeManager->getStore()->getBaseUrl(); - - $webhooks = $moip->notifications() - ->addEvent('PAYMENT.CANCELLED') - ->setTarget($domainName.'/moip/notification/Cancel') - ->create(); - return $webhooks; - } - - public function urlNoticationCapture($moip){ - - $domainName = $this->_storeManager->getStore()->getBaseUrl(); - - $webhooks = $moip->notifications() - ->addEvent('PAYMENT.AUTHORIZED') - ->setTarget($domainName.'/moip/notification/Capture') - ->create(); - return $webhooks; - } - -} -?> \ No newline at end of file From d72f16c7af2ac7d2ee07fa69c95c049deb4101a5 Mon Sep 17 00:00:00 2001 From: Bruno Date: Thu, 28 Sep 2017 12:19:46 -0300 Subject: [PATCH 20/22] Obter token cadastrado --- src/Resource/NotificationPreferences.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Resource/NotificationPreferences.php b/src/Resource/NotificationPreferences.php index 4156891..dc7e5cb 100644 --- a/src/Resource/NotificationPreferences.php +++ b/src/Resource/NotificationPreferences.php @@ -82,10 +82,10 @@ public function getId() } /** - * Returns notification token. - * - * @return stdClass - */ + * Returns notification token. + * + * @return stdClass + */ public function getToken() { return $this->data->token; From 7b49b5342f719b8a89e5451804b472f2c970deac Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Fri, 29 Sep 2017 16:07:40 -0300 Subject: [PATCH 21/22] chore: Release v1.4.0 Release v1.4.0 --- CHANGELOG.md | 8 ++++++++ composer.json | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a41fbb6..ec8cbe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +### [1.4.0](https://github.com/moip/moip-sdk-php/compare/v1.3.2...v1.4.0) (2017-09-29) + +### Features + +* **Account:** Create method to check if an account exists ([17e6cd2](https://github.com/moip/moip-sdk-php/commit/17e6cd2)) +* added methods to get boleto print link and token from webhook([ab158a6](https://github.com/moip/moip-sdk-php/commit/ab158a6746cc75138111353301c5c066af8b962e)) + ### [1.3.2](https://github.com/moip/moip-sdk-php/compare/v1.3.0...v1.3.2) (2017-09-18) diff --git a/composer.json b/composer.json index 01e36f5..7f920c3 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,14 @@ { "name": "Joao Batista Neto", "email": "neto.joaobatista@gmail.com" + }, + { + "name": "Caio Gaspar", + "email": "caio.gaspar@moip.com.br" + }, + { + "name": "João Lucas Lucchetta", + "email": "joao.lucchetta@moip.com.br" } ], "require": { From 32efdae0783b0a5e2396b9ce2bdf3ae846d8f046 Mon Sep 17 00:00:00 2001 From: Caio Gaspar Date: Fri, 29 Sep 2017 16:23:25 -0300 Subject: [PATCH 22/22] docs: Update CHANGELOG to v2.0.0 Update CHANGELOG to v2.0.0 --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec8cbe8..985a3eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -### [1.4.0](https://github.com/moip/moip-sdk-php/compare/v1.3.2...v1.4.0) (2017-09-29) + +### [2.0.0](https://github.com/moip/moip-sdk-php/compare/v1.3.2...v2.0.0) (2017-09-29) ### Features * **Account:** Create method to check if an account exists ([17e6cd2](https://github.com/moip/moip-sdk-php/commit/17e6cd2)) +* **Webhooks:** Create method to get a list of webhooks([fa4a7d4](https://github.com/moip/moip-sdk-php/commit/fa4a7d49c2650813592a1f764be51e336247a9f5)) * added methods to get boleto print link and token from webhook([ab158a6](https://github.com/moip/moip-sdk-php/commit/ab158a6746cc75138111353301c5c066af8b962e)) +## BREAKING CHANGES +Method `generateListPath` from MoipResource changed last parameter to array instead string. + ### [1.3.2](https://github.com/moip/moip-sdk-php/compare/v1.3.0...v1.3.2) (2017-09-18)