Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Composer PSR4 #59

Open
wants to merge 4 commits into
base: master
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
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Created by .ignore support plugin (hsz.mobi)
### Composer template
composer.phar
/vendor/

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea
.idea/workspace.xml
.idea/tasks.xml

# Sensitive or high-churn files:
.idea/dataSources/
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

162 changes: 83 additions & 79 deletions README.md

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions autoload.inc.php

This file was deleted.

20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "valterjrdev/moip-php",
"description": "Biblioteca de integração com o MoIP",
"license": "MIT",
"homepage": "https://labs.moip.com.br/biblioteca/",
"type" : "library",
"autoload": {
"psr-4": {
"": "src/"
}
},
"require": {
"php": ">=5.3.3",
"ext-curl": "*",
"lib-curl": "*",
"lib-openssl": "*",
"lib-libxml": "*",
"electrolinux/phpquery": "^0.9.6"
}
}
64 changes: 64 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
58 changes: 30 additions & 28 deletions examples.php → doc/examples.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

include_once "autoload.inc.php";
include __DIR__ . '/../vendor/autoload.php';

use Moip\Moip;

function exampleBasicInstructions() {
$moip = new Moip();
Expand Down Expand Up @@ -34,11 +36,11 @@ function exampleIdentificationInstruction() {
$moip->setPayer(array('name' => 'Nome Sobrenome',
'email' => 'email@cliente.com.br',
'payerId' => 'id_usuario',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'number' => '45',
'complement' => 'z',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'state' => 'SP',
'country' => 'BRA',
'zipCode' => '01230-000',
Expand Down Expand Up @@ -69,11 +71,11 @@ function exampleAddParcel($example='1') {
$moip->setPayer(array('name' => 'Nome Sobrenome',
'email' => 'email@cliente.com.br',
'payerId' => 'id_usuario',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'number' => '45',
'complement' => 'z',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'state' => 'SP',
'country' => 'BRA',
'zipCode' => '01230-000',
Expand Down Expand Up @@ -106,27 +108,27 @@ function exampleAddComission($example='1') {
$moip->setPayer(array('name' => 'Nome Sobrenome',
'email' => 'email@cliente.com.br',
'payerId' => 'id_usuario',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'number' => '45',
'complement' => 'z',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'state' => 'SP',
'country' => 'BRA',
'zipCode' => '01230-000',
'phone' => '(11)8888-8888')));
$moip->validate('Identification');

if ($example == '1')
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '12.00');
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '12.00');
else if ($example == '2')
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '12.00', true);
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '12.00', true);
else if ($example == '3')
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '12.00', true, 'recebedor_secundario_3');
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '12.00', true, 'recebedor_secundario_3');
else if ($example == '4') {
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '5.00');
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '2.00', true);
$moip->addComission('Raz�o do Split', 'recebedor_secundario_2', '12.00', true, 'recebedor_secundario_3');
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '5.00');
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '2.00', true);
$moip->addComission('Raz�o do Split', 'recebedor_secundario_2', '12.00', true, 'recebedor_secundario_3');
}

print_r($moip->send());
Expand All @@ -144,11 +146,11 @@ function exampleSetReceiver() {
$moip->setPayer(array('name' => 'Nome Sobrenome',
'email' => 'email@cliente.com.br',
'payerId' => 'id_usuario',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'number' => '45',
'complement' => 'z',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'state' => 'SP',
'country' => 'BRA',
'zipCode' => '01230-000',
Expand All @@ -172,11 +174,11 @@ function exampleConfigPaymentWay($param) {
$moip->setPayer(array('name' => 'Nome Sobrenome',
'email' => 'email@cliente.com.br',
'payerId' => 'id_usuario',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'number' => '45',
'complement' => 'z',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'state' => 'SP',
'country' => 'BRA',
'zipCode' => '01230-000',
Expand All @@ -202,11 +204,11 @@ function exampleFull() {
$moip->setPayer(array('name' => 'Nome Sobrenome',
'email' => 'email@cliente.com.br',
'payerId' => 'id_usuario',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'billingAddress' => array('address' => 'Rua do Z�zinho Cora��o',
'number' => '45',
'complement' => 'z',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'city' => 'S�o Paulo',
'neighborhood' => 'Palha�o J�o',
'state' => 'SP',
'country' => 'BRA',
'zipCode' => '01230-000',
Expand All @@ -219,9 +221,9 @@ function exampleFull() {
$moip->addParcel('5', '7', '1.00');
$moip->addParcel('8', '12', null, true);

$moip->addComission('Raz�o do Split', 'recebedor_secundario', '5.00');
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '2.00', true);
$moip->addComission('Raz�o do Split', 'recebedor_secundario_2', '12.00', true, 'recebedor_secundario_3');
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '5.00');
$moip->addComission('Raz�o do Split', 'recebedor_secundario', '2.00', true);
$moip->addComission('Raz�o do Split', 'recebedor_secundario_2', '12.00', true, 'recebedor_secundario_3');

$moip->addPaymentWay('creditCard');
$moip->addPaymentWay('billet');
Expand Down
37 changes: 15 additions & 22 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
<?php
include __DIR__ . '/vendor/autoload.php';

/**
include_once 'examples.php';
use Moip\Moip;
use Moip\MoipStatus;

exampleBasicInstructions();
exampleFull();
exampleQueryParcels();
*
*/
include_once "autoload.inc.php";
$moip = new Moip();
$moip->setEnvironment('test');
$moip->setCredential(array(
'key' => 'ABABABABABABABABABABABABABABABABABABABAB',
'token' => '01010101010101010101010101010101'
));

$moip = new Moip();
$moip->setEnvironment('test');
$moip->setCredential(array(
'key' => 'ABABABABABABABABABABABABABABABABABABABAB',
'token' => '01010101010101010101010101010101'
));
$moip->setUniqueID(false);
$moip->setValue('100.00');
$moip->setReason('Teste do Moip-PHP');

$moip->setUniqueID(false);
$moip->setValue('100.00');
$moip->setReason('Teste do Moip-PHP');
$moip->validate('Basic');

$moip->validate('Basic');
$moip->send();
print_r($moip->getAnswer());

$moip->send();
print_r($moip->getAnswer());

?>
Loading