Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Atualização da lib rmccue #334

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .coveralls.yml
100755 → 100644
Empty file.
6 changes: 1 addition & 5 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
composer.lock
vendor
.idea/
.DS_Store

### VisualStudioCode ###
.vscode/

.DS_Store
Empty file modified .travis.yml
100755 → 100644
Empty file.
Empty file modified CHANGELOG.md
100755 → 100644
Empty file.
Empty file modified CONTRIBUTING.md
100755 → 100644
Empty file.
Empty file modified LICENSE
100755 → 100644
Empty file.
25 changes: 4 additions & 21 deletions README.en.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
- [Transfers](#transfers)
- [Create a Transfer](#create-a-transfer)
- [Transfer to a Bank Account](#transfer-to-a-bank-account)
- [Transfer to a Moip Account](#transfer-to-a-moip-account)
- [Get Transfer](#get-transfer)
- [List Transfers](#list-transfers)
- [List Transfers without pagination](#list-transfers-without-pagination)
Expand Down Expand Up @@ -372,7 +371,7 @@ $payment = $order->payments()
->setCreditCardHash($hash, $holder)
->setInstallmentCount(3)
->setStatementDescriptor("Minha Loja")
->setDelayCapture(true)
->setDelayCapture()
->execute();
```

Expand Down Expand Up @@ -777,31 +776,15 @@ $holderName = 'Nome do Portador';
$taxDocument = '22222222222';

$transfer = $moip->transfers()
->setAmount($amount)
->transferToBankAccount($bank_number, $agency_number, $agency_check_number, $account_number, $account_check_number)
->setHolder($holder_name, $tax_document, $tax_document_pf)
->setTransfers($amount, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber)
->setHolder($holderName, $taxDocument)
->execute();
```

To transfer using a previously created bank account:
```php
$amount = 500;
$id = 'BKA-HUGBGX2QT9JY';

$transfer = $moip->transfers()
->setAmount($amount)
->transferWithBankAccountId($id)
->execute();
```

#### Transfer to a Moip Account
```php
$amount = 1000;
$id = 'MPA-5E1C4C369E8C';

$transfer = $moip->transfers()
->setAmount($amount)
->transferToMoipAccount($id)
->setTransfersToBankAccount($amount, $bankAccountId)
->execute();
```

Expand Down
4 changes: 1 addition & 3 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ $order = $moip->orders()->setOwnId(uniqid())
->addItem("bicicleta 9",1, "sku9", 18000)
->addItem("bicicleta 10",1, "sku10", 19000)
->setShippingAmount(3000)->setAddition(1000)->setDiscount(5000)
->setUrlSuccess('https://sualoja.com.br/url-confirmacao-de-pagamento')
->setUrlFailure('https://sualoja.com.br/url-falha-no-pagamento')
->setCustomer($customer)
->create();
print_r($order);
Expand Down Expand Up @@ -790,4 +788,4 @@ vendor/bin/phpunit -c .
## Comunidade Slack [![Slack](https://user-images.githubusercontent.com/4432322/37355972-ba0e9f32-26c3-11e8-93d3-39917eb24109.png)](https://slackin-cqtchmfquq.now.sh)


Tem dúvidas? Fale com a gente no [Slack](https://slackin-cqtchmfquq.now.sh/)!
Tem dúvidas? Fale com a gente no [Slack](https://slackin-cqtchmfquq.now.sh/)!
Empty file modified circle.yml
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion composer.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
],
"require": {
"php": ">=5.5",
"rmccue/requests": ">=1.0"
"rmccue/requests": ">=1.8.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8.35 || ^5.7 || ^6.4",
Expand Down
76 changes: 76 additions & 0 deletions examples/ecommerce/simple_boleto_payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

/*
* Tip: This setup section generally goes in other files,
* and you access them in your controllers as globals,
* instead of reinstantiating them every time.
*/
require 'vendor/autoload.php';

use Moip\Auth\BasicAuth;
use Moip\Moip;

$token = 'YOUR-TOKEN';
$key = 'YOUR-KEY';
$moip = new Moip(new BasicAuth($token, $key), Moip::ENDPOINT_SANDBOX);

try {
/*
* If you want to persist your customer data and save later, now is the time to create it.
* TIP: Don't forget to generate your `ownId` or use one you already have,
* here we set using uniqid() function.
*/
$customer = $moip->customers()->setOwnId(uniqid())
->setFullname('Fulano de Tal')
->setEmail('[email protected]')
->setBirthDate('1988-12-30')
->setTaxDocument('22222222222')
->setPhone(11, 66778899)
->addAddress('BILLING',
'Rua de teste', 123,
'Bairro', 'Sao Paulo', 'SP',
'01234567', 8)
->addAddress('SHIPPING',
'Rua de teste do SHIPPING', 123,
'Bairro do SHIPPING', 'Sao Paulo', 'SP',
'01234567', 8)
->create();

// Creating an order
$order = $moip->orders()->setOwnId(uniqid())
->addItem('bicicleta 1', 1, 'sku1', 10000)
->addItem('bicicleta 2', 1, 'sku2', 11000)
->addItem('bicicleta 3', 1, 'sku3', 12000)
->addItem('bicicleta 4', 1, 'sku4', 13000)
->addItem('bicicleta 5', 1, 'sku5', 14000)
->addItem('bicicleta 6', 1, 'sku6', 15000)
->addItem('bicicleta 7', 1, 'sku7', 16000)
->addItem('bicicleta 8', 1, 'sku8', 17000)
->addItem('bicicleta 9', 1, 'sku9', 18000)
->addItem('bicicleta 10', 1, 'sku10', 19000)
->setShippingAmount(3000)->setAddition(1000)->setDiscount(5000)
->setCustomer($customer)
->create();

$logo_uri = 'https://cdn.moip.com.br/wp-content/uploads/2016/05/02163352/logo-moip.png';
$expiration_date = (new DateTime())->add(new DateInterval('P3D'));
$instruction_lines = ['INSTRUÇÃO 1', 'INSTRUÇÃO 2', 'INSTRUÇÃO 3'];

// Creating payment to order
$payment = $order->payments()
->setBoleto($expiration_date, $logo_uri, $instruction_lines)
->execute();

echo 'Order ID: '.$order->getId().'<br />';
echo 'Payment ID: '.$payment->getId().'<br />';
echo 'Created at: '.$payment->getCreatedAt()->format('Y-m-d H:i:s').'<br />';
echo 'Status: '.$payment->getStatus().'<br />';
echo 'Amount: '.$payment->getAmount()->total.'<br />';
echo 'Funding Instrument: '.$payment->getFundingInstrument()->method.'<br />';
} catch (\Moip\Exceptions\UnautorizedException $e) {
echo $e->getMessage();
} catch (\Moip\Exceptions\ValidationException $e) {
printf($e->__toString());
} catch (\Moip\Exceptions\UnexpectedException $e) {
echo $e->getMessage();
}
80 changes: 80 additions & 0 deletions examples/ecommerce/simple_creditcard_payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

/*
* Tip: This setup section generally goes in other files,
* and you access them in your controllers as globals,
* instead of reinstantiating them every time.
*/
require 'vendor/autoload.php';

use Moip\Auth\BasicAuth;
use Moip\Moip;

$token = 'YOUR-TOKEN';
$key = 'YOUR-KEY';
$moip = new Moip(new BasicAuth($token, $key), Moip::ENDPOINT_SANDBOX);

/*
* Don't forget you must generate your hash to encrypt credit card data using https://github.com/moip/moip-sdk-js
*/
$hash = 'YOUR-HASH';

try {
/*
* If you want to persist your customer data and save later, now is the time to create it.
* TIP: Don't forget to generate your `ownId` or use one you already have,
* here we set using uniqid() function.
*/
$customer = $moip->customers()->setOwnId(uniqid())
->setFullname('Fulano de Tal')
->setEmail('[email protected]')
->setBirthDate('1988-12-30')
->setTaxDocument('22222222222')
->setPhone(11, 66778899)
->addAddress('BILLING',
'Rua de teste', 123,
'Bairro', 'Sao Paulo', 'SP',
'01234567', 8)
->addAddress('SHIPPING',
'Rua de teste do SHIPPING', 123,
'Bairro do SHIPPING', 'Sao Paulo', 'SP',
'01234567', 8)
->create();

// Creating an order
$order = $moip->orders()->setOwnId(uniqid())
->addItem('bicicleta 1', 1, 'sku1', 10000)
->addItem('bicicleta 2', 1, 'sku2', 11000)
->addItem('bicicleta 3', 1, 'sku3', 12000)
->addItem('bicicleta 4', 1, 'sku4', 13000)
->addItem('bicicleta 5', 1, 'sku5', 14000)
->addItem('bicicleta 6', 1, 'sku6', 15000)
->addItem('bicicleta 7', 1, 'sku7', 16000)
->addItem('bicicleta 8', 1, 'sku8', 17000)
->addItem('bicicleta 9', 1, 'sku9', 18000)
->addItem('bicicleta 10', 1, 'sku10', 19000)
->setShippingAmount(3000)->setAddition(1000)->setDiscount(5000)
->setCustomer($customer)
->create();

// Creating payment to order
$payment = $order->payments()
->setCreditCardHash($hash, $customer)
->setInstallmentCount(3)
->setStatementDescriptor('teste de pag')
->execute();

echo 'Order ID: '.$order->getId().'<br />';
echo 'Payment ID: '.$payment->getId().'<br />';
echo 'Created at: '.$payment->getCreatedAt()->format('Y-m-d H:i:s').'<br />';
echo 'Status: '.$payment->getStatus().'<br />';
echo 'Amount: '.$payment->getAmount()->total.'<br />';
echo 'Funding Instrument: '.$payment->getFundingInstrument()->method.'<br />';
echo 'Installment Count: '.$payment->getInstallmentCount().'<br />';
} catch (\Moip\Exceptions\UnautorizedException $e) {
echo $e->getMessage();
} catch (\Moip\Exceptions\ValidationException $e) {
printf($e->__toString());
} catch (\Moip\Exceptions\UnexpectedException $e) {
echo $e->getMessage();
}
Empty file modified examples/marketplace/classical_moip_account_flow_part_1.php
100755 → 100644
Empty file.
Empty file modified examples/marketplace/classical_moip_account_flow_part_2.php
100755 → 100644
Empty file.
Empty file modified examples/marketplace/multiorder_and_multipayment.php
100755 → 100644
Empty file.
Empty file modified examples/marketplace/transparent_moip_account_flow.php
100755 → 100644
Empty file.
Empty file modified phpunit.xml
100755 → 100644
Empty file.
Empty file modified src/Auth/BasicAuth.php
100755 → 100644
Empty file.
Empty file modified src/Auth/Connect.php
100755 → 100644
Empty file.
Empty file modified src/Auth/OAuth.php
100755 → 100644
Empty file.
Empty file modified src/Contracts/Authentication.php
100755 → 100644
Empty file.
Empty file modified src/Exceptions/Error.php
100755 → 100644
Empty file.
Empty file modified src/Exceptions/InvalidArgumentException.php
100755 → 100644
Empty file.
Empty file modified src/Exceptions/UnautorizedException.php
100755 → 100644
Empty file.
Empty file modified src/Exceptions/UnexpectedException.php
100755 → 100644
Empty file.
Empty file modified src/Exceptions/ValidationException.php
100755 → 100644
Empty file.
Empty file modified src/Helper/Filters.php
100755 → 100644
Empty file.
Empty file modified src/Helper/Links.php
100755 → 100644
Empty file.
Empty file modified src/Helper/Pagination.php
100755 → 100644
Empty file.
Empty file modified src/Helper/Utils.php
100755 → 100644
Empty file.
Empty file modified src/Helper/helpers.php
100755 → 100644
Empty file.
Empty file modified src/Moip.php
100755 → 100644
Empty file.
Empty file modified src/Resource/Account.php
100755 → 100644
Empty file.
Empty file modified src/Resource/Balances.php
100755 → 100644
Empty file.
Empty file modified src/Resource/BankAccount.php
100755 → 100644
Empty file.
Empty file modified src/Resource/BankAccountList.php
100755 → 100644
Empty file.
11 changes: 0 additions & 11 deletions src/Resource/Customer.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,6 @@ public function getTaxDocumentNumber()
return $this->getIfSet('number', $this->data->taxDocument);
}

/**
* Get funding instruments from customer.
*
* @return array FundingInstruments.
*/
public function getFundingInstruments()
{
return $this->getIfSet('fundingInstruments');
}

/**
* Mount the buyer structure from customer.
*
Expand Down Expand Up @@ -274,7 +264,6 @@ protected function populate(stdClass $response)
$customer->data->shippingAddress = $this->getIfSet('shippingAddress', $response);
$customer->data->billingAddress = $this->getIfSet('billingAddress', $response);
$customer->data->fundingInstrument = $this->getIfSet('fundingInstrument', $response);
$customer->data->fundingInstruments = $this->getIfSet('fundingInstruments', $response);

$customer->data->_links = $this->getIfSet('_links', $response);

Expand Down
Empty file modified src/Resource/CustomerCreditCard.php
100755 → 100644
Empty file.
82 changes: 0 additions & 82 deletions src/Resource/EntriesList.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Resource/Entry.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@ public function get($id_moip)
return $this->getByPath(sprintf('/%s/%s/%s/', MoipResource::VERSION, self::PATH, $id_moip));
}

/**
* Create a new Entries List instance.
*
* @return \Moip\Resource\EntriesList
*/
public function getList()
{
$entriesList = new EntriesList($this->moip);

return $entriesList->get();
}

/**
* Get id from entry.
*
Expand Down
Empty file modified src/Resource/Escrow.php
100755 → 100644
Empty file.
Empty file modified src/Resource/Event.php
100755 → 100644
Empty file.
Empty file modified src/Resource/Holder.php
100755 → 100644
Empty file.
Empty file modified src/Resource/Keys.php
100755 → 100644
Empty file.
3 changes: 0 additions & 3 deletions src/Resource/MoipResource.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ protected function getIfSetDate($key, stdClass $data = null)
*/
protected function getIfSetDateTime($key, stdClass $data = null)
{
date_default_timezone_set('Brazil/East');

$rawDateTime = $this->getIfSet($key, $data);

$dateTime = null;
Expand Down Expand Up @@ -223,7 +221,6 @@ public function generateListPath(Pagination $pagination = null, Filters $filters
* @param string $method http method
* @param mixed|null $payload request body
* @param array $headers request headers
* @param string $accept
*
* @throws Exceptions\ValidationException if the API returns a 4xx http status code. Usually means invalid data was sent.
* @throws Exceptions\UnautorizedException if the API returns a 401 http status code. Check API token and key.
Expand Down
Empty file modified src/Resource/Multiorders.php
100755 → 100644
Empty file.
Empty file modified src/Resource/NotificationPreferences.php
100755 → 100644
Empty file.
Empty file modified src/Resource/NotificationPreferencesList.php
100755 → 100644
Empty file.
Empty file modified src/Resource/Orders.php
100755 → 100644
Empty file.
Empty file modified src/Resource/OrdersList.php
100755 → 100644
Empty file.
Loading