From 8abc6751f49d737f63fc942bdf6fd66255647cf7 Mon Sep 17 00:00:00 2001 From: coco Date: Tue, 1 Sep 2020 10:24:58 -0300 Subject: [PATCH 1/8] sdk --- composer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3e70409..9223e29 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,7 @@ { - "name": "mp-ecommerce-php", + "name": "cocodelacueva-mp-ecommerce-php", "type": "project", - "require": {} + "require": { + "mercadopago/dx-php": "^2.1" + } } From ca2e3b6171118e9d528fee0c8200877a2b715ea0 Mon Sep 17 00:00:00 2001 From: coco Date: Tue, 1 Sep 2020 10:31:42 -0300 Subject: [PATCH 2/8] lock --- composer.lock | 838 ++++++++++++++++++++++++++++++++++++++++++++++++++ detail.php | 24 ++ 2 files changed, 862 insertions(+) create mode 100644 composer.lock diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..f9d63e7 --- /dev/null +++ b/composer.lock @@ -0,0 +1,838 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "d5c98d5a62e6be450b0f2f5325bdb454", + "packages": [ + { + "name": "doctrine/annotations", + "version": "1.10.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5db60a4969eba0e0c197a19c077780aadbc43c5d", + "reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "ext-tokenizer": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^7.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2020-05-25T17:24:27+00:00" + }, + { + "name": "doctrine/cache", + "version": "1.10.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/35a4a70cd94e09e2259dfae7488afc6b474ecbd3", + "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "alcaeus/mongo-php-adapter": "^1.1", + "doctrine/coding-standard": "^6.0", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^7.0", + "predis/predis": "~1.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "time": "2020-05-27T16:24:54+00:00" + }, + { + "name": "doctrine/collections", + "version": "1.6.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "fc0206348e17e530d09463fef07ba8968406cd6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/fc0206348e17e530d09463fef07ba8968406cd6d", + "reference": "fc0206348e17e530d09463fef07ba8968406cd6d", + "shasum": "" + }, + "require": { + "php": "^7.1.3 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan-shim": "^0.9.2", + "phpunit/phpunit": "^7.0", + "vimeo/psalm": "^3.8.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.", + "homepage": "https://www.doctrine-project.org/projects/collections.html", + "keywords": [ + "array", + "collections", + "iterators", + "php" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcollections", + "type": "tidelift" + } + ], + "time": "2020-05-25T19:24:35+00:00" + }, + { + "name": "doctrine/common", + "version": "2.13.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "f3812c026e557892c34ef37f6ab808a6b567da7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/f3812c026e557892c34ef37f6ab808a6b567da7f", + "reference": "f3812c026e557892c34ef37f6ab808a6b567da7f", + "shasum": "" + }, + "require": { + "doctrine/annotations": "^1.0", + "doctrine/cache": "^1.0", + "doctrine/collections": "^1.0", + "doctrine/event-manager": "^1.0", + "doctrine/inflector": "^1.0", + "doctrine/lexer": "^1.0", + "doctrine/persistence": "^1.3.3", + "doctrine/reflection": "^1.0", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^1.0", + "phpstan/phpstan": "^0.11", + "phpstan/phpstan-phpunit": "^0.11", + "phpunit/phpunit": "^7.0", + "squizlabs/php_codesniffer": "^3.0", + "symfony/phpunit-bridge": "^4.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.11.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, persistence interfaces, proxies, event system and much more.", + "homepage": "https://www.doctrine-project.org/projects/common.html", + "keywords": [ + "common", + "doctrine", + "php" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcommon", + "type": "tidelift" + } + ], + "time": "2020-06-05T16:46:05+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "629572819973f13486371cb611386eb17851e85c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/629572819973f13486371cb611386eb17851e85c", + "reference": "629572819973f13486371cb611386eb17851e85c", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "conflict": { + "doctrine/common": "<2.9@dev" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "time": "2019-11-10T09:48:07+00:00" + }, + { + "name": "doctrine/inflector", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "4650c8b30c753a76bf44fb2ed00117d6f367490c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/4650c8b30c753a76bf44fb2ed00117d6f367490c", + "reference": "4650c8b30c753a76bf44fb2ed00117d6f367490c", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^7.0", + "phpstan/phpstan": "^0.11", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-strict-rules": "^0.11", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector", + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "time": "2020-05-29T07:19:59+00:00" + }, + { + "name": "doctrine/lexer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2020-05-25T17:44:05+00:00" + }, + { + "name": "doctrine/persistence", + "version": "1.3.7", + "source": { + "type": "git", + "url": "https://github.com/doctrine/persistence.git", + "reference": "0af483f91bada1c9ded6c2cfd26ab7d5ab2094e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/0af483f91bada1c9ded6c2cfd26ab7d5ab2094e0", + "reference": "0af483f91bada1c9ded6c2cfd26ab7d5ab2094e0", + "shasum": "" + }, + "require": { + "doctrine/annotations": "^1.0", + "doctrine/cache": "^1.0", + "doctrine/collections": "^1.0", + "doctrine/event-manager": "^1.0", + "doctrine/reflection": "^1.2", + "php": "^7.1" + }, + "conflict": { + "doctrine/common": "<2.10@dev" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common", + "Doctrine\\Persistence\\": "lib/Doctrine/Persistence" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.", + "homepage": "https://doctrine-project.org/projects/persistence.html", + "keywords": [ + "mapper", + "object", + "odm", + "orm", + "persistence" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fpersistence", + "type": "tidelift" + } + ], + "time": "2020-03-21T15:13:52+00:00" + }, + { + "name": "doctrine/reflection", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/reflection.git", + "reference": "55e71912dfcd824b2fdd16f2d9afe15684cfce79" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/reflection/zipball/55e71912dfcd824b2fdd16f2d9afe15684cfce79", + "reference": "55e71912dfcd824b2fdd16f2d9afe15684cfce79", + "shasum": "" + }, + "require": { + "doctrine/annotations": "^1.0", + "ext-tokenizer": "*", + "php": "^7.1" + }, + "conflict": { + "doctrine/common": "<2.9" + }, + "require-dev": { + "doctrine/coding-standard": "^5.0", + "doctrine/common": "^2.10", + "phpstan/phpstan": "^0.11.0", + "phpstan/phpstan-phpunit": "^0.11.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection functionality that comes with PHP. It allows you to get the reflection information about classes, methods and properties statically.", + "homepage": "https://www.doctrine-project.org/projects/reflection.html", + "keywords": [ + "reflection", + "static" + ], + "time": "2020-03-27T11:06:43+00:00" + }, + { + "name": "mercadopago/dx-php", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/mercadopago/dx-php.git", + "reference": "83d9d35a002376b0a825967b96c20151bf49c061" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mercadopago/dx-php/zipball/83d9d35a002376b0a825967b96c20151bf49c061", + "reference": "83d9d35a002376b0a825967b96c20151bf49c061", + "shasum": "" + }, + "require": { + "doctrine/annotations": "^1.8", + "doctrine/common": "^2.6", + "php": ">=7.1.0" + }, + "require-dev": { + "doctrine/orm": "~2.3", + "phpmd/phpmd": "@stable", + "phpunit/phpunit": "^5", + "sebastian/phpcpd": "*", + "squizlabs/php_codesniffer": "2.3.*", + "symfony/yaml": "~2.5", + "vlucas/phpdotenv": "^2.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "MercadoPago\\": [ + "src/MercadoPago/", + "tests/", + "src/MercadoPago/Generic/", + "src/MercadoPago/Entities/", + "src/MercadoPago/Entities/Shared/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "imasson", + "homepage": "https://github.com/imasson", + "role": "Developer" + }, + { + "name": "joelibaceta", + "homepage": "https://github.com/joelibaceta", + "role": "Developer" + } + ], + "homepage": "https://github.com/mercadopago/dx-php", + "time": "2020-04-06T17:33:16+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "1.1.0" +} diff --git a/detail.php b/detail.php index ade1f5c..7003854 100644 --- a/detail.php +++ b/detail.php @@ -1,3 +1,27 @@ +transaction_amount = 141; + // $payment->token = "YOUR_CARD_TOKEN"; + // $payment->description = "Ergonomic Silk Shirt"; + // $payment->installments = 1; + // $payment->payment_method_id = "visa"; + // $payment->payer = array( + // "email" => "larue.nienow@hotmail.com" + // ); + + // $payment->save(); + + // echo $payment->status; + + var_dump($_POST); + +?> From 2011094aedc8b87512f8649e834684bf0445d830 Mon Sep 17 00:00:00 2001 From: coco Date: Tue, 1 Sep 2020 11:11:41 -0300 Subject: [PATCH 3/8] provemos respuesta --- detail.php | 215 +++++++++++++++++++++++++++++++++++++++----- process_payment.php | 33 +++++++ 2 files changed, 224 insertions(+), 24 deletions(-) create mode 100644 process_payment.php diff --git a/detail.php b/detail.php index 7003854..d252dce 100644 --- a/detail.php +++ b/detail.php @@ -1,27 +1,3 @@ -transaction_amount = 141; - // $payment->token = "YOUR_CARD_TOKEN"; - // $payment->description = "Ergonomic Silk Shirt"; - // $payment->installments = 1; - // $payment->payment_method_id = "visa"; - // $payment->payer = array( - // "email" => "larue.nienow@hotmail.com" - // ); - - // $payment->save(); - - // echo $payment->status; - - var_dump($_POST); - -?> @@ -76,6 +52,77 @@

+ +
+
+

Detalles del comprador

+
+
+ + +
+
+ + +
+
+ + +
+
+

Detalles de la tarjeta

+
+
+ + +
+
+ +
+ + / + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ +
+
+
+
+
@@ -84,5 +131,125 @@
+ + + \ No newline at end of file diff --git a/process_payment.php b/process_payment.php new file mode 100644 index 0000000..4de9299 --- /dev/null +++ b/process_payment.php @@ -0,0 +1,33 @@ +transaction_amount = (float)$_POST['transactionAmount']; + $payment->token = $_POST['token']; + $payment->description = $_POST['description']; + $payment->installments = (int)$_POST['installments']; + $payment->payment_method_id = $_POST['paymentMethodId']; + $payment->issuer_id = (int)$_POST['issuer']; + + $payer = new MercadoPago\Payer(); + $payer->email = $_POST['email']; + $payer->identification = array( + "type" => $_POST['docType'], + "number" => $_POST['docNumber'] + ); + $payment->payer = $payer; + + $payment->save(); + + $response = array( + 'status' => $payment->status, + 'status_detail' => $payment->status_detail, + 'id' => $payment->id + ); + echo json_encode($response); + +?> From 3c9225c297c7b91ab9accdf05f86f6419619efd6 Mon Sep 17 00:00:00 2001 From: coco Date: Tue, 1 Sep 2020 11:15:54 -0300 Subject: [PATCH 4/8] falto token --- process_payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process_payment.php b/process_payment.php index 4de9299..212f4f0 100644 --- a/process_payment.php +++ b/process_payment.php @@ -3,7 +3,7 @@ require_once 'vendor/autoload.php'; - MercadoPago\SDK::setAccessToken("YOUR_ACCESS_TOKEN"); + MercadoPago\SDK::setAccessToken("TEST-555894209657742-022517-d6f9fa55ba6a66797760d013da8d49b7__LA_LB__-181662021"); $payment = new MercadoPago\Payment(); $payment->transaction_amount = (float)$_POST['transactionAmount']; From 3fc34522beaca126767acf0abcb9587d58b69718 Mon Sep 17 00:00:00 2001 From: coco Date: Tue, 1 Sep 2020 11:22:56 -0300 Subject: [PATCH 5/8] prueba error --- process_payment.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/process_payment.php b/process_payment.php index 212f4f0..1980566 100644 --- a/process_payment.php +++ b/process_payment.php @@ -31,3 +31,40 @@ echo json_encode($response); ?> + + + + + + + Compraste + + + + +
+ + +

+ Su compra ha sido realizada. Gracias, vuelva prontos! +

+ +

Detalles:

+ + +

+ Fracaso absoluto +

+ +

+ Intente otra vez. +

+ +

Detalles:

+ + +
+ + + + From 9980a3100914ddf2bc00c7ec7a02baa1ce92ee44 Mon Sep 17 00:00:00 2001 From: coco Date: Tue, 1 Sep 2020 11:39:12 -0300 Subject: [PATCH 6/8] paymentmethod1 --- detail.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/detail.php b/detail.php index d252dce..d5b94c8 100644 --- a/detail.php +++ b/detail.php @@ -1,3 +1,12 @@ + From 95cc6d62a03d6424bad638ecef2bfb9dc5889651 Mon Sep 17 00:00:00 2001 From: coco Date: Tue, 1 Sep 2020 11:42:04 -0300 Subject: [PATCH 7/8] paymentmethod2 --- detail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detail.php b/detail.php index d5b94c8..a797e19 100644 --- a/detail.php +++ b/detail.php @@ -5,7 +5,7 @@ MercadoPago\SDK::setAccessToken("TEST-555894209657742-022517-d6f9fa55ba6a66797760d013da8d49b7__LA_LB__-181662021"); $payment_methods = MercadoPago::get("/v1/payment_methods"); - var_dump('$payment_methods'); + var_dump($payment_methods); ?> From a48bbeed0cb3594d2e6717af96830a9bbc000edc Mon Sep 17 00:00:00 2001 From: coco Date: Tue, 1 Sep 2020 11:56:14 -0300 Subject: [PATCH 8/8] paymentmethod3 --- detail.php | 19 ++++++------- process_payment.php | 65 ++++++++++++++++++++++++++++++++------------- 2 files changed, 56 insertions(+), 28 deletions(-) diff --git a/detail.php b/detail.php index a797e19..2ab0bb7 100644 --- a/detail.php +++ b/detail.php @@ -1,12 +1,3 @@ - @@ -78,6 +69,16 @@ + +
+ + +
+

Detalles de la tarjeta

diff --git a/process_payment.php b/process_payment.php index 1980566..2553922 100644 --- a/process_payment.php +++ b/process_payment.php @@ -7,27 +7,54 @@ $payment = new MercadoPago\Payment(); $payment->transaction_amount = (float)$_POST['transactionAmount']; - $payment->token = $_POST['token']; $payment->description = $_POST['description']; $payment->installments = (int)$_POST['installments']; - $payment->payment_method_id = $_POST['paymentMethodId']; - $payment->issuer_id = (int)$_POST['issuer']; - - $payer = new MercadoPago\Payer(); - $payer->email = $_POST['email']; - $payer->identification = array( - "type" => $_POST['docType'], - "number" => $_POST['docNumber'] - ); - $payment->payer = $payer; - - $payment->save(); - - $response = array( - 'status' => $payment->status, - 'status_detail' => $payment->status_detail, - 'id' => $payment->id - ); + + + + + if ( $_POST['tipo-pago']=== 'rapipago' || $_POST['tipo-pago']=== 'redlink') { + $payment->payment_method_id = $_POST['tipo-pago']; + $payment->payer = array( + "email" => $_POST['email'] + ); + + $payment->save(); + + $response = array( + 'status' => $payment->status, + 'status_detail' => $payment->status_detail, + 'id' => $payment->id, + 'transaction_details' => array( + 'external_resource_url' => $payment->transaction_details->external_resource_url + ) + ); + + } else { + + $payment->payment_method_id = $_POST['paymentMethodId']; + $payment->issuer_id = (int)$_POST['issuer']; + + $payer = new MercadoPago\Payer(); + $payer->email = $_POST['email']; + $payer->identification = array( + "type" => $_POST['docType'], + "number" => $_POST['docNumber'] + ); + $payment->payer = $payer; + $payment->token = $_POST['token']; + + $payment->save(); + + $response = array( + 'status' => $payment->status, + 'status_detail' => $payment->status_detail, + 'id' => $payment->id + ); + + } + + echo json_encode($response); ?>