First upload
This commit is contained in:
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\CheckoutRequest;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
|
||||
class CheckoutRequestTest extends \OxidEsales\TestingLibrary\UnitTestCase
|
||||
{
|
||||
/**
|
||||
* Test cases directory
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_sTestCasesPath = '/testcases/';
|
||||
|
||||
/* Specified test cases (optional) */
|
||||
protected $_aTestCases = array(
|
||||
//'standard/caseSetExpressCheckout_AdditionalItems.php',
|
||||
//'standard/caseSetExpressCheckout_Config2.php',
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the fixture.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->reset();
|
||||
$this->cleanTmpDir();
|
||||
$this->getConfig()->setConfigParam('blOEPayPalSandboxMode', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Basket startup data and expected calculations results
|
||||
*/
|
||||
public function providerDoExpressCheckoutPayment()
|
||||
{
|
||||
$parser = new \OxidEsales\PayPalModule\Tests\Integration\Library\TestCaseParser();
|
||||
$parser->setDirectory(__DIR__ . $this->_sTestCasesPath);
|
||||
if (isset($this->_aTestCases)) {
|
||||
$parser->setTestCases($this->_aTestCases);
|
||||
}
|
||||
$parser->setReplacements($this->getReplacements());
|
||||
|
||||
return $parser->getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDoExpressCheckoutPayment
|
||||
*/
|
||||
public function testExpressCheckoutPaymentRequest($testCase)
|
||||
{
|
||||
if ($testCase['skipped']) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($testCase['session'])) {
|
||||
foreach ($testCase['session'] as $key=> $value) {
|
||||
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($testCase['config'])) {
|
||||
foreach ($testCase['config'] as $key=> $value) {
|
||||
$this->getConfig()->setConfigParam($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$communicationHelper = new \OxidEsales\PayPalModule\Tests\Integration\Library\CommunicationHelper();
|
||||
$curl = $communicationHelper->getCurl(array());
|
||||
|
||||
$dispatcher = $this->getDispatcher($testCase);
|
||||
$this->setCurlToDispatcher($dispatcher, $curl);
|
||||
|
||||
$dispatcher->{$testCase['action']}();
|
||||
|
||||
$curlParameters = $curl->getParameters();
|
||||
|
||||
$expected = $testCase['expected'];
|
||||
|
||||
$asserts = new \OxidEsales\PayPalModule\Tests\Integration\Library\ArrayAsserts();
|
||||
|
||||
$asserts->assertArraysEqual($expected['requestToPayPal'], $curlParameters);
|
||||
|
||||
if (isset($expected['header'])) {
|
||||
$curlHeader = $curl->getHeader();
|
||||
$asserts->assertArraysEqual($expected['header'], $curlHeader);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return dispatcher object
|
||||
*
|
||||
* @param array $testCase
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class
|
||||
*/
|
||||
protected function getDispatcher($testCase)
|
||||
{
|
||||
$basketConstruct = new \OxidEsales\PayPalModule\Tests\Integration\Library\ShopConstruct();
|
||||
$basketConstruct->setParams($testCase);
|
||||
|
||||
$basket = $basketConstruct->getBasket();
|
||||
$session = $this->getSessionMock();
|
||||
$session->setBasket($basket);
|
||||
\OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Session::class, $session);
|
||||
|
||||
$this->setMockedUtils();
|
||||
|
||||
$mockBuilder = $this->getMockBuilder($testCase['class']);
|
||||
$mockBuilder->setMethods(['getPayPalOrder']);
|
||||
$dispatcher = $mockBuilder->getMock();
|
||||
|
||||
$dispatcher->expects($this->any())->method('getPayPalOrder')->will($this->returnValue($this->getOrder()));
|
||||
$dispatcher->setUser($basketConstruct->getUser());
|
||||
|
||||
return $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function getSessionMock()
|
||||
{
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\Eshop\Core\Session::class);
|
||||
$mockBuilder->setMethods(['getRemoteAccessToken']);
|
||||
$session = $mockBuilder->getMock();
|
||||
|
||||
$session->expects($this->any())->method('getRemoteAccessToken')->will($this->returnValue('token'));
|
||||
|
||||
return $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Curl to dispatcher
|
||||
*
|
||||
* @param $dispatcher
|
||||
* @param $curl
|
||||
*/
|
||||
protected function setCurlToDispatcher($dispatcher, $curl)
|
||||
{
|
||||
$communicationService = $dispatcher->getPayPalCheckoutService();
|
||||
$caller = $communicationService->getCaller();
|
||||
$oldCurl = $caller->getCurl();
|
||||
|
||||
$curl->setHost($oldCurl->getHost());
|
||||
$curl->setDataCharset($oldCurl->getDataCharset());
|
||||
$curl->setUrlToCall($oldCurl->getUrlToCall());
|
||||
|
||||
$caller->setCurl($curl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns mocked order object
|
||||
*
|
||||
* @return \OxidEsales\Eshop\Application\Model\Order
|
||||
*/
|
||||
protected function getOrder()
|
||||
{
|
||||
/** @var \OxidEsales\Eshop\Application\Model\Order $order */
|
||||
$mockBuilder = $this->getMockBuilder(Order::class);
|
||||
$mockBuilder->setMethods(['finalizePayPalOrder']);
|
||||
$order = $mockBuilder->getMock();
|
||||
|
||||
$order->expects($this->any())->method('finalizePayPalOrder')->will($this->returnValue(null));
|
||||
$order->oxorder__oxid = new \OxidEsales\Eshop\Core\Field('_test_order');
|
||||
$order->save();
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mocks oxUtils redirect method so that no redirect would be made
|
||||
*/
|
||||
protected function setMockedUtils()
|
||||
{
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\Eshop\Core\Utils::class);
|
||||
$mockBuilder->setMethods(['redirect']);
|
||||
$utils = $mockBuilder->getMock();
|
||||
|
||||
$utils->expects($this->any())->method('redirect')->will($this->returnValue(null));
|
||||
\OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Utils::class, $utils);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array of replacements in test data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getReplacements()
|
||||
{
|
||||
$facts = new \OxidEsales\Facts\Facts();
|
||||
$buttonSource = 'O3SHOP_Cart_CommunityECS';
|
||||
|
||||
$replacements = array(
|
||||
'{SHOP_URL}' => $this->getConfig()->getShopUrl(),
|
||||
'{SHOP_ID}' => $this->getConfig()->getShopId(),
|
||||
'{BN_ID}' => $buttonSource,
|
||||
'{BN_ID_SHORTCUT}' => 'O3SHOP_Cart_ECS_Shortcut'
|
||||
);
|
||||
|
||||
return $replacements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets db tables, required configs
|
||||
*/
|
||||
protected function reset()
|
||||
{
|
||||
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
|
||||
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
|
||||
$db->execute("TRUNCATE oxarticles");
|
||||
$db->execute("TRUNCATE oxcategories");
|
||||
$db->execute("TRUNCATE oxcounters");
|
||||
$db->execute("TRUNCATE oxdiscount");
|
||||
$db->execute("TRUNCATE oxobject2discount");
|
||||
$db->execute("TRUNCATE oxgroups");
|
||||
$db->execute("TRUNCATE oxobject2group");
|
||||
$db->execute("TRUNCATE oxwrapping");
|
||||
$db->execute("TRUNCATE oxdelivery");
|
||||
$db->execute("TRUNCATE oxdel2delset");
|
||||
$db->execute("TRUNCATE oxobject2payment");
|
||||
$db->execute("TRUNCATE oxvouchers");
|
||||
$db->execute("TRUNCATE oxvoucherseries");
|
||||
$db->execute("TRUNCATE oxobject2delivery");
|
||||
$db->execute("TRUNCATE oxdeliveryset");
|
||||
$db->execute("TRUNCATE oxuser");
|
||||
$db->execute("TRUNCATE oxprice2article");
|
||||
$config->setConfigParam("blShowVATForDelivery", true);
|
||||
$config->setConfigParam("blShowVATForPayCharge", true);
|
||||
$db->execute("UPDATE oxpayments SET oxaddsum=0 WHERE oxid = 'oxidpaypal'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: netto
|
||||
* Price view mode: netto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 9002,
|
||||
'oxprice' => 66,
|
||||
'oxvat' => 19,
|
||||
'amount' => 16,
|
||||
'oxstock' => 20,
|
||||
),
|
||||
),
|
||||
'discounts' => array(),
|
||||
'costs' => array(),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser4',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword5',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature6',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
'blShowNetPrice' => true,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => ['oepaypal' => 2],
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword5',
|
||||
'USER' => 'testUser4',
|
||||
'SIGNATURE' => 'testSignature6',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'PAYMENTREQUEST_0_AMT' => '4355.82',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID_SHORTCUT}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
'oxstock' => 33,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 9002,
|
||||
'oxprice' => 66,
|
||||
'oxvat' => 19,
|
||||
'amount' => 16,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'shopdiscount5for9001',
|
||||
'oxaddsum' => 5,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 0,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array(9001),
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'wrapping' => array(
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 9,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array(9001)
|
||||
),
|
||||
),
|
||||
'delivery' => array(
|
||||
0 => array(
|
||||
'oxtitle' => '6_abs_del',
|
||||
'oxactive' => 1,
|
||||
'oxaddsum' => 6,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxdeltype' => 'p',
|
||||
'oxfinalize' => 1,
|
||||
'oxparamend' => 99999
|
||||
),
|
||||
),
|
||||
'payment' => array(
|
||||
0 => array(
|
||||
'oxtitle' => '1 abs payment',
|
||||
'oxaddsum' => 1,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxfromamount' => 0,
|
||||
'oxtoamount' => 1000000,
|
||||
'oxchecked' => 1,
|
||||
'oxarticles' => array(9001, 9002),
|
||||
),
|
||||
),
|
||||
'voucherserie' => array(
|
||||
0 => array(
|
||||
'oxserienr' => 'abs_4_voucher_serie',
|
||||
'oxdiscount' => 6.00,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Automatic',
|
||||
'sOEPayPalEmptyStockLevel' => 1,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => ['oepaypal' => 2],
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'PAYMENTREQUEST_0_AMT' => '4489.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID_SHORTCUT}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: netto
|
||||
* Price view mode: netto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 9002,
|
||||
'oxprice' => 66,
|
||||
'oxvat' => 19,
|
||||
'amount' => 16,
|
||||
'oxstock' => 20,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'shopdiscount5for9001',
|
||||
'oxaddsum' => 5,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 0,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array(9001),
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'wrapping' => array(
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 9,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array(9001)
|
||||
),
|
||||
),
|
||||
'delivery' => array(
|
||||
0 => array(
|
||||
'oxtitle' => '6_abs_del',
|
||||
'oxactive' => 1,
|
||||
'oxaddsum' => 6,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxdeltype' => 'p',
|
||||
'oxfinalize' => 1,
|
||||
'oxparamend' => 99999
|
||||
),
|
||||
),
|
||||
'payment' => array(
|
||||
0 => array(
|
||||
'oxtitle' => '1 abs payment',
|
||||
'oxaddsum' => 1,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxfromamount' => 0,
|
||||
'oxtoamount' => 1000000,
|
||||
'oxchecked' => 1,
|
||||
'oxarticles' => array(9001, 9002),
|
||||
),
|
||||
),
|
||||
'voucherserie' => array(
|
||||
0 => array(
|
||||
'oxserienr' => 'abs_4_voucher_serie',
|
||||
'oxdiscount' => 6.00,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser1',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword2',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature3',
|
||||
'sOEPayPalTransactionMode' => 'Automatic',
|
||||
'blShowNetPrice' => true,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => ['oepaypal' => 2],
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword2',
|
||||
'USER' => 'testUser1',
|
||||
'SIGNATURE' => 'testSignature3',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'PAYMENTREQUEST_0_AMT' => '4456.33',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID_SHORTCUT}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
'oxstock' => 33,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 9002,
|
||||
'oxprice' => 66,
|
||||
'oxvat' => 19,
|
||||
'amount' => 16,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
),
|
||||
'discounts' => array(),
|
||||
'costs' => array(),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
'sOEPayPalEmptyStockLevel' => 10,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => ['oepaypal' => 2],
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'PAYMENTREQUEST_0_AMT' => '4356.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID_SHORTCUT}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'user' => array(
|
||||
'oxactive' => 1,
|
||||
'oxusername' => 'testuser@email.com',
|
||||
'oxfname' => 'Name',
|
||||
'oxlname' => 'LName',
|
||||
'oxstreet' => 'Street',
|
||||
'oxstreetnr' => 'StreetNr',
|
||||
'oxcity' => 'City',
|
||||
'oxzip' => 'ZipCode',
|
||||
'oxfon' => 'PhoneNr',
|
||||
'oxcountryid' => '8f241f11096877ac0.98748826', // United States
|
||||
'oxstateid' => 'IL', // Illinois
|
||||
'address' => array(
|
||||
'oxid' => 'TestUserAddressId',
|
||||
'oxfname' => 'AddressName',
|
||||
'oxlname' => 'AddressLName',
|
||||
'oxstreet' => 'AddressStreet',
|
||||
'oxstreetnr' => 'AddressStreetNr',
|
||||
'oxcity' => 'AddressCity',
|
||||
'oxzip' => 'AddressZipCode',
|
||||
'oxfon' => 'AddressPhoneNr',
|
||||
'oxcountryid' => 'a7c40f6323c4bfb36.59919433', // Italy
|
||||
),
|
||||
),
|
||||
'discounts' => array(),
|
||||
'costs' => array(),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
'sOEPayPalEmptyStockLevel' => 10,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => array(
|
||||
'deladrid' => 'TestUserAddressId',
|
||||
'oepaypal' => 2,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'PAYMENTREQUEST_0_AMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID_SHORTCUT}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'AddressName AddressLName',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'AddressStreet AddressStreetNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'AddressCity',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => 'AddressZipCode',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => 'AddressPhoneNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'IT',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'getExpressCheckoutDetails',
|
||||
'articles' => array(),
|
||||
'discounts' => array(),
|
||||
'session' => array(
|
||||
'oepaypal-token' => 'super_secure_token_f24b24a32df3a9'
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
),
|
||||
'costs' => array(),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => 'super_secure_token_f24b24a32df3a9',
|
||||
'METHOD' => 'GetExpressCheckoutDetails',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: brut
|
||||
* Price view mode: net
|
||||
*
|
||||
* In costs there is wrapping.
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => '_testId1',
|
||||
'oxprice' => 119,
|
||||
'oxvat' => 19,
|
||||
'amount' => 10,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => '_testId2',
|
||||
'oxprice' => 11.9,
|
||||
'oxvat' => 19,
|
||||
'amount' => 100,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'wrapping' => array(
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 11.9,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('_testId1')
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
'blSeoMode' => false,
|
||||
'blShowNetPrice' => true,
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_TAXAMT' => '399.00',
|
||||
'PAYMENTREQUEST_0_AMT' => '2499.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '2100.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 2.499,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 2.499,00 EUR',
|
||||
'MAXAMT' => '2530.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '100.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '10',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=_testId1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '100',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=_testId2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME2' => 'Geschenkverpackung',
|
||||
'L_PAYMENTREQUEST_0_AMT2' => '100.00',
|
||||
'L_PAYMENTREQUEST_0_QTY2' => '1',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: brut
|
||||
* Price view mode: net
|
||||
*
|
||||
* In costs there is voucher.
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => '_testId1',
|
||||
'oxprice' => 119,
|
||||
'oxvat' => 19,
|
||||
'amount' => 10,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => '_testId2',
|
||||
'oxprice' => 11.9,
|
||||
'oxvat' => 19,
|
||||
'amount' => 100,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'voucherserie' => array(
|
||||
0 => array(
|
||||
'oxserienr' => 'abs_4_voucher_serie',
|
||||
'oxdiscount' => 1,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
'blSeoMode' => false,
|
||||
'blShowNetPrice' => true,
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_TAXAMT' => '379.81',
|
||||
'PAYMENTREQUEST_0_AMT' => '2378.81',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '2000.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '-1.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 2.378,81 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 2.378,81 EUR',
|
||||
'MAXAMT' => '2410.81',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '100.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '10',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=_testId1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '100',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=_testId2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: brut
|
||||
* Price view mode: net
|
||||
*
|
||||
* Case with discount.
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => '_testId1',
|
||||
'oxprice' => 119,
|
||||
'oxvat' => 19,
|
||||
'amount' => 1,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => '_testId2',
|
||||
'oxprice' => 11.9,
|
||||
'oxvat' => 19,
|
||||
'amount' => 1,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => '_discountitm',
|
||||
'oxaddsum' => 10,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 1,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('_testId1'),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
'blSeoMode' => false,
|
||||
'blShowNetPrice' => true,
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_TAXAMT' => '19.00',
|
||||
'PAYMENTREQUEST_0_AMT' => '119.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '100.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 119,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 119,00 EUR',
|
||||
'MAXAMT' => '150.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '90.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '1',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=_testId1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '1',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=_testId2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testAddItems1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 0,
|
||||
'amount' => 1,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testAddItems2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 0,
|
||||
'amount' => 1,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'wrapping' => array(
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 0.50,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('testAddItems1', 'testAddItems2')
|
||||
),
|
||||
1 => array(
|
||||
'oxtype' => 'CARD',
|
||||
'oxname' => 'testCard9001',
|
||||
'oxprice' => 0.30,
|
||||
'oxactive' => 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '21.30',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '21.30',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 21,30 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 21,30 EUR',
|
||||
'MAXAMT' => '52.30',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '1',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testAddItems1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '1',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testAddItems2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME2' => 'Geschenkverpackung',
|
||||
'L_PAYMENTREQUEST_0_AMT2' => '1.00',
|
||||
'L_PAYMENTREQUEST_0_QTY2' => '1',
|
||||
'L_PAYMENTREQUEST_0_NAME3' => 'Grußkarte',
|
||||
'L_PAYMENTREQUEST_0_AMT3' => '0.30',
|
||||
'L_PAYMENTREQUEST_0_QTY3' => '1',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
/**
|
||||
* Price enter mode: netto
|
||||
* Price view mode: netto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'test9001',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 19,
|
||||
'oxartnum' => '9001',
|
||||
'oxtitle' => 'Test Title 1',
|
||||
'amount' => 2,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'test9002',
|
||||
'oxprice' => 20,
|
||||
'oxvat' => 19,
|
||||
'oxartnum' => '9002',
|
||||
'oxtitle' => 'Test Title 2',
|
||||
'amount' => 1,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
2 => array(
|
||||
'oxid' => 'test9003',
|
||||
'oxprice' => 30,
|
||||
'oxvat' => 19,
|
||||
'oxartnum' => '9003',
|
||||
'oxtitle' => 'Test Title 3',
|
||||
'amount' => 1,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => true,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 70,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 70,00 EUR',
|
||||
'MAXAMT' => '101.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => 'Test Title 1',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '2.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}Test-Title-1.html',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '9001',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => 'Test Title 2',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '20.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '1.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}Test-Title-2.html',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '9002',
|
||||
'L_PAYMENTREQUEST_0_NAME2' => 'Test Title 3',
|
||||
'L_PAYMENTREQUEST_0_AMT2' => '30.00',
|
||||
'L_PAYMENTREQUEST_0_QTY2' => '1.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL2' => '{SHOP_URL}Test-Title-3.html',
|
||||
'L_PAYMENTREQUEST_0_NUMBER2' => '9003',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalBrandName' => 'ShopBrandName',
|
||||
'sOEPayPalBorderColor' => 'testColor',
|
||||
'dMaxPayPalDeliveryAmount' => 50,
|
||||
'sOEPayPalLogoImageOption' => 'customLogo',
|
||||
'shopLogo' => 'shouldNotBeUsed.ico',
|
||||
'sOEPayPalCustomShopLogoImage' => 'favicon.ico',
|
||||
'blOEPayPalSendToPayPal' => false,
|
||||
'blOEPayPalSandboxMode' => true,
|
||||
'sOEPayPalUsername' => 'tesUser',
|
||||
'sOEPayPalPassword' => 'tesPassword',
|
||||
'sOEPayPalSignature' => 'tesSignature',
|
||||
'sOEPayPalSandboxUsername' => 'testSandboxUser',
|
||||
'sOEPayPalSandboxPassword' => 'testSandboxPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSandboxSignature',
|
||||
'sOEPayPalTransactionMode' => 'Sales',
|
||||
'blOEPayPalGuestBuyRole' => true,
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => false,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testSandboxPassword',
|
||||
'USER' => 'testSandboxUser',
|
||||
'SIGNATURE' => 'testSandboxSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Sole',
|
||||
'BRANDNAME' => 'ShopBrandName',
|
||||
'CARTBORDERCOLOR' => 'testColor',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'LOGOIMG' => '{SHOP_URL}out/azure/img/favicon.ico',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sales',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '3300.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '3300.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei ShopBrandName in Höhe von 3.300,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei ShopBrandName in Höhe von 3.300,00 EUR',
|
||||
'MAXAMT' => '3351.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => 'Gesamtsumme:',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '3300.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '1',
|
||||
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalBrandName' => 'ShopBrandName',
|
||||
'sOEPayPalBorderColor' => 'testColor',
|
||||
'dMaxPayPalDeliveryAmount' => 50,
|
||||
'sOEPayPalLogoImageOption' => 'shopLogo',
|
||||
'sShopLogo' => 'favicon.ico',
|
||||
'sOEPayPalCustomShopLogoImage' => 'shouldNotBeUsed.ico',
|
||||
'blOEPayPalSendToPayPal' => true,
|
||||
'blOEPayPalSandboxMode' => false,
|
||||
'sOEPayPalUsername' => 'testUser',
|
||||
'sOEPayPalPassword' => 'testPassword',
|
||||
'sOEPayPalSignature' => 'testSignature',
|
||||
'sOEPayPalSandboxUsername' => 'testSandboxUser',
|
||||
'sOEPayPalSandboxPassword' => 'testSandboxPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSandboxSignature',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => false,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'ShopBrandName',
|
||||
'CARTBORDERCOLOR' => 'testColor',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'LOGOIMG' => '{SHOP_URL}out/azure/img/favicon.ico',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '3300.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '3300.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei ShopBrandName in Höhe von 3.300,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei ShopBrandName in Höhe von 3.300,00 EUR',
|
||||
'MAXAMT' => '3351.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => 'Gesamtsumme:',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '3300.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '1',
|
||||
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testVouchers1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testVouchers2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'user' => false,
|
||||
'costs' => array(
|
||||
'delivery' => array(
|
||||
'oxdeliveryset' => array(
|
||||
'createOnly' => true,
|
||||
'oxid' => 'mobileShippingSet',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'TestDeliverySet',
|
||||
),
|
||||
0 => array(
|
||||
'oxactive' => 1,
|
||||
'oxaddsum' => 55,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxdeltype' => 'p',
|
||||
'oxfinalize' => 1,
|
||||
'oxparamend' => 99999,
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalMECDefaultShippingId' => 'mobileShippingSet',
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'serverParams' => array(
|
||||
'HTTP_USER_AGENT' => 'iphone',
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => null,
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '125.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => 'TestDeliverySet',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '55.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 125,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 125,00 EUR',
|
||||
'MAXAMT' => '126.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testVouchers1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testVouchers2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testVouchers1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testVouchers2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'user' => false,
|
||||
'costs' => array(
|
||||
'delivery' => array(
|
||||
'oxdeliveryset' => array(
|
||||
'createOnly' => true,
|
||||
'oxid' => 'mobileShippingSet',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'TestDeliverySet',
|
||||
),
|
||||
0 => array(
|
||||
'oxactive' => 1,
|
||||
'oxaddsum' => 55,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxdeltype' => 'p',
|
||||
'oxfinalize' => 1,
|
||||
'oxparamend' => 99999,
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'serverParams' => array(
|
||||
'HTTP_USER_AGENT' => 'iphone',
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => null,
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 70,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 70,00 EUR',
|
||||
'MAXAMT' => '71.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testVouchers1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testVouchers2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testDiscountsAbs1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testDiscountsAbs2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'discountForTestDiscountsAbs1',
|
||||
'oxaddsum' => 5,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 0,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('testDiscountsAbs1'),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 55,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 55,00 EUR',
|
||||
'MAXAMT' => '86.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '5.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsAbs1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsAbs2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testDiscountsBasket1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testDiscountsBasket2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'discountForTestDiscountsBasket1',
|
||||
'oxaddsum' => 5,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 1,
|
||||
'oxprice' => 0,
|
||||
'oxactive' => 1,
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '65.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '-5.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 65,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 65,00 EUR',
|
||||
'MAXAMT' => '101.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsBasket1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsBasket2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testDiscountsPercent1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testDiscountsPercent2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'discountForTestDiscountsPercent1',
|
||||
'oxaddsum' => 50,
|
||||
'oxaddsumtype' => '%',
|
||||
'oxamount' => 0,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('testDiscountsPercent1'),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 55,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 55,00 EUR',
|
||||
'MAXAMT' => '86.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '5.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsPercent1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsPercent2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'groups' => array(
|
||||
0 => array(
|
||||
'oxid' => 'UserLoggedTestGroup',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'checkoutTestGroup',
|
||||
'oxobject2group' => array('TestLoggedUser', 'oxidpaypal'),
|
||||
),
|
||||
),
|
||||
'user' => array(
|
||||
'oxid' => 'TestLoggedUser',
|
||||
'oxactive' => 1,
|
||||
'oxusername' => 'testuser@email.com',
|
||||
'oxfname' => 'Name',
|
||||
'oxlname' => 'LName',
|
||||
'oxstreet' => 'Street',
|
||||
'oxstreetnr' => 'StreetNr',
|
||||
'oxcity' => 'City',
|
||||
'oxzip' => 'ZipCode',
|
||||
'oxfon' => 'PhoneNr',
|
||||
'oxcountryid' => '8f241f11096877ac0.98748826', // United States
|
||||
'oxstateid' => 'IL', // Illinois
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 27,27 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 27,27 EUR',
|
||||
'MAXAMT' => '58.27',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '9.09',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testUserLogged1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'EMAIL' => 'testuser@email.com',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'Name LName',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Street StreetNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => 'ZipCode',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => 'PhoneNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'US',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTATE' => 'IL',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'groups' => array(
|
||||
0 => array(
|
||||
'oxid' => 'UserLoggedTestGroup',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'checkoutTestGroup',
|
||||
'oxobject2group' => array('TestLoggedUser', 'oxidpaypal'),
|
||||
),
|
||||
),
|
||||
'user' => array(
|
||||
'oxid' => 'TestLoggedUser',
|
||||
'oxactive' => 1,
|
||||
'oxusername' => 'testuser@email.com',
|
||||
'oxfname' => 'Name',
|
||||
'oxlname' => 'LName',
|
||||
'oxstreet' => 'Street',
|
||||
'oxstreetnr' => 'StreetNr',
|
||||
'oxcity' => 'City',
|
||||
'oxzip' => 'ZipCode',
|
||||
'oxfon' => 'PhoneNr',
|
||||
'oxcountryid' => '8f241f11096877ac0.98748826', // United States
|
||||
'oxstateid' => 'IL', // Illinois
|
||||
'address' => array(
|
||||
'oxid' => 'TestUserAddressId',
|
||||
'oxfname' => 'AddressName',
|
||||
'oxlname' => 'AddressLName',
|
||||
'oxstreet' => 'AddressStreet',
|
||||
'oxstreetnr' => 'AddressStreetNr',
|
||||
'oxcity' => 'AddressCity',
|
||||
'oxzip' => 'AddressZipCode',
|
||||
'oxfon' => 'AddressPhoneNr',
|
||||
'oxcountryid' => 'a7c40f6323c4bfb36.59919433', // Italy
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'session' => array(
|
||||
'deladrid' => 'TestUserAddressId',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 27,27 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 27,27 EUR',
|
||||
'MAXAMT' => '58.27',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '9.09',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testUserLogged1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'EMAIL' => 'testuser@email.com',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'AddressName AddressLName',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'AddressStreet AddressStreetNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'AddressCity',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => 'AddressZipCode',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => 'AddressPhoneNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'IT',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserNotLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'user' => false,
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '30.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '30.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 30,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 30,00 EUR',
|
||||
'MAXAMT' => '61.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testUserNotLogged1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\ExpressCheckoutDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testVouchers1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testVouchers2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'voucherserie' => array(
|
||||
0 => array(
|
||||
'oxserienr' => 'voucherForShop',
|
||||
'oxdiscount' => 90.00,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=basket',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'CALLBACK' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalexpresscheckoutdispatcher&fnc=processCallBack',
|
||||
'CALLBACKTIMEOUT' => '6',
|
||||
'NOSHIPPING' => '2',
|
||||
'PAYMENTREQUEST_0_AMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '-70.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 0,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 0,00 EUR',
|
||||
'MAXAMT' => '101.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testVouchers1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testVouchers2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of OXID eSales PayPal module.
|
||||
*
|
||||
* OXID eSales PayPal module is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OXID eSales PayPal module is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OXID eSales PayPal module. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @link http://www.oxid-esales.com
|
||||
* @copyright (C) OXID eSales AG 2003-2013
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: netto / brutto
|
||||
* Price view mode: netto / brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: count of used vat's (list)
|
||||
* Currency rate: 1.0 (change if needed)
|
||||
* Discounts: count
|
||||
* 1. shop / basket; abs / %; bargain;
|
||||
* 2. ...
|
||||
* ...
|
||||
* Vouchers: count
|
||||
* 1. voucher rule
|
||||
* 2 ...
|
||||
* ...
|
||||
* Wrapping: + / -
|
||||
* Gift cart: + / -;
|
||||
* Costs VAT caclulation rule: max / proportional
|
||||
* Costs:
|
||||
* 1. Payment + / -
|
||||
* 2. Delivery + / -
|
||||
* 3. TS + / -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
$aData = array(
|
||||
// Articles
|
||||
'articles' => array (
|
||||
0 => array (
|
||||
// oxarticles db fields
|
||||
'oxid' => 1001,
|
||||
'oxprice' => 0.00,
|
||||
'oxvat' => 0,
|
||||
// Amount in basket
|
||||
'amount' => 1,
|
||||
'scaleprices' => array(
|
||||
'oxaddabs' => 0.00,
|
||||
'oxamount' => 1,
|
||||
'oxamountto' => 3,
|
||||
'oxartid' => 1001
|
||||
),
|
||||
),
|
||||
1 => array (
|
||||
|
||||
),
|
||||
),
|
||||
// Categories
|
||||
'categories' => array (
|
||||
0 => array (
|
||||
'oxid' => '30e44ab8593023055.23928895',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'Bar-Equipment',
|
||||
'articles' => ( 1126 )
|
||||
),
|
||||
),
|
||||
// User
|
||||
'user' => array(
|
||||
'oxactive' => 1,
|
||||
'oxusername' => 'basketUser',
|
||||
// country id, for example this is United States, make sure country with specified ID is active
|
||||
'oxcountryid' => '8f241f11096877ac0.98748826',
|
||||
'address' => array(
|
||||
'oxfname' => 'user address name'
|
||||
)
|
||||
),
|
||||
// user will not be created. If not set - default user parameters is used
|
||||
'user' => false,
|
||||
// Group
|
||||
'group' => array (
|
||||
0 => array (
|
||||
'oxid' => 'oxidpricea',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'Price A',
|
||||
'oxobject2group' => array (
|
||||
'oxobjectid' => array( 1001, 'basketUser' ),
|
||||
),
|
||||
),
|
||||
1 => array (
|
||||
'oxid' => 'oxidpriceb',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'Price B',
|
||||
'oxobject2group' => array (
|
||||
'oxobjectid' => array( '30e44ab8593023055.23928895' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Discounts
|
||||
'discounts' => array (
|
||||
// oxdiscount DB fields
|
||||
0 => array (
|
||||
// ID needed for expectation later on, specify meaningful name
|
||||
'oxid' => 'absolutediscount',
|
||||
'oxaddsum' => 1,
|
||||
'oxaddsumtype' => '%',
|
||||
'oxamount' => 1,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'...' => '',
|
||||
// If for article, specify here
|
||||
'oxarticles' => array ( 9001 ),
|
||||
),
|
||||
1 => array (
|
||||
|
||||
),
|
||||
),
|
||||
// Additional costs
|
||||
'costs' => array(
|
||||
// oxwrapping db fields
|
||||
'wrapping' => array(
|
||||
// Wrapping
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 9,
|
||||
'oxactive' => 1,
|
||||
'...' => '',
|
||||
// If for article, specify here
|
||||
'oxarticles' => array( 9001 )
|
||||
),
|
||||
// Giftcard
|
||||
1 => array(
|
||||
'oxtype' => 'CARD',
|
||||
'oxname' => 'testCard',
|
||||
'oxprice' => 0.30,
|
||||
'oxactive' => 1,
|
||||
),
|
||||
),
|
||||
// Delivery
|
||||
'delivery' => array(
|
||||
0 => array(
|
||||
// oxdelivery DB fields
|
||||
'oxactive' => 1,
|
||||
'oxaddsum' => 1,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxdeltype' => 'p',
|
||||
'oxfinalize' => 1,
|
||||
'oxparamend' => 99999,
|
||||
'...' => ''
|
||||
),
|
||||
),
|
||||
// Payment
|
||||
'payment' => array(
|
||||
0 => array(
|
||||
// oxpayments DB fields
|
||||
'oxaddsum' => 1,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxfromamount' => 0,
|
||||
'oxtoamount' => 1000000,
|
||||
'oxchecked' => 1,
|
||||
'...' => ''
|
||||
),
|
||||
),
|
||||
// VOUCHERS
|
||||
'voucherserie' => array (
|
||||
0 => array (
|
||||
// oxvoucherseries DB fields
|
||||
'oxdiscount' => 1.00,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'...' => '',
|
||||
// voucher of this voucherserie count
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'options' => array (
|
||||
'config' => array(
|
||||
'configParam' => true,
|
||||
'configParam2' => false
|
||||
),
|
||||
'activeCurrencyRate' => 1.47,
|
||||
),
|
||||
// TEST EXPECTATIONS
|
||||
'expected' => array (
|
||||
'request' => '',
|
||||
'response' => '',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: netto
|
||||
* Price view mode: netto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 9002,
|
||||
'oxprice' => 66,
|
||||
'oxvat' => 19,
|
||||
'amount' => 16,
|
||||
'oxstock' => 20,
|
||||
),
|
||||
),
|
||||
'discounts' => array(),
|
||||
'costs' => array(),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser4',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword5',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature6',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
'blShowNetPrice' => true,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => ['oepaypal' => 1],
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword5',
|
||||
'USER' => 'testUser4',
|
||||
'SIGNATURE' => 'testSignature6',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'PAYMENTREQUEST_0_AMT' => '4355.82',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
'oxstock' => 33,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 9002,
|
||||
'oxprice' => 66,
|
||||
'oxvat' => 19,
|
||||
'amount' => 16,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'shopdiscount5for9001',
|
||||
'oxaddsum' => 5,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 0,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array(9001),
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'wrapping' => array(
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 9,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array(9001)
|
||||
),
|
||||
),
|
||||
'delivery' => array(
|
||||
0 => array(
|
||||
'oxtitle' => '6_abs_del',
|
||||
'oxactive' => 1,
|
||||
'oxaddsum' => 6,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxdeltype' => 'p',
|
||||
'oxfinalize' => 1,
|
||||
'oxparamend' => 99999
|
||||
),
|
||||
),
|
||||
'payment' => array(
|
||||
0 => array(
|
||||
'oxtitle' => '1 abs payment',
|
||||
'oxaddsum' => 1,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxfromamount' => 0,
|
||||
'oxtoamount' => 1000000,
|
||||
'oxchecked' => 1,
|
||||
'oxarticles' => array(9001, 9002),
|
||||
),
|
||||
),
|
||||
'voucherserie' => array(
|
||||
0 => array(
|
||||
'oxserienr' => 'abs_4_voucher_serie',
|
||||
'oxdiscount' => 6.00,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Automatic',
|
||||
'sOEPayPalEmptyStockLevel' => 1,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => ['oepaypal' => 1],
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'PAYMENTREQUEST_0_AMT' => '4489.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: netto
|
||||
* Price view mode: netto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 9002,
|
||||
'oxprice' => 66,
|
||||
'oxvat' => 19,
|
||||
'amount' => 16,
|
||||
'oxstock' => 20,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'shopdiscount5for9001',
|
||||
'oxaddsum' => 5,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 0,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array(9001),
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'wrapping' => array(
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 9,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array(9001)
|
||||
),
|
||||
),
|
||||
'delivery' => array(
|
||||
0 => array(
|
||||
'oxtitle' => '6_abs_del',
|
||||
'oxactive' => 1,
|
||||
'oxaddsum' => 6,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxdeltype' => 'p',
|
||||
'oxfinalize' => 1,
|
||||
'oxparamend' => 99999
|
||||
),
|
||||
),
|
||||
'payment' => array(
|
||||
0 => array(
|
||||
'oxtitle' => '1 abs payment',
|
||||
'oxaddsum' => 1,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxfromamount' => 0,
|
||||
'oxtoamount' => 1000000,
|
||||
'oxchecked' => 1,
|
||||
'oxarticles' => array(9001, 9002),
|
||||
),
|
||||
),
|
||||
'voucherserie' => array(
|
||||
0 => array(
|
||||
'oxserienr' => 'abs_4_voucher_serie',
|
||||
'oxdiscount' => 6.00,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser1',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword2',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature3',
|
||||
'sOEPayPalTransactionMode' => 'Automatic',
|
||||
'blShowNetPrice' => true,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => ['oepaypal' => 1],
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword2',
|
||||
'USER' => 'testUser1',
|
||||
'SIGNATURE' => 'testSignature3',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'PAYMENTREQUEST_0_AMT' => '4456.33',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
'oxstock' => 33,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 9002,
|
||||
'oxprice' => 66,
|
||||
'oxvat' => 19,
|
||||
'amount' => 16,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
),
|
||||
'discounts' => array(),
|
||||
'costs' => array(),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
'sOEPayPalEmptyStockLevel' => 10,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => ['oepaypal' => 1],
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'PAYMENTREQUEST_0_AMT' => '4356.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'user' => array(
|
||||
'oxactive' => 1,
|
||||
'oxusername' => 'testuser@email.com',
|
||||
'oxfname' => 'Name',
|
||||
'oxlname' => 'LName',
|
||||
'oxstreet' => 'Street',
|
||||
'oxstreetnr' => 'StreetNr',
|
||||
'oxcity' => 'City',
|
||||
'oxzip' => 'ZipCode',
|
||||
'oxfon' => 'PhoneNr',
|
||||
'oxcountryid' => '8f241f11096877ac0.98748826', // United States
|
||||
'oxstateid' => 'IL', // Illinois
|
||||
'address' => array(
|
||||
'oxid' => 'TestUserAddressId',
|
||||
'oxfname' => 'AddressName',
|
||||
'oxlname' => 'AddressLName',
|
||||
'oxstreet' => 'AddressStreet',
|
||||
'oxstreetnr' => 'AddressStreetNr',
|
||||
'oxcity' => 'AddressCity',
|
||||
'oxzip' => 'AddressZipCode',
|
||||
'oxfon' => 'AddressPhoneNr',
|
||||
'oxcountryid' => 'a7c40f6323c4bfb36.59919433', // Italy
|
||||
),
|
||||
),
|
||||
'discounts' => array(),
|
||||
'costs' => array(),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
'sOEPayPalEmptyStockLevel' => 10,
|
||||
'OEPayPalDisableIPN' => false,
|
||||
),
|
||||
'session' => array(
|
||||
'deladrid' => 'TestUserAddressId',
|
||||
'oepaypal' => 1,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'PAYMENTREQUEST_0_AMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_NOTIFYURL' => '{SHOP_URL}index.php?cl=oepaypalipnhandler&fnc=handleRequest&shp={SHOP_ID}',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'AddressName AddressLName',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'AddressStreet AddressStreetNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'AddressCity',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => 'AddressZipCode',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => 'AddressPhoneNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'IT',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
use OxidEsales\Eshop\Application\Model\PaymentGateway;
|
||||
|
||||
$data = array(
|
||||
'class' => PaymentGateway::class,
|
||||
'action' => 'doExpressCheckoutPayment',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'user' => array(
|
||||
'oxactive' => 1,
|
||||
'oxusername' => 'testuser@email.com',
|
||||
'oxfname' => 'Name',
|
||||
'oxlname' => 'LName',
|
||||
'oxstreet' => 'Street',
|
||||
'oxstreetnr' => 'StreetNr',
|
||||
'oxcity' => 'City',
|
||||
'oxzip' => 'ZipCode',
|
||||
'oxfon' => 'PhoneNr',
|
||||
'oxcountryid' => '8f241f11096877ac0.98748826', // United States
|
||||
'oxstateid' => 'IL', // Illinois
|
||||
'address' => array(
|
||||
'oxid' => 'TestUserAddressId',
|
||||
'oxfname' => 'AddressName',
|
||||
'oxlname' => 'AddressLName',
|
||||
'oxstreet' => 'AddressStreet',
|
||||
'oxstreetnr' => 'AddressStreetNr',
|
||||
'oxcity' => 'AddressCity',
|
||||
'oxzip' => 'AddressZipCode',
|
||||
'oxfon' => 'AddressPhoneNr',
|
||||
'oxcountryid' => 'a7c40f6323c4bfb36.59919433', // Italy
|
||||
),
|
||||
),
|
||||
'discounts' => array(),
|
||||
'costs' => array(),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
'sOEPayPalEmptyStockLevel' => 10,
|
||||
'OEPayPalDisableIPN' => 1
|
||||
),
|
||||
'session' => array(
|
||||
'deladrid' => 'TestUserAddressId',
|
||||
'oepaypal' => 1,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => '',
|
||||
'PAYERID' => '',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'PAYMENTREQUEST_0_AMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Bestellnummer 1',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Bestellnummer 1',
|
||||
'BUTTONSOURCE' => '{BN_ID}',
|
||||
'METHOD' => 'DoExpressCheckoutPayment',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'AddressName AddressLName',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'AddressStreet AddressStreetNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'AddressCity',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => 'AddressZipCode',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => 'AddressPhoneNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'IT',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: bruto
|
||||
* Price view mode: brutto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'getExpressCheckoutDetails',
|
||||
'articles' => array(),
|
||||
'discounts' => array(),
|
||||
'session' => array(
|
||||
'oepaypal-token' => 'super_secure_token_f24b24a32df3a9'
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
),
|
||||
'costs' => array(),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'TOKEN' => 'super_secure_token_f24b24a32df3a9',
|
||||
'METHOD' => 'GetExpressCheckoutDetails',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: brut
|
||||
* Price view mode: net
|
||||
*
|
||||
* In costs there is wrapping.
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => '_testId1',
|
||||
'oxprice' => 119,
|
||||
'oxvat' => 19,
|
||||
'amount' => 10,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => '_testId2',
|
||||
'oxprice' => 11.9,
|
||||
'oxvat' => 19,
|
||||
'amount' => 100,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'wrapping' => array(
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 11.9,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('_testId1')
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
'blSeoMode' => false,
|
||||
'blShowNetPrice' => true,
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_TAXAMT' => '399.00',
|
||||
'PAYMENTREQUEST_0_AMT' => '2499.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '2100.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 2.499,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 2.499,00 EUR',
|
||||
'MAXAMT' => '2500.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '100.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '10',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=_testId1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '100',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=_testId2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME2' => 'Geschenkverpackung',
|
||||
'L_PAYMENTREQUEST_0_AMT2' => '100.00',
|
||||
'L_PAYMENTREQUEST_0_QTY2' => '1',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: brut
|
||||
* Price view mode: net
|
||||
*
|
||||
* In costs there is voucher.
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => '_testId1',
|
||||
'oxprice' => 119,
|
||||
'oxvat' => 19,
|
||||
'amount' => 10,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => '_testId2',
|
||||
'oxprice' => 11.9,
|
||||
'oxvat' => 19,
|
||||
'amount' => 100,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'voucherserie' => array(
|
||||
0 => array(
|
||||
'oxserienr' => 'abs_4_voucher_serie',
|
||||
'oxdiscount' => 1,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
'blSeoMode' => false,
|
||||
'blShowNetPrice' => true,
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_TAXAMT' => '379.81',
|
||||
'PAYMENTREQUEST_0_AMT' => '2378.81',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '2000.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '-1.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 2.378,81 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 2.378,81 EUR',
|
||||
'MAXAMT' => '2380.81',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '100.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '10',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=_testId1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '100',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=_testId2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Price enter mode: brut
|
||||
* Price view mode: net
|
||||
*
|
||||
* Case with discount.
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => '_testId1',
|
||||
'oxprice' => 119,
|
||||
'oxvat' => 19,
|
||||
'amount' => 1,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => '_testId2',
|
||||
'oxprice' => 11.9,
|
||||
'oxvat' => 19,
|
||||
'amount' => 1,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => '_discountitm',
|
||||
'oxaddsum' => 10,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 1,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('_testId1'),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalSandboxUsername' => 'testUser',
|
||||
'sOEPayPalSandboxPassword' => 'testPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSignature',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
'blSeoMode' => false,
|
||||
'blShowNetPrice' => true,
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_TAXAMT' => '19.00',
|
||||
'PAYMENTREQUEST_0_AMT' => '119.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '100.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 119,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 119,00 EUR',
|
||||
'MAXAMT' => '120.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '90.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '1',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=_testId1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '1',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=_testId2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testAddItems1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 0,
|
||||
'amount' => 1,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testAddItems2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 0,
|
||||
'amount' => 1,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'wrapping' => array(
|
||||
0 => array(
|
||||
'oxtype' => 'WRAP',
|
||||
'oxname' => 'testWrap9001',
|
||||
'oxprice' => 0.50,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('testAddItems1', 'testAddItems2')
|
||||
),
|
||||
1 => array(
|
||||
'oxtype' => 'CARD',
|
||||
'oxname' => 'testCard9001',
|
||||
'oxprice' => 0.30,
|
||||
'oxactive' => 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '21.30',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '21.30',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 21,30 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 21,30 EUR',
|
||||
'MAXAMT' => '22.30',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '1',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testAddItems1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '1',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testAddItems2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME2' => 'Geschenkverpackung',
|
||||
'L_PAYMENTREQUEST_0_AMT2' => '1.00',
|
||||
'L_PAYMENTREQUEST_0_QTY2' => '1',
|
||||
'L_PAYMENTREQUEST_0_NAME3' => 'Grußkarte',
|
||||
'L_PAYMENTREQUEST_0_AMT3' => '0.30',
|
||||
'L_PAYMENTREQUEST_0_QTY3' => '1',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
/**
|
||||
* Price enter mode: netto
|
||||
* Price view mode: netto
|
||||
* Product count: count of used products
|
||||
* VAT info: 19%
|
||||
* Currency rate: 0.68
|
||||
* Discounts: count
|
||||
* 1. bascet 5 abs
|
||||
* 2. shop 5 abs for 9001
|
||||
* 3. bascet 1 abs for 9001
|
||||
* 4. shop 5% for 9002
|
||||
* 5. bascet 6% for 9002
|
||||
* Vouchers: count
|
||||
* 1. 6 abs
|
||||
* Wrapping: +;
|
||||
* Gift cart: -;
|
||||
* Costs VAT caclulation rule: max
|
||||
* Costs:
|
||||
* 1. Payment +
|
||||
* 2. Delivery +
|
||||
* 3. TS -
|
||||
* Actions with basket or order:
|
||||
* 1. update / delete / change config
|
||||
* 2. ...
|
||||
* ...
|
||||
* Short description: bug entry / support case other info;
|
||||
*/
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'test9001',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 19,
|
||||
'oxartnum' => '9001',
|
||||
'oxtitle' => 'Test Title 1',
|
||||
'amount' => 2,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'test9002',
|
||||
'oxprice' => 20,
|
||||
'oxvat' => 19,
|
||||
'oxartnum' => '9002',
|
||||
'oxtitle' => 'Test Title 2',
|
||||
'amount' => 1,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
2 => array(
|
||||
'oxid' => 'test9003',
|
||||
'oxprice' => 30,
|
||||
'oxvat' => 19,
|
||||
'oxartnum' => '9003',
|
||||
'oxtitle' => 'Test Title 3',
|
||||
'amount' => 1,
|
||||
'oxstock' => 50,
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => true,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 70,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 70,00 EUR',
|
||||
'MAXAMT' => '71.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => 'Test Title 1',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '2.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}Test-Title-1.html',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '9001',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => 'Test Title 2',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '20.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '1.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}Test-Title-2.html',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '9002',
|
||||
'L_PAYMENTREQUEST_0_NAME2' => 'Test Title 3',
|
||||
'L_PAYMENTREQUEST_0_AMT2' => '30.00',
|
||||
'L_PAYMENTREQUEST_0_QTY2' => '1.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL2' => '{SHOP_URL}Test-Title-3.html',
|
||||
'L_PAYMENTREQUEST_0_NUMBER2' => '9003',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalBrandName' => 'ShopBrandName',
|
||||
'sOEPayPalBorderColor' => 'testColor',
|
||||
'dMaxPayPalDeliveryAmount' => 50,
|
||||
'sOEPayPalLogoImageOption' => 'customLogo',
|
||||
'shopLogo' => 'shouldNotBeUsed.ico',
|
||||
'sOEPayPalCustomShopLogoImage' => 'favicon.ico',
|
||||
'blOEPayPalSendToPayPal' => false,
|
||||
'blOEPayPalSandboxMode' => true,
|
||||
'sOEPayPalUsername' => 'tesUser',
|
||||
'sOEPayPalPassword' => 'tesPassword',
|
||||
'sOEPayPalSignature' => 'tesSignature',
|
||||
'sOEPayPalSandboxUsername' => 'testSandboxUser',
|
||||
'sOEPayPalSandboxPassword' => 'testSandboxPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSandboxSignature',
|
||||
'sOEPayPalTransactionMode' => 'Sales',
|
||||
'blOEPayPalGuestBuyRole' => true,
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => false,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testSandboxPassword',
|
||||
'USER' => 'testSandboxUser',
|
||||
'SIGNATURE' => 'testSandboxSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Sole',
|
||||
'BRANDNAME' => 'ShopBrandName',
|
||||
'CARTBORDERCOLOR' => 'testColor',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'LOGOIMG' => '{SHOP_URL}out/azure/img/favicon.ico',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sales',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '3300.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '3300.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei ShopBrandName in Höhe von 3.300,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei ShopBrandName in Höhe von 3.300,00 EUR',
|
||||
'MAXAMT' => '3301.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => 'Gesamtsumme:',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '3300.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '1',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 9001,
|
||||
'oxprice' => 100,
|
||||
'oxvat' => 19,
|
||||
'amount' => 33,
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'sOEPayPalBrandName' => 'ShopBrandName',
|
||||
'sOEPayPalBorderColor' => 'testColor',
|
||||
'dMaxPayPalDeliveryAmount' => 50,
|
||||
'sOEPayPalLogoImageOption' => 'shopLogo',
|
||||
'sShopLogo' => 'favicon.ico',
|
||||
'sOEPayPalCustomShopLogoImage' => 'shouldNotBeUsed.ico',
|
||||
'blOEPayPalSendToPayPal' => true,
|
||||
'blOEPayPalSandboxMode' => false,
|
||||
'sOEPayPalUsername' => 'testUser',
|
||||
'sOEPayPalPassword' => 'testPassword',
|
||||
'sOEPayPalSignature' => 'testSignature',
|
||||
'sOEPayPalSandboxUsername' => 'testSandboxUser',
|
||||
'sOEPayPalSandboxPassword' => 'testSandboxPassword',
|
||||
'sOEPayPalSandboxSignature' => 'testSandboxSignature',
|
||||
'sOEPayPalTransactionMode' => 'Authorization',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => false,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => 'testPassword',
|
||||
'USER' => 'testUser',
|
||||
'SIGNATURE' => 'testSignature',
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'ShopBrandName',
|
||||
'CARTBORDERCOLOR' => 'testColor',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'LOGOIMG' => '{SHOP_URL}out/azure/img/favicon.ico',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '3300.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '3300.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei ShopBrandName in Höhe von 3.300,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei ShopBrandName in Höhe von 3.300,00 EUR',
|
||||
'MAXAMT' => '3301.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => 'Gesamtsumme:',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '3300.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '1',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testVouchers1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testVouchers2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'delivery' => array(
|
||||
'oxdeliveryset' => array(
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'Test Delivery & Set',
|
||||
),
|
||||
0 => array(
|
||||
'oxactive' => 1,
|
||||
'oxaddsum' => 55,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxdeltype' => 'p',
|
||||
'oxfinalize' => 1,
|
||||
'oxparamend' => 99999,
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '125.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => 'Test Delivery & Set',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '55.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 125,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 125,00 EUR',
|
||||
'MAXAMT' => '126.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testVouchers1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testVouchers2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testDiscountsAbs1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testDiscountsAbs2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'discountForTestDiscountsAbs1',
|
||||
'oxaddsum' => 5,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 0,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('testDiscountsAbs1'),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 55,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 55,00 EUR',
|
||||
'MAXAMT' => '56.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '5.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsAbs1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsAbs2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testDiscountsBasket1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testDiscountsBasket2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'discountForTestDiscountsBasket1',
|
||||
'oxaddsum' => 5,
|
||||
'oxaddsumtype' => 'abs',
|
||||
'oxamount' => 1,
|
||||
'oxprice' => 0,
|
||||
'oxactive' => 1,
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '65.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '-5.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 65,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 65,00 EUR',
|
||||
'MAXAMT' => '71.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsBasket1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsBasket2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testDiscountsPercent1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testDiscountsPercent2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'discounts' => array(
|
||||
0 => array(
|
||||
'oxid' => 'discountForTestDiscountsPercent1',
|
||||
'oxaddsum' => 50,
|
||||
'oxaddsumtype' => '%',
|
||||
'oxamount' => 0,
|
||||
'oxamountto' => 99999,
|
||||
'oxactive' => 1,
|
||||
'oxarticles' => array('testDiscountsPercent1'),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '55.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 55,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 55,00 EUR',
|
||||
'MAXAMT' => '56.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '5.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsPercent1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4.0',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testDiscountsPercent2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testVouchers1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testVouchers2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'payment' => array(
|
||||
0 => array(
|
||||
'oxid' => 'oxidpaypal',
|
||||
'oxaddsum' => 55,
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '125.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '125.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 125,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 125,00 EUR',
|
||||
'MAXAMT' => '126.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testVouchers1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testVouchers2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME2' => 'Aufschlag Zahlungsart',
|
||||
'L_PAYMENTREQUEST_0_AMT2' => '55.00',
|
||||
'L_PAYMENTREQUEST_0_QTY2' => '1',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'groups' => array(
|
||||
0 => array(
|
||||
'oxid' => 'UserLoggedTestGroup',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'checkoutTestGroup',
|
||||
'oxobject2group' => array('TestLoggedUser', 'oxidpaypal'),
|
||||
),
|
||||
),
|
||||
'user' => array(
|
||||
'oxid' => 'TestLoggedUser',
|
||||
'oxactive' => 1,
|
||||
'oxusername' => 'testuser@email.com',
|
||||
'oxfname' => 'Name',
|
||||
'oxlname' => 'LName',
|
||||
'oxstreet' => 'Street',
|
||||
'oxstreetnr' => 'StreetNr',
|
||||
'oxcity' => 'City',
|
||||
'oxzip' => 'ZipCode',
|
||||
'oxfon' => 'PhoneNr',
|
||||
'oxcountryid' => '8f241f11096877ac0.98748826', // United States
|
||||
'oxstateid' => 'IL', // Illinois
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 27,27 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 27,27 EUR',
|
||||
'MAXAMT' => '28.27',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '9.09',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testUserLogged1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'EMAIL' => 'testuser@email.com',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'Name LName',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Street StreetNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => 'ZipCode',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => 'PhoneNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'US',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTATE' => 'IL',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'groups' => array(
|
||||
0 => array(
|
||||
'oxid' => 'UserLoggedTestGroup',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'checkoutTestGroup',
|
||||
'oxobject2group' => array('TestLoggedUser', 'oxidpaypal'),
|
||||
),
|
||||
),
|
||||
'user' => array(
|
||||
'oxid' => 'TestLoggedUser',
|
||||
'oxactive' => 1,
|
||||
'oxusername' => 'testuser@email.com',
|
||||
'oxfname' => 'Name',
|
||||
'oxlname' => 'LName',
|
||||
'oxstreet' => 'Street',
|
||||
'oxstreetnr' => 'StreetNr',
|
||||
'oxcity' => 'City',
|
||||
'oxzip' => 'ZipCode',
|
||||
'oxfon' => 'PhoneNr',
|
||||
'oxcountryid' => '8f241f11096877ac0.98748826', // United States
|
||||
'oxstateid' => 'IL', // Illinois
|
||||
'address' => array(
|
||||
'oxid' => 'TestUserAddressId',
|
||||
'oxfname' => 'AddressName',
|
||||
'oxlname' => 'AddressLName',
|
||||
'oxstreet' => 'AddressStreet',
|
||||
'oxstreetnr' => 'AddressStreetNr',
|
||||
'oxcity' => 'AddressCity',
|
||||
'oxzip' => 'AddressZipCode',
|
||||
'oxfon' => 'AddressPhoneNr',
|
||||
'oxcountryid' => 'a7c40f6323c4bfb36.59919433', // Italy
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'session' => array(
|
||||
'deladrid' => 'TestUserAddressId',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '27.27',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 27,27 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 27,27 EUR',
|
||||
'MAXAMT' => '28.27',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '9.09',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testUserLogged1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'EMAIL' => 'testuser@email.com',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'AddressName AddressLName',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'AddressStreet AddressStreetNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'AddressCity',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => 'AddressZipCode',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => 'AddressPhoneNr',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'IT',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testUserNotLogged1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
),
|
||||
'user' => false,
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '30.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '30.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 30,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 30,00 EUR',
|
||||
'MAXAMT' => '31.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testUserNotLogged1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry as EshopRegistry;
|
||||
|
||||
$data = array(
|
||||
'class' => \OxidEsales\PayPalModule\Controller\StandardDispatcher::class,
|
||||
'action' => 'setExpressCheckout',
|
||||
'articles' => array(
|
||||
0 => array(
|
||||
'oxid' => 'testVouchers1',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 3,
|
||||
),
|
||||
1 => array(
|
||||
'oxid' => 'testVouchers2',
|
||||
'oxprice' => 10,
|
||||
'oxvat' => 10,
|
||||
'amount' => 4,
|
||||
),
|
||||
),
|
||||
'costs' => array(
|
||||
'voucherserie' => array(
|
||||
0 => array(
|
||||
'oxserienr' => 'voucherForShop',
|
||||
'oxdiscount' => 90.00,
|
||||
'oxdiscounttype' => 'absolute',
|
||||
'oxallowsameseries' => 1,
|
||||
'oxallowotherseries' => 1,
|
||||
'oxallowuseanother' => 1,
|
||||
'oxshopincl' => 1,
|
||||
'voucher_count' => 1
|
||||
),
|
||||
),
|
||||
),
|
||||
'config' => array(
|
||||
'blSeoMode' => false,
|
||||
'sOEPayPalTransactionMode' => 'Sale',
|
||||
),
|
||||
'requestToShop' => array(
|
||||
'displayCartInPayPal' => true,
|
||||
),
|
||||
'expected' => array(
|
||||
'requestToPayPal' => array(
|
||||
'VERSION' => '84.0',
|
||||
'PWD' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxPassword'),
|
||||
'USER' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxUsername'),
|
||||
'SIGNATURE' => EshopRegistry::getConfig()->getConfigParam('sOEPayPalSandboxSignature'),
|
||||
'CALLBACKVERSION' => '84.0',
|
||||
'LOCALECODE' => 'de_DE',
|
||||
'SOLUTIONTYPE' => 'Mark',
|
||||
'BRANDNAME' => 'PayPal Testshop',
|
||||
'CARTBORDERCOLOR' => '2b8da4',
|
||||
'RETURNURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=oepaypalstandarddispatcher&fnc=getExpressCheckoutDetails',
|
||||
'CANCELURL' => '{SHOP_URL}index.php?lang=0&sid=&rtoken=token&shp={SHOP_ID}&cl=payment',
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
|
||||
'NOSHIPPING' => '0',
|
||||
'ADDROVERRIDE' => '1',
|
||||
'PAYMENTREQUEST_0_AMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR',
|
||||
'PAYMENTREQUEST_0_ITEMAMT' => '70.00',
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => '-70.00',
|
||||
'L_SHIPPINGOPTIONISDEFAULT0' => 'true',
|
||||
'L_SHIPPINGOPTIONNAME0' => '#1',
|
||||
'L_SHIPPINGOPTIONAMOUNT0' => '0.00',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 0,00 EUR',
|
||||
'PAYMENTREQUEST_0_CUSTOM' => 'Ihre Bestellung bei PayPal Testshop in Höhe von 0,00 EUR',
|
||||
'MAXAMT' => '71.00',
|
||||
'L_PAYMENTREQUEST_0_NAME0' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY0' => '3',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL0' => '{SHOP_URL}index.php?cl=details&anid=testVouchers1',
|
||||
'L_PAYMENTREQUEST_0_NUMBER0' => '',
|
||||
'L_PAYMENTREQUEST_0_NAME1' => '',
|
||||
'L_PAYMENTREQUEST_0_AMT1' => '10.00',
|
||||
'L_PAYMENTREQUEST_0_QTY1' => '4',
|
||||
'L_PAYMENTREQUEST_0_ITEMURL1' => '{SHOP_URL}index.php?cl=details&anid=testVouchers2',
|
||||
'L_PAYMENTREQUEST_0_NUMBER1' => '',
|
||||
'EMAIL' => 'admin',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'Maple Street 10',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Any City',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '9041',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '217-8918712',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'DE',
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
),
|
||||
'header' => array(
|
||||
0 => 'POST /cgi-bin/webscr HTTP/1.1',
|
||||
1 => 'Content-Type: application/x-www-form-urlencoded',
|
||||
2 => 'Host: api-3t.sandbox.paypal.com',
|
||||
3 => 'Connection: close',
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration;
|
||||
|
||||
class CurlMainParametersTest extends \OxidEsales\TestingLibrary\UnitTestCase
|
||||
{
|
||||
public function testCurlMainParameterHost_modeSandbox_sandboxHost()
|
||||
{
|
||||
$this->getConfig()->setConfigParam('blOEPayPalSandboxMode', true);
|
||||
|
||||
$service = new \OxidEsales\PayPalModule\Core\PayPalService();
|
||||
$curl = $service->getCaller()->getCurl();
|
||||
|
||||
$this->assertEquals('api-3t.sandbox.paypal.com', $curl->getHost());
|
||||
}
|
||||
|
||||
public function testCurlMainParameterHost_modeProduction_payPalHost()
|
||||
{
|
||||
$this->getConfig()->setConfigParam('blOEPayPalSandboxMode', false);
|
||||
|
||||
$service = new \OxidEsales\PayPalModule\Core\PayPalService();
|
||||
$curl = $service->getCaller()->getCurl();
|
||||
|
||||
$this->assertEquals('api-3t.paypal.com', $curl->getHost());
|
||||
}
|
||||
|
||||
public function testCurlMainParameterCharset_default_iso()
|
||||
{
|
||||
$this->getConfig()->setConfigParam('iUtfMode', false);
|
||||
|
||||
$service = new \OxidEsales\PayPalModule\Core\PayPalService();
|
||||
$curl = $service->getCaller()->getCurl();
|
||||
|
||||
$this->assertEquals('UTF-8', $curl->getDataCharset());
|
||||
}
|
||||
|
||||
public function testCurlMainParameterCharset_utfMode_utf()
|
||||
{
|
||||
$service = new \OxidEsales\PayPalModule\Core\PayPalService();
|
||||
$curl = $service->getCaller()->getCurl();
|
||||
|
||||
$this->assertEquals('UTF-8', $curl->getDataCharset());
|
||||
}
|
||||
|
||||
public function testCurlMainParameterUrlToCall_defaultProductionMode_ApiUrl()
|
||||
{
|
||||
$this->getConfig()->setConfigParam('blOEPayPalSandboxMode', false);
|
||||
|
||||
$service = new \OxidEsales\PayPalModule\Core\PayPalService();
|
||||
$curl = $service->getCaller()->getCurl();
|
||||
|
||||
$this->assertEquals('https://api-3t.paypal.com/nvp', $curl->getUrlToCall());
|
||||
}
|
||||
|
||||
public function testCurlMainParameterUrlToCall_defaultSandboxMode_sandboxApiUrl()
|
||||
{
|
||||
$this->getConfig()->setConfigParam('blOEPayPalSandboxMode', true);
|
||||
|
||||
$service = new \OxidEsales\PayPalModule\Core\PayPalService();
|
||||
$curl = $service->getCaller()->getCurl();
|
||||
|
||||
$this->assertEquals('https://api-3t.sandbox.paypal.com/nvp', $curl->getUrlToCall());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,823 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\IPNProcessing;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
|
||||
/**
|
||||
* Integration tests for IPN processing.
|
||||
*/
|
||||
class IPNProcessingTest extends \OxidEsales\TestingLibrary\UnitTestCase
|
||||
{
|
||||
/** @var string Command for paypal verification call. */
|
||||
const POSTBACK_CMD = 'cmd=_notify-validate';
|
||||
|
||||
/** @var string PayPal transaction id */
|
||||
const PAYPAL_TRANSACTION_ID = '5H706430HM112602B';
|
||||
|
||||
/** @var string PayPal id of authorization transaction */
|
||||
const PAYPAL_AUTHID = '5H706430HM1126666';
|
||||
|
||||
/** @var string PayPal parent transaction id*/
|
||||
const PAYPAL_PARENT_TRANSACTION_ID = '8HF77866N86936335';
|
||||
|
||||
/** @var string Amount paid*/
|
||||
const PAYMENT_AMOUNT = 30.66;
|
||||
|
||||
/** @var string currency specifier*/
|
||||
const PAYMENT_CURRENCY = 'EUR';
|
||||
|
||||
/** @var string PayPal correlation id for transaction*/
|
||||
const PAYMENT_CORRELATION_ID = '361b9ebf97777';
|
||||
|
||||
/** @var string PayPal correlation id for authorization transaction*/
|
||||
const AUTH_CORRELATION_ID = '361b9ebf9bcee';
|
||||
|
||||
/** @var string test order oxid*/
|
||||
private $testOrderId = null;
|
||||
|
||||
/** @var string test user oxid */
|
||||
private $testUserId = null;
|
||||
|
||||
/**
|
||||
* Set up fixture.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->getConfig()->setConfigParam('iUtfMode', '1');
|
||||
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_order`');
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_orderpayments`');
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_orderpaymentcomments`');
|
||||
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderPaymentsTable();
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderTable();
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderPaymentsCommentsTable();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tear down fixture.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->cleanUpTable('oxorder');
|
||||
$this->cleanUpTable('oxuser');
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function providerPayPalIPNPaymentBuilderNewCapture()
|
||||
{
|
||||
$data = array();
|
||||
$data['capture_new'][0]['ipn'] = array(
|
||||
'payment_type' => 'instant',
|
||||
'payment_date' => '00:54:36 Jun 03, 2015 PDT',
|
||||
'payment_status' => 'Completed',
|
||||
'payer_status' => 'verified',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Muster',
|
||||
'payer_email' => 'buyer@paypalsandbox_com',
|
||||
'payer_id' => 'TESTBUYERID01',
|
||||
'address_name' => 'Max_Muster',
|
||||
'address_city' => 'Freiburg',
|
||||
'address_street' => 'Blafööstraße_123',
|
||||
'charset' => 'UTF-8',
|
||||
'transaction_entity' => 'payment',
|
||||
'address_country_code' => 'DE',
|
||||
'notify_version' => '3_8',
|
||||
'custom' => 'Bestellnummer_8',
|
||||
'parent_txn_id' => self::PAYPAL_AUTHID,
|
||||
'txn_id' => self::PAYPAL_TRANSACTION_ID,
|
||||
'auth_id' => self::PAYPAL_AUTHID,
|
||||
'receiver_email' => 'devbiz@oxid-esales_com',
|
||||
'item_name' => 'Bestellnummer_8',
|
||||
'mc_currency' => 'EUR',
|
||||
'test_ipn' => '1',
|
||||
'auth_amount' => self::PAYMENT_AMOUNT,
|
||||
'mc_gross' => self::PAYMENT_AMOUNT,
|
||||
'correlation_id' => self::PAYMENT_CORRELATION_ID,
|
||||
'auth_status' => 'Completed',
|
||||
'memo' => 'capture_new'
|
||||
);
|
||||
$data['capture_new'][0]['expected_payment_status'] = $data['capture_new'][0]['ipn']['payment_status'];
|
||||
$data['capture_new'][0]['expected_txn_id'] = $data['capture_new'][0]['ipn']['txn_id'];
|
||||
$data['capture_new'][0]['expected_date'] = '2015-06-03 09:54:36';
|
||||
$data['capture_new'][0]['expected_correlation_id'] = $data['capture_new'][0]['ipn']['correlation_id'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IPN processing, payment building part.
|
||||
*
|
||||
* @dataProvider providerPayPalIPNPaymentBuilderNewCapture
|
||||
*/
|
||||
public function testPayPalIPNPaymentBuilderNewCapture($data)
|
||||
{
|
||||
$this->prepareFullOrder();
|
||||
$orderPaymentParent = $this->createPayPalOrderPaymentParent();
|
||||
$orderPayment = $this->getPayPalOrderPayment($data['ipn']);
|
||||
|
||||
$this->assertTrue(is_a($orderPayment, \OxidEsales\PayPalModule\Model\OrderPayment::class), 'wrong type of object');
|
||||
$this->assertEquals($data['expected_payment_status'], $orderPayment->getStatus(), 'wrong payment status');
|
||||
$this->assertTrue($orderPayment->getIsValid(), 'payment not valid');
|
||||
$this->assertEquals($data['expected_txn_id'], $orderPayment->getTransactionId(), 'wrong transaction id');
|
||||
$this->assertEquals($data['expected_correlation_id'], $orderPayment->getCorrelationId(),
|
||||
'wrong correlation id');
|
||||
$this->assertEquals($data['expected_date'], $orderPayment->getDate(), 'wrong date');
|
||||
|
||||
$orderPaymentParent->load();
|
||||
$this->assertEquals('Completed', $orderPaymentParent->getStatus(), 'wrong payment status');
|
||||
$this->assertEquals('0.00', $orderPaymentParent->getRefundedAmount(), 'wrong refunded amount');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function providerPayPalIPNPaymentBuilderExistingTransaction()
|
||||
{
|
||||
$data['exists'][0]['ipn'] = array(
|
||||
'payment_type' => 'instant',
|
||||
'payment_date' => '00:54:36 Jun 03, 2015 PDT',
|
||||
'payment_status' => 'Refunded',
|
||||
'payer_status' => 'verified',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Muster',
|
||||
'payer_email' => 'buyer@paypalsandbox_com',
|
||||
'payer_id' => 'TESTBUYERID01',
|
||||
'address_name' => 'Max_Muster',
|
||||
'address_city' => 'Freiburg',
|
||||
'address_street' => 'Blafööstraße_123',
|
||||
'charset' => 'UTF-8',
|
||||
'transaction_entity' => 'payment',
|
||||
'address_country_code' => 'DE',
|
||||
'notify_version' => '3_8',
|
||||
'custom' => 'Bestellnummer_8',
|
||||
'parent_txn_id' => '',
|
||||
'txn_id' => self::PAYPAL_AUTHID,
|
||||
'auth_id' => self::PAYPAL_AUTHID,
|
||||
'receiver_email' => 'devbiz@oxid-esales_com',
|
||||
'item_name' => 'Bestellnummer_8',
|
||||
'mc_currency' => 'EUR',
|
||||
'test_ipn' => '1',
|
||||
'auth_amount' => self::PAYMENT_AMOUNT,
|
||||
'mc_gross' => -self::PAYMENT_AMOUNT,
|
||||
'correlation_id' => self::AUTH_CORRELATION_ID,
|
||||
'memo' => 'exists'
|
||||
);
|
||||
$data['exists'][0]['expected_payment_status'] = $data['exists'][0]['ipn']['payment_status'];
|
||||
$data['exists'][0]['expected_txn_id'] = $data['exists'][0]['ipn']['txn_id'];
|
||||
$data['exists'][0]['expected_date'] = '2015-04-01 12:12:12'; //orginal date
|
||||
$data['exists'][0]['expected_correlation_id'] = $data['exists'][0]['ipn']['correlation_id'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IPN processing, payment building part.
|
||||
*
|
||||
* @dataProvider providerPayPalIPNPaymentBuilderExistingTransaction
|
||||
*/
|
||||
public function testPayPalIPNPaymentBuilderExistingTransaction($data)
|
||||
{
|
||||
$this->prepareFullOrder();
|
||||
$orderPaymentParent = $this->createPayPalOrderPaymentParent();
|
||||
$orderPayment = $this->getPayPalOrderPayment($data['ipn']);
|
||||
|
||||
$this->assertTrue(is_a($orderPayment, \OxidEsales\PayPalModule\Model\OrderPayment::class), 'wrong type of object');
|
||||
$this->assertEquals($data['expected_payment_status'], $orderPayment->getStatus(), 'wrong payment status');
|
||||
$this->assertTrue($orderPayment->getIsValid(), 'payment not valid');
|
||||
$this->assertEquals($data['expected_txn_id'], $orderPayment->getTransactionId(), 'wrong transaction id');
|
||||
$this->assertEquals($data['expected_correlation_id'], $orderPayment->getCorrelationId(),
|
||||
'wrong correlation id');
|
||||
$this->assertEquals($data['expected_date'], $orderPayment->getDate(), 'wrong date');
|
||||
|
||||
$orderPaymentParent->load();
|
||||
$this->assertEquals('0.00', $orderPaymentParent->getRefundedAmount(), 'wrong refunded amount');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function providerPayPalIPNPaymentBuilderRefund()
|
||||
{
|
||||
$data['refund_new'][0]['ipn'] = array(
|
||||
'payment_type' => 'instant',
|
||||
'payment_date' => '00:54:36 Jun 03, 2015 PDT',
|
||||
'payment_status' => 'Refunded',
|
||||
'payer_status' => 'verified',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Muster',
|
||||
'payer_email' => 'buyer@paypalsandbox_com',
|
||||
'payer_id' => 'TESTBUYERID01',
|
||||
'address_name' => 'Max_Muster',
|
||||
'address_city' => 'Freiburg',
|
||||
'address_street' => 'Blafööstraße_123',
|
||||
'charset' => 'UTF-8',
|
||||
'transaction_entity' => 'payment',
|
||||
'address_country_code' => 'DE',
|
||||
'notify_version' => '3_8',
|
||||
'custom' => 'Bestellnummer_8',
|
||||
'parent_txn_id' => self::PAYPAL_AUTHID,
|
||||
'txn_id' => self::PAYPAL_TRANSACTION_ID,
|
||||
'auth_id' => self::PAYPAL_AUTHID,
|
||||
'receiver_email' => 'devbiz@oxid-esales_com',
|
||||
'item_name' => 'Bestellnummer_8',
|
||||
'mc_currency' => 'EUR',
|
||||
'test_ipn' => '1',
|
||||
'auth_amount' => self::PAYMENT_AMOUNT,
|
||||
'mc_gross' => -self::PAYMENT_AMOUNT,
|
||||
'correlation_id' => self::AUTH_CORRELATION_ID,
|
||||
'memo' => 'refund_new'
|
||||
);
|
||||
$data['refund_new'][0]['expected_payment_status'] = $data['refund_new'][0]['ipn']['payment_status'];
|
||||
$data['refund_new'][0]['expected_txn_id'] = $data['refund_new'][0]['ipn']['txn_id'];
|
||||
$data['refund_new'][0]['expected_date'] = '2015-06-03 09:54:36'; //orginal date
|
||||
$data['refund_new'][0]['expected_correlation_id'] = $data['refund_new'][0]['ipn']['correlation_id'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IPN processing, payment building part.
|
||||
*
|
||||
* @dataProvider providerPayPalIPNPaymentBuilderRefund
|
||||
*/
|
||||
public function testPayPalIPNPaymentBuilderRefund($data)
|
||||
{
|
||||
$this->prepareFullOrder();
|
||||
$orderPaymentParent = $this->createPayPalOrderPaymentParent();
|
||||
$orderPayment = $this->getPayPalOrderPayment($data['ipn']);
|
||||
|
||||
$this->assertTrue(is_a($orderPayment, \OxidEsales\PayPalModule\Model\OrderPayment::class), 'wrong type of object');
|
||||
$this->assertEquals($data['expected_payment_status'], $orderPayment->getStatus(), 'wrong payment status');
|
||||
$this->assertTrue($orderPayment->getIsValid(), 'payment not valid');
|
||||
$this->assertEquals($data['expected_txn_id'], $orderPayment->getTransactionId(), 'wrong transaction id');
|
||||
$this->assertEquals($data['expected_correlation_id'], $orderPayment->getCorrelationId(),
|
||||
'wrong correlation id');
|
||||
$this->assertEquals($data['expected_date'], $orderPayment->getDate(), 'wrong date');
|
||||
|
||||
$orderPaymentParent->load();
|
||||
|
||||
//in case of refund, parent transaction should now have set a refunded amount
|
||||
$this->assertEquals('refund', $orderPayment->getAction(), 'wrong action');
|
||||
$this->assertEquals(-$data['ipn']['mc_gross'], $orderPayment->getAmount(), 'wrong amount');
|
||||
$this->assertEquals($orderPayment->getAmount(), $orderPaymentParent->getRefundedAmount(),
|
||||
'wrong refunded amount');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function providerPayPalIPNPaymentBuilderWrongEntity()
|
||||
{
|
||||
$data['wrong_entity'][0]['ipn'] = array('transaction_entity' => 'no_payment');
|
||||
$data['wrong_entity'][0]['expected_payment_status'] = '';
|
||||
$data['wrong_entity'][0]['expected_txn_id'] = '';
|
||||
$data['wrong_entity'][0]['expected_date'] = '';
|
||||
$data['wrong_entity'][0]['expected_correlation_id'] = '';
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IPN processing, payment building part.
|
||||
*
|
||||
* @dataProvider providerPayPalIPNPaymentBuilderExistingTransaction
|
||||
*/
|
||||
public function testPayPalIPNPaymentBuilderWrongEntity($data)
|
||||
{
|
||||
$this->prepareFullOrder();
|
||||
$orderPayment = $this->getPayPalOrderPayment($data['ipn']);
|
||||
$this->assertNull($orderPayment, 'did not expect order payment object');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function providerPayPalIPNProcessor()
|
||||
{
|
||||
$data = array();
|
||||
$data['complete_capture'][0]['capture'] = array(
|
||||
'payment_type' => 'instant',
|
||||
'payment_date' => '00:54:36 Jun 03, 2015 PDT',
|
||||
'payment_status' => 'Completed',
|
||||
'payer_status' => 'verified',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Muster',
|
||||
'payer_email' => 'buyer@paypalsandbox_com',
|
||||
'payer_id' => 'TESTBUYERID01',
|
||||
'address_name' => 'Max_Muster',
|
||||
'address_city' => 'Freiburg',
|
||||
'address_street' => 'Blafööstraße_123',
|
||||
'charset' => 'UTF-8',
|
||||
'transaction_entity' => 'payment',
|
||||
'address_country_code' => 'DE',
|
||||
'notify_version' => '3_8',
|
||||
'custom' => 'Bestellnummer_8',
|
||||
'parent_txn_id' => self::PAYPAL_AUTHID,
|
||||
'txn_id' => self::PAYPAL_TRANSACTION_ID,
|
||||
'auth_id' => self::PAYPAL_AUTHID,
|
||||
'receiver_email' => 'devbiz@oxid-esales_com',
|
||||
'item_name' => 'Bestellnummer_8',
|
||||
'mc_currency' => 'EUR',
|
||||
'test_ipn' => '1',
|
||||
'auth_amount' => self::PAYMENT_AMOUNT,
|
||||
'mc_gross' => self::PAYMENT_AMOUNT,
|
||||
'correlation_id' => '361b9ebf99999',
|
||||
'auth_status' => 'Completed'
|
||||
);
|
||||
$data['complete_capture'][1]['expected_payment_count'] = 2;
|
||||
$data['complete_capture'][1]['expected_capture_amount'] = self::PAYMENT_AMOUNT;
|
||||
$data['complete_capture'][1]['expected_refunded_amount'] = 0.0;
|
||||
$data['complete_capture'][1]['expected_voided_amount'] = 0.0;
|
||||
|
||||
$data['capture_and_refund'][0]['capture'] = array(
|
||||
'payment_type' => 'instant',
|
||||
'payment_date' => '00:54:36 Jun 03, 2015 PDT',
|
||||
'payment_status' => 'Completed',
|
||||
'payer_status' => 'verified',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Muster',
|
||||
'payer_email' => 'buyer@paypalsandbox_com',
|
||||
'payer_id' => 'TESTBUYERID01',
|
||||
'address_name' => 'Max_Muster',
|
||||
'address_city' => 'Freiburg',
|
||||
'address_street' => 'Blafööstraße_123',
|
||||
'charset' => 'UTF-8',
|
||||
'transaction_entity' => 'payment',
|
||||
'address_country_code' => 'DE',
|
||||
'notify_version' => '3_8',
|
||||
'custom' => 'Bestellnummer_8',
|
||||
'parent_txn_id' => self::PAYPAL_AUTHID,
|
||||
'txn_id' => self::PAYPAL_TRANSACTION_ID,
|
||||
'auth_id' => self::PAYPAL_AUTHID,
|
||||
'receiver_email' => 'devbiz@oxid-esales_com',
|
||||
'item_name' => 'Bestellnummer_8',
|
||||
'mc_currency' => 'EUR',
|
||||
'test_ipn' => '1',
|
||||
'auth_amount' => self::PAYMENT_AMOUNT,
|
||||
'mc_gross' => 0.7 * self::PAYMENT_AMOUNT,
|
||||
'ipn_track_id' => '361b9ebf99999',
|
||||
'auth_status' => 'In_Progress'
|
||||
);
|
||||
|
||||
$data['capture_and_refund'][0]['refund'] = array(
|
||||
'payment_type' => 'instant',
|
||||
'payment_date' => '00:54:36 Jun 03, 2015 PDT',
|
||||
'payment_status' => 'Refunded',
|
||||
'payer_status' => 'verified',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Muster',
|
||||
'payer_email' => 'buyer@paypalsandbox_com',
|
||||
'payer_id' => 'TESTBUYERID01',
|
||||
'address_name' => 'Max_Muster',
|
||||
'address_city' => 'Freiburg',
|
||||
'address_street' => 'Blafööstraße_123',
|
||||
'charset' => 'UTF-8',
|
||||
'transaction_entity' => 'payment',
|
||||
'address_country_code' => 'DE',
|
||||
'notify_version' => '3_8',
|
||||
'custom' => 'Bestellnummer_8',
|
||||
'parent_txn_id' => self::PAYPAL_TRANSACTION_ID,
|
||||
'txn_id' => '5H706430HM1127777',
|
||||
'auth_id' => self::PAYPAL_AUTHID,
|
||||
'receiver_email' => 'devbiz@oxid-esales_com',
|
||||
'item_name' => 'Bestellnummer_8',
|
||||
'mc_currency' => 'EUR',
|
||||
'test_ipn' => '1',
|
||||
'auth_amount' => self::PAYMENT_AMOUNT,
|
||||
'mc_gross' => -0.5 * self::PAYMENT_AMOUNT,
|
||||
'ipn_track_id' => '361b9ebf99988',
|
||||
'auth_status' => 'In_Progress'
|
||||
);
|
||||
|
||||
$data['capture_and_refund'][0]['void'] = array(
|
||||
'payment_type' => 'instant',
|
||||
'payment_date' => '00:54:36 Jun 03, 2015 PDT',
|
||||
'payment_status' => 'Voided',
|
||||
'payer_status' => 'verified',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Muster',
|
||||
'payer_email' => 'buyer@paypalsandbox_com',
|
||||
'payer_id' => 'TESTBUYERID01',
|
||||
'address_name' => 'Max_Muster',
|
||||
'address_city' => 'Freiburg',
|
||||
'address_street' => 'Blafööstraße_123',
|
||||
'charset' => 'UTF-8',
|
||||
'transaction_entity' => 'payment',
|
||||
'address_country_code' => 'DE',
|
||||
'notify_version' => '3_8',
|
||||
'custom' => 'Bestellnummer_8',
|
||||
'parent_txn_id' => '',
|
||||
'txn_id' => self::PAYPAL_AUTHID,
|
||||
'auth_id' => self::PAYPAL_AUTHID,
|
||||
'receiver_email' => 'devbiz@oxid-esales_com',
|
||||
'item_name' => 'Bestellnummer_8',
|
||||
'mc_currency' => 'EUR',
|
||||
'test_ipn' => '1',
|
||||
'auth_amount' => self::PAYMENT_AMOUNT,
|
||||
'mc_gross' => self::PAYMENT_AMOUNT,
|
||||
'ipn_track_id' => '361b9ebf99955',
|
||||
'auth_status' => 'Voided'
|
||||
);
|
||||
|
||||
$data['capture_and_refund'][1]['expected_payment_count'] = 3;
|
||||
$data['capture_and_refund'][1]['expected_capture_amount'] = round(0.7 * self::PAYMENT_AMOUNT, 2);
|
||||
$data['capture_and_refund'][1]['expected_refunded_amount'] = round(0.5 * self::PAYMENT_AMOUNT, 2);
|
||||
$data['capture_and_refund'][1]['expected_voided_amount'] = round(0.3 * self::PAYMENT_AMOUNT, 2);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IPN processing in case that the incoming transaction is not yet known in the shop database.
|
||||
* This happens when actions are done via PayPal backend and not via shop.
|
||||
* Test case :
|
||||
* - authorization mode, authorization was done by shop
|
||||
* - 'capture_for_existing_auth' => incoming IPN is for successful capture of the complete amount
|
||||
* - 'capture_and_refund' => captrue, partial refund and void of the remaining auth amount
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $expectations
|
||||
*
|
||||
* @dataProvider providerPayPalIPNProcessor
|
||||
*/
|
||||
public function testPayPalIPNProcessing($data, $expectations)
|
||||
{
|
||||
$paypalOrder = $this->prepareFullOrder();
|
||||
$this->createPayPalOrderPayment('authorization');
|
||||
$this->processIpn($data);
|
||||
|
||||
//after
|
||||
$paypalOrder->load();
|
||||
$this->assertEquals('completed', $paypalOrder->getPaymentStatus(), 'payment status');
|
||||
$this->assertEquals($expectations['expected_payment_count'], count($paypalOrder->getPaymentList()), 'payment count');
|
||||
$this->assertEquals($expectations['expected_capture_amount'], $paypalOrder->getCapturedAmount(), 'captured amount');
|
||||
$this->assertEquals($expectations['expected_refunded_amount'], $paypalOrder->getRefundedAmount(), 'refunded amount');
|
||||
$this->assertEquals($expectations['expected_voided_amount'], $paypalOrder->getVoidedAmount(), 'voided amount');
|
||||
|
||||
// status of order in table oxorder
|
||||
$order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
|
||||
$order->load($this->testOrderId);
|
||||
$this->assertEquals('OK', $order->oxorder__oxtransstatus->value, 'oxorder status');
|
||||
$this->assertNotNull($order->oxorder__oxpaid->value, 'oxpaid date');
|
||||
$this->assertNotEquals('0000-00-00 00:00:00', $order->oxorder__oxpaid->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IPN processing.
|
||||
*/
|
||||
public function testPayPalOrderManager()
|
||||
{ //hier weiter
|
||||
$this->insertUser();
|
||||
$this->createOrder();
|
||||
$this->createPayPalOrder();
|
||||
$orderPaymentAuthorization = $this->createPayPalOrderPayment('authorization');
|
||||
$orderPayment = $this->createPayPalOrderPayment('capture');
|
||||
|
||||
$orderPaymentAuthorization->setStatus('Completed');
|
||||
$orderPaymentAuthorization->save();
|
||||
$this->assertEquals('Completed', $orderPaymentAuthorization->getStatus());
|
||||
|
||||
// status of order in table oxorder
|
||||
$order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
|
||||
$order->load($this->testOrderId);
|
||||
$this->assertEquals('NOT_FINISHED', $order->oxorder__oxtransstatus->value);
|
||||
|
||||
//we have the capture paypal transactions that completes the payment
|
||||
//in table oepaypal_orderpayments and need to update oepaypal_order and oxorder__oxtransstatus
|
||||
|
||||
$orderManager = $this->getProxyClass(\OxidEsales\PayPalModule\Model\OrderManager::class);
|
||||
$orderManager->setOrderPayment($orderPayment);
|
||||
$paypalOrder = $orderManager->getOrder();
|
||||
$this->assertTrue(is_a($paypalOrder, \OxidEsales\PayPalModule\Model\PayPalOrder::class));
|
||||
$this->assertEquals($this->testOrderId, $paypalOrder->getId());
|
||||
$this->assertEquals(0.0, $paypalOrder->getCapturedAmount());
|
||||
$this->assertEquals('pending', $paypalOrder->getPaymentStatus());
|
||||
|
||||
//check PayPal transactions for this order
|
||||
$paymentList = $paypalOrder->getPaymentList();
|
||||
$this->assertEquals(2, count($paymentList));
|
||||
$this->assertFalse($paymentList->hasPendingPayment());
|
||||
|
||||
$processSuccess = $orderManager->updateOrderStatus();
|
||||
$this->assertTrue($processSuccess);
|
||||
$this->assertEquals('completed', $paypalOrder->getPaymentStatus());
|
||||
$this->assertEquals(self::PAYMENT_AMOUNT, $paypalOrder->getCapturedAmount());
|
||||
|
||||
$order->load($this->testOrderId);
|
||||
$this->assertEquals('OK', $order->oxorder__oxtransstatus->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test order amount recalculation.
|
||||
*/
|
||||
public function testPayPalOrderManagerOrderRecalculation()
|
||||
{
|
||||
$this->insertUser();
|
||||
$this->createOrder();
|
||||
$this->createPayPalOrder();
|
||||
$orderPaymentAuthorization = $this->createPayPalOrderPayment('authorization');
|
||||
$orderPayment = $this->createPayPalOrderPayment('capture');
|
||||
|
||||
$orderPaymentAuthorization->setStatus('In_Progress');
|
||||
$orderPaymentAuthorization->save();
|
||||
|
||||
$orderPayment->setStatus('Completed');
|
||||
$orderPayment->setAmount(self::PAYMENT_AMOUNT - 10.0);
|
||||
$orderPayment->save();
|
||||
|
||||
$orderManager = $this->getProxyClass(\OxidEsales\PayPalModule\Model\OrderManager::class);
|
||||
$orderManager->setOrderPayment($orderPayment);
|
||||
$paypalOrder = $orderManager->getOrder();
|
||||
|
||||
$paypalOrder = $orderManager->recalculateAmounts($paypalOrder);
|
||||
$this->assertEquals(self::PAYMENT_AMOUNT - 10.0, $paypalOrder->getCapturedAmount());
|
||||
}
|
||||
|
||||
private function getPayPalConfigMock()
|
||||
{
|
||||
$mocks = array(
|
||||
'getUserEmail' => 'devbiz_api1.oxid-efire.com',
|
||||
'isExpressCheckoutInMiniBasketEnabled' => '1',
|
||||
'isStandardCheckoutEnabled' => '1',
|
||||
'isExpressCheckoutEnabled' => '1',
|
||||
'isLoggingEnabled' => '1',
|
||||
'finalizeOrderOnPayPalSide' => '1',
|
||||
'isSandboxEnabled' => '1',
|
||||
'getPassword' => '1382082575',
|
||||
'getSignature' => 'AoRXRr2UPUu8BdpR8rbnhMMeSk9rAmMNTW2T1o9INg0KUgsqW4qcuhS5',
|
||||
'getTransactionMode' => 'AUTHORIZATION',
|
||||
);
|
||||
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\PayPalModule\Core\Config::class);
|
||||
$mockBuilder->setMethods(array_keys($mocks));
|
||||
$paypalConfig = $mockBuilder->getMock();
|
||||
|
||||
foreach ($mocks as $method => $returnValue) {
|
||||
$paypalConfig->expects($this->any())->method($method)->will($this->returnValue($returnValue));
|
||||
}
|
||||
|
||||
return $paypalConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create order in database by given ID.
|
||||
*
|
||||
* @param string $status
|
||||
*
|
||||
* @return \OxidEsales\Eshop\Application\Model\Order
|
||||
*/
|
||||
private function createOrder($status = null)
|
||||
{
|
||||
if (is_null($status)) {
|
||||
/** @var \OxidEsales\PayPalModule\Model\Order $order */
|
||||
$order = oxNew(Order::class);
|
||||
$status = $order::OEPAYPAL_TRANSACTION_STATUS_NOT_FINISHED;
|
||||
}
|
||||
|
||||
if (empty($this->testUserId)) {
|
||||
$this->fail('please create related oxuser first');
|
||||
}
|
||||
|
||||
$this->testOrderId = substr_replace(\OxidEsales\Eshop\Core\UtilsObject::getInstance()->generateUId(), '_', 0, 1);
|
||||
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\Eshop\Application\Model\Order::class);
|
||||
$mockBuilder->setMethods(['validateDeliveryAddress']);
|
||||
$order = $mockBuilder->getMock();
|
||||
$order->setId($this->testOrderId);
|
||||
$order->oxorder__oxshopid = new \OxidEsales\Eshop\Core\Field(1);
|
||||
$order->oxorder__oxuserid = new \OxidEsales\Eshop\Core\Field($this->testUserId);
|
||||
$order->oxorder__oxorderdate = new \OxidEsales\Eshop\Core\Field('2015-05-29 10:41:03');
|
||||
$order->oxorder__oxbillemail = new \OxidEsales\Eshop\Core\Field('not@thepaypalmail.com');
|
||||
$order->oxorder__oxbillfname = new \OxidEsales\Eshop\Core\Field('Max');
|
||||
$order->oxorder__oxbillname = new \OxidEsales\Eshop\Core\Field('Muster');
|
||||
$order->oxorder__oxbillstreet = new \OxidEsales\Eshop\Core\Field('Blafööstraße');
|
||||
$order->oxorder__oxbillstreetnr = new \OxidEsales\Eshop\Core\Field('123');
|
||||
$order->oxorder__oxbillcity = new \OxidEsales\Eshop\Core\Field('Литовские');
|
||||
$order->oxorder__oxbillcountryid = new \OxidEsales\Eshop\Core\Field('a7c40f631fc920687.20179984');
|
||||
$order->oxorder__oxbillzip = new \OxidEsales\Eshop\Core\Field('22769');
|
||||
$order->oxorder__oxbillsal = new \OxidEsales\Eshop\Core\Field('MR');
|
||||
$order->oxorder__oxpaymentid = new \OxidEsales\Eshop\Core\Field('95700b639e4ef5e759bf6e3be4aabd44');
|
||||
$order->oxorder__oxpaymenttype = new \OxidEsales\Eshop\Core\Field('oxidpaypal');
|
||||
$order->oxorder__oxtotalnetsum = new \OxidEsales\Eshop\Core\Field(self::PAYMENT_AMOUNT / 1.19);
|
||||
$order->oxorder__oxtotalbrutsum = new \OxidEsales\Eshop\Core\Field(self::PAYMENT_AMOUNT);
|
||||
$order->oxorder__oxtotalordersum = new \OxidEsales\Eshop\Core\Field(self::PAYMENT_AMOUNT);
|
||||
$order->oxorder__oxartvat = new \OxidEsales\Eshop\Core\Field('19');
|
||||
$order->oxorder__oxvatartprice1 = new \OxidEsales\Eshop\Core\Field('4.77');
|
||||
$order->oxorder__oxcurrency = new \OxidEsales\Eshop\Core\Field('EUR');
|
||||
$order->oxorder__oxfolder = new \OxidEsales\Eshop\Core\Field('ORDERFOLDER_NEW');
|
||||
$order->oxorder__oxdeltype = new \OxidEsales\Eshop\Core\Field('standard');
|
||||
$order->oxorder__oxtransstatus = new \OxidEsales\Eshop\Core\Field($status);
|
||||
$order->oxorder__oxtransid = new \OxidEsales\Eshop\Core\Field(self::PAYPAL_AUTHID, \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$order->save();
|
||||
|
||||
//mocked to circumvent delivery address change md5 check from requestParameter
|
||||
$order->expects($this->any())->method('validateDeliveryAddress')->will($this->returnValue(0));
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create order in database by given ID.
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\PayPalOrder
|
||||
*/
|
||||
private function createPayPalOrder()
|
||||
{
|
||||
if (empty($this->testOrderId)) {
|
||||
$this->fail('please create related oxorder first');
|
||||
}
|
||||
|
||||
$paypalOrder = oxNew(\OxidEsales\PayPalModule\Model\PayPalOrder::class);
|
||||
$paypalOrder->setOrderId($this->testOrderId);
|
||||
$paypalOrder->setPaymentStatus('pending');
|
||||
$paypalOrder->setCapturedAmount(0.0);
|
||||
$paypalOrder->setTotalOrderSum(self::PAYMENT_AMOUNT);
|
||||
$paypalOrder->setCurrency(self::PAYMENT_CURRENCY);
|
||||
$paypalOrder->setTransactionMode('Authorization');
|
||||
$paypalOrder->save();
|
||||
|
||||
return $paypalOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create order payment authorization or capture.
|
||||
*
|
||||
* @param string $mode Chose type of orderpayment (authorization or capture)
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\OrderPayment::class
|
||||
*/
|
||||
private function createPayPalOrderPayment($mode = 'authorization')
|
||||
{
|
||||
if (empty($this->testOrderId)) {
|
||||
$this->fail('please create related oxorder first');
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['authorization'] = array(
|
||||
'setAction' => 'authorization',
|
||||
'setTransactionId' => self::PAYPAL_AUTHID,
|
||||
'setAmount' => self::PAYMENT_AMOUNT,
|
||||
'setCurrency' => self::PAYMENT_CURRENCY,
|
||||
'setStatus' => 'Pending',
|
||||
'setCorrelationId' => self::AUTH_CORRELATION_ID,
|
||||
'setDate' => '2015-04-01 12:12:12'
|
||||
);
|
||||
$data['capture'] = array(
|
||||
'setAction' => 'capture',
|
||||
'setTransactionId' => self::PAYPAL_TRANSACTION_ID,
|
||||
'setAmount' => self::PAYMENT_AMOUNT,
|
||||
'setCurrency' => self::PAYMENT_CURRENCY,
|
||||
'setStatus' => 'Completed',
|
||||
'setCorrelationId' => self::PAYMENT_CORRELATION_ID,
|
||||
'setDate' => '2015-04-01 13:13:13'
|
||||
);
|
||||
|
||||
$paypalOrderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
|
||||
$paypalOrderPayment->setOrderid($this->testOrderId);
|
||||
|
||||
foreach ($data[$mode] as $function => $argument) {
|
||||
$paypalOrderPayment->$function($argument);
|
||||
}
|
||||
$paypalOrderPayment->save();
|
||||
|
||||
return $paypalOrderPayment;
|
||||
}
|
||||
|
||||
/**
|
||||
* insert test user
|
||||
*/
|
||||
private function insertUser()
|
||||
{
|
||||
$this->testUserId = substr_replace(\OxidEsales\Eshop\Core\UtilsObject::getInstance()->generateUId(), '_', 0, 1);
|
||||
$user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
|
||||
$user->setId($this->testUserId);
|
||||
$user->oxuser__oxactive = new \OxidEsales\Eshop\Core\Field('1', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxrights = new \OxidEsales\Eshop\Core\Field('user', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxshopid = new \OxidEsales\Eshop\Core\Field(1, \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxusername = new \OxidEsales\Eshop\Core\Field('testuser@oxideshop.dev', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
//password is asdfasdf
|
||||
$user->oxuser__oxpassword = new \OxidEsales\Eshop\Core\Field('c630e7f6dd47f9ad60ece4492468149bfed3da3429940181464baae99941d0ffa5562' .
|
||||
'aaecd01eab71c4d886e5467c5fc4dd24a45819e125501f030f61b624d7d',
|
||||
\OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxpasssalt = new \OxidEsales\Eshop\Core\Field('3ddda7c412dbd57325210968cd31ba86', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxcustnr = new \OxidEsales\Eshop\Core\Field('666', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxfname = new \OxidEsales\Eshop\Core\Field('Max', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxlname = new \OxidEsales\Eshop\Core\Field('Muster', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxstreet = new \OxidEsales\Eshop\Core\Field('blafoostreet', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxstreetnr = new \OxidEsales\Eshop\Core\Field('123', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxcity = new \OxidEsales\Eshop\Core\Field('Freiburg', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxcountryid = new \OxidEsales\Eshop\Core\Field('a7c40f631fc920687.20179984', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxzip = new \OxidEsales\Eshop\Core\Field('22769', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxsal = new \OxidEsales\Eshop\Core\Field('MR', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxactive = new \OxidEsales\Eshop\Core\Field('1', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxboni = new \OxidEsales\Eshop\Core\Field('1000', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxcreate = new \OxidEsales\Eshop\Core\Field('2015-05-20 22:10:51', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxregister = new \OxidEsales\Eshop\Core\Field('2015-05-20 22:10:51', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->oxuser__oxboni = new \OxidEsales\Eshop\Core\Field('1000', \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test helper for creating order with PayPal.
|
||||
*
|
||||
* @param array test data
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\OrderPayment::class
|
||||
*/
|
||||
private function getPayPalOrderPayment($data)
|
||||
{
|
||||
$paypalConfig = $this->getPayPalConfigMock();
|
||||
$lang = $paypalConfig->getLang();
|
||||
|
||||
//simulates IPN for capture
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\PayPalModule\Core\Request::class);
|
||||
$mockBuilder->setMethods(['getPost']);
|
||||
$paypalRequest = $mockBuilder->getMock();
|
||||
$paypalRequest->expects($this->any())->method('getPost')->will($this->returnValue($data));
|
||||
|
||||
$paymentBuilder = oxNew(\OxidEsales\PayPalModule\Model\IPNPaymentBuilder::class);
|
||||
$paymentBuilder->setLang($lang);
|
||||
$paymentBuilder->setRequest($paypalRequest);
|
||||
|
||||
//expect the capture transaction to be stored in table oepaypal_orderpayments
|
||||
$orderPayment = $paymentBuilder->buildPayment();
|
||||
|
||||
return $orderPayment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test helper for creating order payment parent transaction with PayPal.
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\OrderPayment::class
|
||||
*/
|
||||
private function createPayPalOrderPaymentParent()
|
||||
{
|
||||
$orderPaymentParent = $this->createPayPalOrderPayment('authorization');
|
||||
$this->assertEquals('Pending', $orderPaymentParent->getStatus());
|
||||
return $orderPaymentParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test helper, creates order with paypal payment and all connected database entries.
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\PayPalOrder
|
||||
*/
|
||||
private function prepareFullOrder()
|
||||
{
|
||||
$this->insertUser();
|
||||
$this->createOrder();
|
||||
|
||||
$paypalOrder = $this->createPayPalOrder();
|
||||
|
||||
return $paypalOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test helper, processes IPN data.
|
||||
*
|
||||
* @param $data
|
||||
*/
|
||||
private function processIpn($data)
|
||||
{
|
||||
$paypalConfig = $this->getPayPalConfigMock();
|
||||
$lang = $paypalConfig->getLang();
|
||||
|
||||
foreach ($data as $post) {
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\PayPalModule\Core\Request::class);
|
||||
$mockBuilder->setMethods(['getPost']);
|
||||
$paypalRequest = $mockBuilder->getMock();
|
||||
$paypalRequest->expects($this->any())->method('getPost')->will($this->returnValue($post));
|
||||
$processor = oxNew(\OxidEsales\PayPalModule\Model\IPNProcessor::class);
|
||||
$processor->setLang($lang);
|
||||
$processor->setRequest($paypalRequest);
|
||||
$processor->process();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\IPNRequestHandler;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
|
||||
class IPNHandlerTest extends \OxidEsales\TestingLibrary\UnitTestCase
|
||||
{
|
||||
/**
|
||||
* Setup: Prepare data - create need tables
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_order`');
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_orderpayments`');
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_orderpaymentcomments`');
|
||||
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderPaymentsTable();
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderTable();
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderPaymentsCommentsTable();
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function providerHandleRequest()
|
||||
{
|
||||
$config = new \OxidEsales\PayPalModule\Core\Config();
|
||||
$realShopOwner = $config->getUserEmail();
|
||||
$notRealShopOwner = 'some12a1sd5@oxid-esales.com';
|
||||
|
||||
return array(
|
||||
// Correct values. Payment status changes to given from PayPal. Order status is calculated from payment.
|
||||
array($realShopOwner, array('VERIFIED' => true), true, 'completed', false
|
||||
, '__handleRequest_transaction', 124.45, 'EUR', 'Completed'
|
||||
, '__handleRequest_transaction', 124.45, 'EUR', 'Completed'),
|
||||
|
||||
// PayPal do not verifies request. Nothing changes.
|
||||
array($realShopOwner, array('Not-VERIFIED' => true), false, 'pending', false
|
||||
, '__handleRequest_transaction', 1.45, 'USD', 'Completed'
|
||||
, '__handleRequest_transaction', 124.45, 'EUR', 'Pending'),
|
||||
// Wrong Shop owner from PayPal. Data do not change.
|
||||
array($notRealShopOwner, array('VERIFIED' => true), false, 'pending', false
|
||||
, '__handleRequest_transaction', 121.45, 'EUR', 'Completed'
|
||||
, '__handleRequest_transaction', 124.45, 'EUR', 'Pending'),
|
||||
|
||||
// Wrong amount. Payment status get updated. Payment amount do not change. Order becomes failed.
|
||||
array($realShopOwner, array('VERIFIED' => true), true, 'failed', true
|
||||
, '__handleRequest_transaction', 121.45, 'EUR', 'Completed'
|
||||
, '__handleRequest_transaction', 124.45, 'EUR', 'Completed'),
|
||||
// Wrong currency. Payment status get updated. Payment currency do not change. Order becomes failed.
|
||||
array($realShopOwner, array('VERIFIED' => true), true, 'failed', true
|
||||
, '__handleRequest_transaction', 124.45, 'USD', 'Completed'
|
||||
, '__handleRequest_transaction', 124.45, 'EUR', 'Completed'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerHandleRequest
|
||||
*/
|
||||
public function testHandleRequest($shopOwnerPayPal, $responseFromPayPal, $requestHandledExpected, $OrderStatusAfterRequest, $failureMessageExist
|
||||
, $transactionIdPayPal, $paymentAmountPayPal, $paymentCurrencyPayPal, $paymentStatusPayPal
|
||||
, $transactionIdShop, $paymentAmountShop, $paymentCurrencyShop, $PaymentStatusAfterRequest)
|
||||
{
|
||||
$orderId = '__handleRequest_order';
|
||||
|
||||
$this->preparePayPalRequest($shopOwnerPayPal, $paymentStatusPayPal, $transactionIdPayPal, $paymentAmountPayPal, $paymentCurrencyPayPal);
|
||||
|
||||
$order = $this->createPayPalOrder($orderId);
|
||||
$this->createOrderPayment($orderId, $transactionIdShop, $paymentAmountShop, $paymentCurrencyShop);
|
||||
|
||||
// Mock curl so we do not call PayPal to check if request originally from PayPal.
|
||||
$ipnRequestVerifier = $this->createPayPalResponse($responseFromPayPal);
|
||||
|
||||
$payPalIPNHandler = new \OxidEsales\PayPalModule\Controller\IPNHandler();
|
||||
$payPalIPNHandler->setIPNRequestVerifier($ipnRequestVerifier);
|
||||
$payPalIPNHandler->handleRequest();
|
||||
|
||||
$logHelper = new \OxidEsales\PayPalModule\Tests\Unit\PayPalLogHelper();
|
||||
$logData = $logHelper->getLogData();
|
||||
$lastLogItem = end($logData);
|
||||
$requestHandled = $lastLogItem->data['Result'] == 'true';
|
||||
|
||||
$order->load();
|
||||
$payment = new \OxidEsales\PayPalModule\Model\OrderPayment();
|
||||
$payment->loadByTransactionId($transactionIdShop);
|
||||
$this->assertEquals($requestHandledExpected, $requestHandled, 'Request is not handled as expected.');
|
||||
$this->assertEquals($PaymentStatusAfterRequest, $payment->getStatus(), 'Status did not change to one returned from PayPal.');
|
||||
$this->assertEquals($OrderStatusAfterRequest, $order->getPaymentStatus(), 'Status did not change to one returned from PayPal.');
|
||||
$this->assertEquals($paymentAmountShop, $payment->getAmount(), 'Payment amount should not change to get from PayPal.');
|
||||
$this->assertEquals($paymentCurrencyShop, $payment->getCurrency(), 'Payment currency should not change to get from PayPal.');
|
||||
if (!$failureMessageExist) {
|
||||
$this->assertEquals(0, count($payment->getCommentList()), 'There should be no failure comment.');
|
||||
} else {
|
||||
$comments = $payment->getCommentList();
|
||||
$comments = $comments->getArray();
|
||||
$comment = $comments[0]->getComment();
|
||||
// Failure comment should have all information about request and original payment.
|
||||
$commentHasAllInformation = strpos($comment, (string) $paymentAmountPayPal) !== false
|
||||
&& strpos($comment, (string) $paymentCurrencyPayPal) !== false
|
||||
&& strpos($comment, (string) $paymentAmountShop) !== false
|
||||
&& strpos($comment, (string) $paymentCurrencyShop) !== false;
|
||||
$this->assertEquals(1, count($comments), 'There should failure comment.');
|
||||
$this->assertTrue($commentHasAllInformation, 'Failure comment should have all information about request and original payment: ' . $comment);
|
||||
}
|
||||
}
|
||||
|
||||
public function providerHandlingPendingRequest()
|
||||
{
|
||||
/** @var \OxidEsales\PayPalModule\Model\Order $order */
|
||||
$order = oxNew(Order::class);
|
||||
return array(
|
||||
array('Completed', $order::OEPAYPAL_TRANSACTION_STATUS_OK),
|
||||
array('Pending', $order::OEPAYPAL_TRANSACTION_STATUS_NOT_FINISHED),
|
||||
array('Failed', $order::OEPAYPAL_TRANSACTION_STATUS_NOT_FINISHED),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $payPalResponseStatus PayPal response status. Order transaction status depends on it.
|
||||
* @param string $transactionStatus Order transaction status. Will be checked if as expected.
|
||||
*
|
||||
* @dataProvider providerHandlingPendingRequest
|
||||
*/
|
||||
public function testHandlingTransactionStatusChange($payPalResponseStatus, $transactionStatus)
|
||||
{
|
||||
$config = oxNew(\OxidEsales\PayPalModule\Core\Config::class);
|
||||
$shopOwner = $config->getUserEmail();
|
||||
$transId = '__handleRequest_transaction';
|
||||
$orderId = '__handleRequest_order';
|
||||
|
||||
$this->preparePayPalRequest($shopOwner, $payPalResponseStatus, $transId, 0, '');
|
||||
|
||||
$this->createOrder($orderId, \OxidEsales\PayPalModule\Model\Order::OEPAYPAL_TRANSACTION_STATUS_NOT_FINISHED);
|
||||
$this->createPayPalOrder($orderId);
|
||||
$this->createOrderPayment($orderId, $transId, 0, '');
|
||||
|
||||
// Mock curl so we do not call PayPal to check if request originally from PayPal.
|
||||
$ipnRequestVerifier = $this->createPayPalResponse(array('VERIFIED' => true));
|
||||
|
||||
// Post imitates call from PayPal.
|
||||
$payPalIPNHandler = oxNew(\OxidEsales\PayPalModule\Controller\IPNHandler::class);
|
||||
$payPalIPNHandler->setIPNRequestVerifier($ipnRequestVerifier);
|
||||
$payPalIPNHandler->handleRequest();
|
||||
|
||||
$order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
|
||||
$order->load($orderId);
|
||||
$this->assertEquals($transactionStatus, $order->getFieldData('oxtransstatus'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create order in database by given ID.
|
||||
*
|
||||
* @param string $orderId
|
||||
* @param string $status
|
||||
*
|
||||
* @return \OxidEsales\Eshop\Application\Model\Order
|
||||
*/
|
||||
protected function createOrder($orderId, $status)
|
||||
{
|
||||
$order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
|
||||
$order->setId($orderId);
|
||||
$order->oxorder__oxtransstatus = new \OxidEsales\Eshop\Core\Field($status);
|
||||
$order->save();
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create order in database by given ID.
|
||||
*
|
||||
* @param string $orderId
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\PayPalOrder
|
||||
*/
|
||||
protected function createPayPalOrder($orderId)
|
||||
{
|
||||
/** @var \OxidEsales\PayPalModule\Model\PayPalOrder $order */
|
||||
$order = oxNew(\OxidEsales\PayPalModule\Model\PayPalOrder::class);
|
||||
$order->setOrderId($orderId);
|
||||
$order->setPaymentStatus('pending');
|
||||
$order->save();
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create order payment related with given order and with specific transaction id.
|
||||
*
|
||||
* @param string $orderId
|
||||
* @param string $transactionId
|
||||
* @param double $paymentAmount
|
||||
* @param string $paymentCurrency
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\OrderPayment::class
|
||||
*/
|
||||
protected function createOrderPayment($orderId, $transactionId, $paymentAmount, $paymentCurrency)
|
||||
{
|
||||
$orderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
|
||||
$orderPayment->setOrderid($orderId);
|
||||
$orderPayment->setTransactionId($transactionId);
|
||||
$orderPayment->setAmount($paymentAmount);
|
||||
$orderPayment->setCurrency($paymentCurrency);
|
||||
$orderPayment->setStatus('Pending');
|
||||
$orderPayment->save();
|
||||
|
||||
return $orderPayment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Communication service do not call PayPal to check if request is from it.
|
||||
*
|
||||
* @param array $responseFromPayPal
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\IPNRequestVerifier
|
||||
*/
|
||||
protected function createPayPalResponse($responseFromPayPal)
|
||||
{
|
||||
$curl = $this->getPayPalCommunicationHelper()->getCurl($responseFromPayPal);
|
||||
|
||||
$caller = oxNew(\OxidEsales\PayPalModule\Core\Caller::class);
|
||||
$caller->setCurl($curl);
|
||||
|
||||
$communicationService = oxNew(\OxidEsales\PayPalModule\Core\PayPalService::class);
|
||||
$communicationService->setCaller($caller);
|
||||
|
||||
$ipnRequestVerifier = oxNew(\OxidEsales\PayPalModule\Model\IPNRequestVerifier::class);
|
||||
$ipnRequestVerifier->setCommunicationService($communicationService);
|
||||
|
||||
return $ipnRequestVerifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $shopOwnerPayPal
|
||||
* @param $paymentStatusPayPal
|
||||
* @param $transactionId
|
||||
* @param $paymentAmountPayPal
|
||||
* @param $paymentCurrencyPayPal
|
||||
*/
|
||||
public function preparePayPalRequest($shopOwnerPayPal, $paymentStatusPayPal, $transactionId, $paymentAmountPayPal, $paymentCurrencyPayPal)
|
||||
{
|
||||
$this->setRequestParameter('receiver_email', $shopOwnerPayPal);
|
||||
$this->setRequestParameter('payment_status', $paymentStatusPayPal);
|
||||
$this->setRequestParameter('txn_id', $transactionId);
|
||||
$this->setRequestParameter('mc_gross', $paymentAmountPayPal);
|
||||
$this->setRequestParameter('mc_currency', $paymentCurrencyPayPal);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OxidEsales\PayPalModule\Tests\Integration\Library\CommunicationHelper
|
||||
*/
|
||||
protected function getPayPalCommunicationHelper()
|
||||
{
|
||||
return oxNew(\OxidEsales\PayPalModule\Tests\Integration\Library\CommunicationHelper::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\Library;
|
||||
|
||||
class ArrayAsserts extends \OxidEsales\PayPalModule\Tests\Integration\Library\IntegrationTestHelper
|
||||
{
|
||||
/**
|
||||
* Checks whether array length are equal and array keys and values are equal independent on keys position
|
||||
*
|
||||
* @param $expected
|
||||
* @param $result
|
||||
*/
|
||||
public function assertArraysEqual($expected, $result)
|
||||
{
|
||||
$this->assertArraysContains($expected, $result);
|
||||
$this->assertEquals(count($expected), count($result), 'Failed asserting that expected array has equal amount of elements with result array');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether array array keys and values are equal independent on keys position
|
||||
*
|
||||
* @param $expected
|
||||
* @param $result
|
||||
*/
|
||||
public function assertArraysContains($expected, $result)
|
||||
{
|
||||
$expectedNotMatched = array();
|
||||
$resultNotMatched = array();
|
||||
|
||||
foreach ($expected as $key => $value) {
|
||||
try {
|
||||
$this->assertArrayHasKey($key, $result);
|
||||
$this->assertEquals($value, $result[$key]);
|
||||
} catch (\Exception $exception) {
|
||||
$expectedNotMatched[$key] = $value;
|
||||
$resultNotMatched[$key] = $result[$key];
|
||||
}
|
||||
}
|
||||
$this->assertEquals($expectedNotMatched, $resultNotMatched, 'Values not matched in given arrays');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\Library;
|
||||
|
||||
class CommunicationHelper extends \OxidEsales\PayPalModule\Tests\Integration\Library\IntegrationTestHelper
|
||||
{
|
||||
/**
|
||||
* Returns loaded Caller object returning given parameters on call
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Core\PayPalService
|
||||
*/
|
||||
public function getCaller($params)
|
||||
{
|
||||
/**
|
||||
* @var \OxidEsales\PayPalModule\Core\Caller $caller
|
||||
*/
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\PayPalModule\Core\Caller::class);
|
||||
$mockBuilder->setMethods(['call']);
|
||||
$caller = $mockBuilder->getMock();
|
||||
$caller->expects($this->any())->method('call')->will($this->returnValue($params));
|
||||
|
||||
$service = new \OxidEsales\PayPalModule\Core\PayPalService();
|
||||
$service->setCaller($caller);
|
||||
|
||||
return $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stub curl to return expected result.
|
||||
*
|
||||
* @param array $result
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Core\Curl
|
||||
*/
|
||||
public function getCurl($result)
|
||||
{
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\PayPalModule\Core\Curl::class);
|
||||
$mockBuilder->setMethods(['execute']);
|
||||
$curl = $mockBuilder->getMock();
|
||||
$curl->expects($this->any())->method('execute')->will($this->returnValue($result));
|
||||
|
||||
return $curl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\Library;
|
||||
|
||||
abstract class IntegrationTestHelper extends \OxidEsales\TestingLibrary\UnitTestCase
|
||||
{
|
||||
/**
|
||||
* The only way to skip this helper file with no errors
|
||||
*/
|
||||
public function testSkip()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\Library;
|
||||
|
||||
class RequestHelper extends \OxidEsales\PayPalModule\Tests\Integration\Library\IntegrationTestHelper
|
||||
{
|
||||
/**
|
||||
* Returns loaded \OxidEsales\PayPalModule\Core\Request object with given parameters
|
||||
*
|
||||
* @param array $postParams
|
||||
* @param array $getParams
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Core\Request
|
||||
*/
|
||||
public function getRequest($postParams = null, $getParams = null)
|
||||
{
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\PayPalModule\Core\Request::class);
|
||||
$mockBuilder->setMethods(['getPost', 'getGet']);
|
||||
$request = $mockBuilder->getMock();
|
||||
$request->expects($this->any())->method('getPost')->will($this->returnValue($postParams));
|
||||
$request->expects($this->any())->method('getGet')->will($this->returnValue($getParams));
|
||||
|
||||
return $request;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,725 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\Library;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Basket;
|
||||
|
||||
class ShopConstruct
|
||||
{
|
||||
/**
|
||||
* @var \OxidEsales\Eshop\Application\Model\User
|
||||
*/
|
||||
protected $_oParams = null;
|
||||
|
||||
/**
|
||||
* @var \OxidEsales\Eshop\Application\Model\User
|
||||
*/
|
||||
protected $_oUser = null;
|
||||
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
protected $_oGroups = null;
|
||||
|
||||
/**
|
||||
* Sets constructor parameters
|
||||
*
|
||||
* @param array $params
|
||||
*/
|
||||
public function setParams($params)
|
||||
{
|
||||
$this->_oParams = $params;
|
||||
$this->setConfigParameters();
|
||||
$this->setSessionParameters();
|
||||
$this->setRequestParameters();
|
||||
$this->setServerParameters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets constructor parameters
|
||||
*
|
||||
* @param null $key
|
||||
*
|
||||
* @return \OxidEsales\Eshop\Application\Model\User
|
||||
*/
|
||||
public function getParams($key = null)
|
||||
{
|
||||
if (!is_null($key)) {
|
||||
return $this->_oParams[$key];
|
||||
}
|
||||
|
||||
return $this->_oParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OxidEsales\Eshop\Application\Model\User $user
|
||||
*/
|
||||
public function setUser($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OxidEsales\Eshop\Application\Model\User
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
if (is_null($this->user)) {
|
||||
$user = $this->getParams('user');
|
||||
if ($user === false) {
|
||||
return null;
|
||||
}
|
||||
if (!$user) {
|
||||
$user = $this->getDefaultUserData();
|
||||
}
|
||||
$this->setUser($this->createUser($user));
|
||||
}
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OxidEsales\Eshop\Application\Model\User $groups
|
||||
*/
|
||||
public function setGroups($groups)
|
||||
{
|
||||
$this->_oGroups = $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OxidEsales\Eshop\Application\Model\User
|
||||
*/
|
||||
public function getGroups()
|
||||
{
|
||||
if (is_null($this->_oGroups)) {
|
||||
$groups = $this->getParams('groups');
|
||||
if ($groups === false) {
|
||||
return null;
|
||||
}
|
||||
if (!$groups) {
|
||||
$groups = $this->getDefaultGroupsData();
|
||||
}
|
||||
$this->setGroups($this->createGroups($groups));
|
||||
}
|
||||
|
||||
return $this->_oGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set config options
|
||||
*/
|
||||
public function setConfigParameters()
|
||||
{
|
||||
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
|
||||
$params = $this->getParams('config');
|
||||
if (!empty($params)) {
|
||||
foreach ($params as $key => $value) {
|
||||
$config->setConfigParam($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set config options
|
||||
*/
|
||||
public function setSessionParameters()
|
||||
{
|
||||
$session = \OxidEsales\Eshop\Core\Registry::getSession();
|
||||
$params = $this->getParams('session');
|
||||
if (is_array($params)) {
|
||||
foreach ($params as $name => $value) {
|
||||
$session->setVariable($name, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set config options
|
||||
*/
|
||||
public function setRequestParameters()
|
||||
{
|
||||
$params = $this->getParams('requestToShop');
|
||||
if (is_array($params)) {
|
||||
$_POST = $params;
|
||||
$_GET = $params;
|
||||
$_COOKIE = $params;
|
||||
$_REQUEST = $params;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set config options
|
||||
*/
|
||||
public function setServerParameters()
|
||||
{
|
||||
if ($serverParams = $this->getParams('serverParams')) {
|
||||
foreach ($serverParams as $key => $value) {
|
||||
$_SERVER[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns prepared basket, user and config.
|
||||
*
|
||||
* @return \OxidEsales\Eshop\Application\Model\Basket
|
||||
*/
|
||||
public function getBasket()
|
||||
{
|
||||
$this->createCats($this->getParams('categories'));
|
||||
$this->setDiscounts($this->getParams('discounts'));
|
||||
|
||||
$costs = $this->getParams('costs');
|
||||
$deliverySetId = $this->setDeliveryCosts($costs['delivery']);
|
||||
$payment = $this->setPayments($costs['payment']);
|
||||
$voucherIDs = $this->setVouchers($costs['voucherserie']);
|
||||
|
||||
$basket = oxNew(Basket::class);
|
||||
|
||||
$basket->setBasketUser($this->getUser());
|
||||
|
||||
$this->getGroups();
|
||||
|
||||
$artsForBasket = $this->createArticles($this->getParams('articles'));
|
||||
$wrap = $this->setWrappings($costs['wrapping']);
|
||||
foreach ($artsForBasket as $art) {
|
||||
if (!$art['amount']) {
|
||||
continue;
|
||||
}
|
||||
$item = $basket->addToBasket($art['id'], $art['amount']);
|
||||
|
||||
if (!empty($wrap)) {
|
||||
$item->setWrapping($wrap[$art['id']]);
|
||||
}
|
||||
}
|
||||
|
||||
$wrap['card'] ? $basket->setCardId($wrap['card']) : '';
|
||||
|
||||
if (!empty($deliverySetId) && !$costs['delivery']['oxdeliveryset']['createOnly']) {
|
||||
$basket->setShipping($deliverySetId);
|
||||
}
|
||||
|
||||
if (!empty($payment)) {
|
||||
$basket->setPayment($payment[0]);
|
||||
}
|
||||
|
||||
$basket->setSkipVouchersChecking(true);
|
||||
if (!empty($voucherIDs)) {
|
||||
$count = count($voucherIDs);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$basket->addVoucher($voucherIDs[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$basket->calculateBasket();
|
||||
|
||||
return $basket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates articles from array
|
||||
*
|
||||
* @param array $articleDataSet
|
||||
*
|
||||
* @return array $result of id's and basket amounts of created articles
|
||||
*/
|
||||
public function createArticles($articleDataSet)
|
||||
{
|
||||
$result = array();
|
||||
if (empty($articleDataSet)) {
|
||||
return $result;
|
||||
}
|
||||
foreach ($articleDataSet as $articleData) {
|
||||
$article = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
|
||||
$article->setId($articleData['oxid']);
|
||||
foreach ($articleData as $key => $value) {
|
||||
if (strstr($key, "ox")) {
|
||||
$field = "oxarticles__{$key}";
|
||||
$article->$field = new \OxidEsales\Eshop\Core\Field($articleData[$key]);
|
||||
}
|
||||
}
|
||||
$article->save();
|
||||
if ($articleData['scaleprices']) {
|
||||
$this->createScalePrices(array($articleData['scaleprices']));
|
||||
}
|
||||
if ($articleData['field2shop']) {
|
||||
$this->createField2Shop($article, $articleData['field2shop']);
|
||||
}
|
||||
$result[$articleData['oxid']] = array(
|
||||
'id' => $articleData['oxid'],
|
||||
'amount' => $articleData['amount'],
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create user
|
||||
*
|
||||
* @param array $userData user data
|
||||
*
|
||||
* @return \OxidEsales\Eshop\Application\Model\User
|
||||
*/
|
||||
protected function createUser($userData)
|
||||
{
|
||||
/** @var \OxidEsales\Eshop\Application\Model\User $user */
|
||||
$user = $this->createObj($userData, \OxidEsales\Eshop\Application\Model\User::class, "oxuser");
|
||||
if (isset($userData['address'])) {
|
||||
$userData['address']['oxuserid'] = $user->getId();
|
||||
$this->createObj($userData['address'], \OxidEsales\Eshop\Application\Model\Address::class, "oxaddress");
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create categories with assigning articles
|
||||
*
|
||||
* @param array $categories category data
|
||||
*/
|
||||
protected function createCats($categories)
|
||||
{
|
||||
if (empty($categories)) {
|
||||
return;
|
||||
}
|
||||
foreach ($categories as $key => $cat) {
|
||||
$cat = $this->createObj($cat, \OxidEsales\Eshop\Application\Model\Category::class, ' oxcategories');
|
||||
if (!empty($cat['oxarticles'])) {
|
||||
$cnt = count($cat['oxarticles']);
|
||||
for ($i = 0; $i < $cnt; $i++) {
|
||||
$data = array(
|
||||
'oxcatnid' => $cat->getId(),
|
||||
'oxobjectid' => $cat['oxarticles'][$i]
|
||||
);
|
||||
$this->createObj2Obj($data, 'oxprice2article');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates price 2 article connection needed for scale prices
|
||||
*
|
||||
* @param array $scalePrices of scale prices needed db fields
|
||||
*/
|
||||
protected function createScalePrices($scalePrices)
|
||||
{
|
||||
$this->createObj2Obj($scalePrices, "oxprice2article");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates price 2 article connection needed for scale prices
|
||||
*
|
||||
* @param \OxidEsales\Eshop\Application\Model\Article $art
|
||||
* @param array $options
|
||||
*/
|
||||
protected function createField2Shop($art, $options)
|
||||
{
|
||||
$field2Shop = oxNew(\OxidEsales\Eshop\Application\Model\Field2Shop::class);
|
||||
$field2Shop->setProductData($art);
|
||||
if (!isset($options['oxartid'])) {
|
||||
$options['oxartid'] = new \OxidEsales\Eshop\Core\Field($art->getId());
|
||||
}
|
||||
foreach ($options as $key => $value) {
|
||||
if (strstr($key, "ox")) {
|
||||
$field = "oxfield2shop__{$key}";
|
||||
$field2Shop->$field = new \OxidEsales\Eshop\Core\Field($options[$key]);
|
||||
}
|
||||
}
|
||||
$field2Shop->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply discounts.
|
||||
* Creates discounts and assign them to according objects.
|
||||
*
|
||||
* @param array $discountDataSet discount data
|
||||
*/
|
||||
public function setDiscounts($discountDataSet)
|
||||
{
|
||||
if (empty($discountDataSet)) {
|
||||
return;
|
||||
}
|
||||
foreach ($discountDataSet as $discountData) {
|
||||
// add discounts
|
||||
$discount = oxNew(\OxidEsales\Eshop\Application\Model\Discount::class);
|
||||
$discount->setId($discountData['oxid']);
|
||||
foreach ($discountData as $key => $value) {
|
||||
if (!is_array($value)) {
|
||||
$field = "oxdiscount__" . $key;
|
||||
$discount->$field = new \OxidEsales\Eshop\Core\Field("{$value}");
|
||||
} // if $value is not empty array then create oxobject2discount
|
||||
$discount->save();
|
||||
if (is_array($value) && !empty($value)) {
|
||||
foreach ($value as $artId) {
|
||||
$data = array(
|
||||
'oxid' => $discount->getId() . "_" . $artId,
|
||||
'oxdiscountid' => $discount->getId(),
|
||||
'oxobjectid' => $artId,
|
||||
'oxtype' => $key
|
||||
);
|
||||
$this->createObj2Obj($data, "oxobject2discount");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates wrappings
|
||||
*
|
||||
* @param array $wrappings
|
||||
*
|
||||
* @return false|array of wrapping id's
|
||||
*/
|
||||
protected function setWrappings($wrappings)
|
||||
{
|
||||
if (empty($wrappings)) {
|
||||
return false;
|
||||
}
|
||||
$wrap = array();
|
||||
foreach ($wrappings as $wrapping) {
|
||||
$card = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
|
||||
$card->init('oxwrapping');
|
||||
foreach ($wrapping as $key => $mxValue) {
|
||||
if (!is_array($mxValue)) {
|
||||
$field = "oxwrapping__" . $key;
|
||||
$card->$field = new \OxidEsales\Eshop\Core\Field($mxValue, \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
}
|
||||
}
|
||||
$card->save();
|
||||
if ($wrapping['oxarticles']) {
|
||||
foreach ($wrapping['oxarticles'] as $artId) {
|
||||
$wrap[$artId] = $card->getId();
|
||||
}
|
||||
} else {
|
||||
$wrap['card'] = $card->getId();
|
||||
}
|
||||
}
|
||||
|
||||
return $wrap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates deliveries
|
||||
*
|
||||
* @param array $deliveryCostDataSet
|
||||
*
|
||||
* @return null|array of delivery id's
|
||||
*/
|
||||
protected function setDeliveryCosts($deliveryCostDataSet)
|
||||
{
|
||||
if (empty($deliveryCostDataSet)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($deliveryCostDataSet['oxdeliveryset'])) {
|
||||
$data = $deliveryCostDataSet['oxdeliveryset'];
|
||||
unset($deliveryCostDataSet['oxdeliveryset']);
|
||||
} else {
|
||||
$data = array(
|
||||
'oxactive' => 1
|
||||
);
|
||||
}
|
||||
$deliverySet = $this->createObj($data, \OxidEsales\Eshop\Application\Model\DeliverySet::class, 'oxdeliveryset');
|
||||
|
||||
foreach ($deliveryCostDataSet as $deliveryCostData) {
|
||||
$delivery = oxNew(\OxidEsales\Eshop\Application\Model\Delivery::class);
|
||||
foreach ($deliveryCostData as $key => $value) {
|
||||
if (!is_array($value)) {
|
||||
$field = "oxdelivery__" . $key;
|
||||
$delivery->$field = new \OxidEsales\Eshop\Core\Field("{$value}");
|
||||
}
|
||||
}
|
||||
$delivery->save();
|
||||
$data = array(
|
||||
'oxdelid' => $delivery->getId(),
|
||||
'oxdelsetid' => $deliverySet->getId(),
|
||||
);
|
||||
$this->createObj2Obj($data, "oxdel2delset");
|
||||
}
|
||||
|
||||
return $deliverySet->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates payments
|
||||
*
|
||||
* @param array $paymentDataSet
|
||||
*
|
||||
* @return false|array of payment id's
|
||||
*/
|
||||
protected function setPayments($paymentDataSet)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
if (empty($paymentDataSet)) {
|
||||
return false;
|
||||
}
|
||||
$payments = array();
|
||||
foreach ($paymentDataSet as $paymentData) {
|
||||
// add discounts
|
||||
$payment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
|
||||
if (isset($paymentData['oxid'])) {
|
||||
$payment->setId($paymentData['oxid']);
|
||||
}
|
||||
foreach ($paymentData as $key => $value) {
|
||||
if (!is_array($value)) {
|
||||
$field = "oxpayments__" . $key;
|
||||
$payment->$field = new \OxidEsales\Eshop\Core\Field("{$value}");
|
||||
}
|
||||
}
|
||||
$payment->save();
|
||||
$result[] = $payment->getId();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates voucherserie and it's vouchers
|
||||
*
|
||||
* @param array $voucherSeriesDataSet voucherserie and voucher data
|
||||
*
|
||||
* @return array of voucher id's
|
||||
*/
|
||||
protected function setVouchers($voucherSeriesDataSet)
|
||||
{
|
||||
$voucherIDs = array();
|
||||
|
||||
$voucherSeriesDataSet = (array) $voucherSeriesDataSet;
|
||||
foreach ($voucherSeriesDataSet as $voucherSeriesData) {
|
||||
$voucherSeries = oxNew('oxBase');
|
||||
$voucherSeries->init('oxvoucherseries');
|
||||
foreach ($voucherSeriesData as $key => $value) {
|
||||
$field = "oxvoucherseries__" . $key;
|
||||
$voucherSeries->$field = new \oxField($value, \oxField::T_RAW);
|
||||
}
|
||||
$voucherSeries->save();
|
||||
// inserting vouchers
|
||||
for ($i = 1; $i <= $voucherSeriesData['voucher_count']; $i++) {
|
||||
$data = array(
|
||||
'oxreserved' => 0,
|
||||
'oxvouchernr' => md5(uniqid(rand(), true)),
|
||||
'oxvoucherserieid' => $voucherSeries->getId()
|
||||
);
|
||||
$voucher = $this->createObj($data, 'oxvoucher', 'oxvouchers');
|
||||
$voucherIDs[] = $voucher->getId();
|
||||
}
|
||||
}
|
||||
|
||||
return $voucherIDs;
|
||||
}
|
||||
|
||||
protected function getDefaultUserData()
|
||||
{
|
||||
$user = array(
|
||||
'oxid' => 'checkoutTestUser',
|
||||
'oxrights' => 'malladmin',
|
||||
'oxactive' => '1',
|
||||
'oxusername' => 'admin',
|
||||
'oxpassword' => 'f6fdffe48c908deb0f4c3bd36c032e72',
|
||||
'oxpasssalt' => '61646D696E',
|
||||
'oxcompany' => 'Your Company Name',
|
||||
'oxfname' => 'John',
|
||||
'oxlname' => 'Doe',
|
||||
'oxstreet' => 'Maple Street',
|
||||
'oxstreetnr' => '10',
|
||||
'oxcity' => 'Any City',
|
||||
'oxcountryid' => 'a7c40f631fc920687.20179984',
|
||||
'oxzip' => '9041',
|
||||
'oxfon' => '217-8918712',
|
||||
'oxfax' => '217-8918713',
|
||||
'oxstateid' => null,
|
||||
'oxaddinfo' => null,
|
||||
'oxustid' => null,
|
||||
'oxsal' => 'MR',
|
||||
'oxustidstatus' => '0',
|
||||
);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
protected function getDefaultGroupsData()
|
||||
{
|
||||
$group = array(
|
||||
0 => array(
|
||||
'oxid' => 'checkoutTestGroup',
|
||||
'oxactive' => 1,
|
||||
'oxtitle' => 'checkoutTestGroup',
|
||||
'oxobject2group' => array('checkoutTestUser', 'oxidpaypal'),
|
||||
),
|
||||
);
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting articles
|
||||
*
|
||||
* @param array $arts of article objects
|
||||
*
|
||||
* @return created articles id's
|
||||
*/
|
||||
public function getArticles($arts)
|
||||
{
|
||||
return $this->_getArticles($arts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply discounts
|
||||
*
|
||||
* @param array $discounts of discount data
|
||||
*/
|
||||
public function DELETEsetDiscounts($discounts)
|
||||
{
|
||||
$this->setDiscounts($discounts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object 2 object connection in databse
|
||||
*
|
||||
* @param array $data db fields and values
|
||||
* @param string $obj2ObjTable table name
|
||||
*/
|
||||
public function createObj2Obj($data, $obj2ObjTable)
|
||||
{
|
||||
if (empty($data)) {
|
||||
return;
|
||||
}
|
||||
$count = count($data);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($obj2ObjTable === 'oxobject2group') {
|
||||
$object = oxNew(\OxidEsales\Eshop\Application\Model\Object2Group::class);
|
||||
} else {
|
||||
$object = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
|
||||
}
|
||||
$object->init($obj2ObjTable);
|
||||
if ($count < 2) {
|
||||
$objectData = $data[$i];
|
||||
} else {
|
||||
$objectData = $data;
|
||||
}
|
||||
foreach ($objectData as $key => $value) {
|
||||
$field = $obj2ObjTable . "__" . $key;
|
||||
$object->$field = new \OxidEsales\Eshop\Core\Field($value, \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
}
|
||||
$object->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create group and assign
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function createGroups($data)
|
||||
{
|
||||
if (empty($data)) {
|
||||
return;
|
||||
}
|
||||
foreach ($data as $key => $groupData) {
|
||||
$group = $this->createObj($groupData, \OxidEsales\Eshop\Application\Model\Groups::class, ' oxgroups');
|
||||
if (!empty($groupData['oxobject2group'])) {
|
||||
$cnt = count($groupData['oxobject2group']);
|
||||
for ($i = 0; $i < $cnt; $i++) {
|
||||
$con = array(
|
||||
'oxgroupsid' => $group->getId(),
|
||||
'oxobjectid' => $groupData['oxobject2group'][$i]
|
||||
);
|
||||
$this->createObj2Obj($con, 'oxobject2group');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard object creator
|
||||
*
|
||||
* @param array $data data
|
||||
* @param string $object object name
|
||||
* @param string $table table name
|
||||
*
|
||||
* @return null|object $obj
|
||||
*/
|
||||
public function createObj($data, $object, $table)
|
||||
{
|
||||
if (empty($data)) {
|
||||
return;
|
||||
}
|
||||
$obj = new $object();
|
||||
if ($data['oxid']) {
|
||||
$obj->setId($data['oxid']);
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
if (!is_array($value)) {
|
||||
$field = $table . "__" . $key;
|
||||
$obj->$field = new \OxidEsales\Eshop\Core\Field($value, \OxidEsales\Eshop\Core\Field::T_RAW);
|
||||
}
|
||||
}
|
||||
$obj->save();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create shop.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function createShop($data)
|
||||
{
|
||||
$activeShopId = 1;
|
||||
$shopCnt = count($data);
|
||||
for ($i = 0; $i < $shopCnt; $i++) {
|
||||
$params = array();
|
||||
foreach ($data[$i] as $key => $value) {
|
||||
$field = "oxshops__" . $key;
|
||||
$params[$field] = $value;
|
||||
}
|
||||
$shop = oxNew(\OxidEsales\Eshop\Application\Model\Shop::class);
|
||||
$shop->assign($params);
|
||||
$shop->save();
|
||||
$shop->generateViews();
|
||||
if ($data[$i]['activeshop']) {
|
||||
$activeShopId = $shop->getId();
|
||||
}
|
||||
}
|
||||
|
||||
return $activeShopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting active shop
|
||||
*
|
||||
* @param int $shopId
|
||||
*/
|
||||
public function setActiveShop($shopId)
|
||||
{
|
||||
if ($shopId) {
|
||||
\OxidEsales\Eshop\Core\Registry::getConfig()->setShopId($shopId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration\Library;
|
||||
|
||||
class TestCaseParser
|
||||
{
|
||||
/**
|
||||
* Directory where to search for test cases
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_sDirectory = null;
|
||||
|
||||
/**
|
||||
* Test cases filter. Specify names of cases which should be run
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_aTestCases = array();
|
||||
|
||||
/** @var string */
|
||||
protected $_sTestCasesPath = '';
|
||||
|
||||
/**
|
||||
* Array of replacements for test values.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_aReplacements = array();
|
||||
|
||||
/**
|
||||
* Sets directory to search for test cases
|
||||
*
|
||||
* @param string $directory
|
||||
*/
|
||||
public function setDirectory($directory)
|
||||
{
|
||||
$this->_sDirectory = $directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns directory to search for test cases
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDirectory()
|
||||
{
|
||||
return $this->_sDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets test cases to be run
|
||||
*
|
||||
* @param array $testCases
|
||||
*/
|
||||
public function setTestCases($testCases)
|
||||
{
|
||||
$this->_aTestCases = $testCases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns test cases to be run
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTestCases()
|
||||
{
|
||||
return $this->_aTestCases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Replacement
|
||||
*
|
||||
* @param array $replacements
|
||||
*/
|
||||
public function setReplacements($replacements)
|
||||
{
|
||||
$this->_aReplacements = $replacements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Replacement
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getReplacements()
|
||||
{
|
||||
return $this->_aReplacements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting test cases from specified
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$testCasesData = array();
|
||||
$directory = $this->getDirectory();
|
||||
$testCases = $this->getTestCases();
|
||||
|
||||
$files = $this->getDirectoryTestCasesFiles($directory, $testCases);
|
||||
print(count($files) . " test files found\r\n");
|
||||
foreach ($files as $filename) {
|
||||
$data = $this->getDataFromFile($filename);
|
||||
$data = $this->parseTestData($data);
|
||||
$testCasesData[$filename] = array($data);
|
||||
}
|
||||
|
||||
return $testCasesData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns directory files. If test cases is passed - only those files is checked in given directory
|
||||
*
|
||||
* @param $dir
|
||||
* @param $testCases
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getDirectoryTestCasesFiles($dir, $testCases)
|
||||
{
|
||||
$path = $this->_sTestCasesPath . $dir . "/";
|
||||
print("Scanning dir {$path}\r\n");
|
||||
$files = array();
|
||||
if (empty($testCases)) {
|
||||
$files = $this->getFilesInDirectory($path);
|
||||
} else {
|
||||
foreach ($testCases as $testCase) {
|
||||
$files[] = $path . $testCase;
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns php files list from given directory and all subdirectories
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getFilesInDirectory($path)
|
||||
{
|
||||
$files = array();
|
||||
foreach (new \DirectoryIterator($path) as $file) {
|
||||
if ($file->isDir() && !$file->isDot()) {
|
||||
$files = array_merge($files, $this->getFilesInDirectory($file->getPathname()));
|
||||
}
|
||||
if ($file->isFile() && preg_match('/\.php$/', $file->getFilename())) {
|
||||
$files[] = $file->getPathname();
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads data from file
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getDataFromFile($filename)
|
||||
{
|
||||
$data = array();
|
||||
include($filename);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses given data
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function parseTestData($data)
|
||||
{
|
||||
foreach ($data as &$value) {
|
||||
$value = $this->parseTestValue($value);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses given test case value
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function parseTestValue($value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
return $this->parseTestData($value);
|
||||
}
|
||||
if (is_string($value)) {
|
||||
$replacements = $this->getReplacements();
|
||||
$value = str_replace(array_keys($replacements), $replacements, $value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\PayPalModule\Tests\Integration;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
|
||||
class OrderActionTest extends \OxidEsales\TestingLibrary\UnitTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_orderpaymentcomments`');
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_orderpayments`');
|
||||
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute('DROP TABLE IF EXISTS `oepaypal_order`');
|
||||
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderPaymentsCommentsTable();
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderPaymentsTable();
|
||||
\OxidEsales\PayPalModule\Core\Events::addOrderTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\OrderCaptureAction::process
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Handler\OrderCaptureActionHandler::getPayPalResponse
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Handler\OrderCaptureActionHandler::getPayPalRequest
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Data\OrderCaptureActionData::getAmount
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Data\OrderCaptureActionData::getType
|
||||
*/
|
||||
public function testActionCapture()
|
||||
{
|
||||
$requestParams = array(
|
||||
'capture_amount' => '200.99',
|
||||
'capture_type' => 'Complete'
|
||||
);
|
||||
$responseParams = array(
|
||||
'TRANSACTIONID' => 'TransactionId',
|
||||
'PAYMENTSTATUS' => 'Pending',
|
||||
'AMT' => '99.87',
|
||||
'CURRENCYCODE' => 'EUR',
|
||||
);
|
||||
|
||||
$action = $this->createAction('capture', 'testOrderId', $requestParams, $responseParams);
|
||||
|
||||
$action->process();
|
||||
|
||||
$order = $this->getOrder('testOrderId');
|
||||
$this->assertEquals('99.87', $order->getCapturedAmount());
|
||||
|
||||
$paymentList = $order->getPaymentList()->getArray();
|
||||
$this->assertEquals(1, count($paymentList));
|
||||
|
||||
$payment = array_shift($paymentList);
|
||||
$this->assertEquals('capture', $payment->getAction());
|
||||
$this->assertEquals('testOrderId', $payment->getOrderId());
|
||||
$this->assertEquals('99.87', $payment->getAmount());
|
||||
$this->assertEquals('Pending', $payment->getStatus());
|
||||
$this->assertEquals('EUR', $payment->getCurrency());
|
||||
|
||||
$payment->delete();
|
||||
$order->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\OrderRefundAction::process
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Handler\OrderRefundActionHandler::getPayPalResponse
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Handler\OrderRefundActionHandler::getPayPalRequest
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Data\OrderRefundActionData::getAmount
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Data\OrderRefundActionData::getType
|
||||
*/
|
||||
public function testActionRefund()
|
||||
{
|
||||
$requestParams = array(
|
||||
'refund_amount' => '10',
|
||||
'refund_type' => 'Complete',
|
||||
'transaction_id' => 'capturedTransaction'
|
||||
);
|
||||
$responseParams = array(
|
||||
'REFUNDTRANSACTIONID' => 'TransactionId',
|
||||
'REFUNDSTATUS' => 'Pending',
|
||||
'GROSSREFUNDAMT' => '9.01',
|
||||
'CURRENCYCODE' => 'EUR',
|
||||
);
|
||||
|
||||
$capturedPayment = new \OxidEsales\PayPalModule\Model\OrderPayment();
|
||||
$capturedPayment->setOrderId('testOrderId');
|
||||
$capturedPayment->setTransactionId('capturedTransaction');
|
||||
$capturedPayment->save();
|
||||
|
||||
$action = $this->createAction('refund', 'testOrderId', $requestParams, $responseParams);
|
||||
|
||||
$action->process();
|
||||
|
||||
$order = $this->getOrder('testOrderId');
|
||||
$this->assertEquals('9.01', $order->getRefundedAmount());
|
||||
|
||||
$paymentList = $order->getPaymentList()->getArray();
|
||||
$this->assertEquals(2, count($paymentList));
|
||||
|
||||
$payment = array_shift($paymentList);
|
||||
$this->assertEquals('refund', $payment->getAction());
|
||||
$this->assertEquals('testOrderId', $payment->getOrderId());
|
||||
$this->assertEquals('9.01', $payment->getAmount());
|
||||
$this->assertEquals('Pending', $payment->getStatus());
|
||||
$this->assertEquals('EUR', $payment->getCurrency());
|
||||
|
||||
$capturedPayment = array_shift($paymentList);
|
||||
$this->assertEquals('9.01', $capturedPayment->getRefundedAmount());
|
||||
|
||||
$payment->delete();
|
||||
$capturedPayment->delete();
|
||||
$order->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers oePayPalOrderReauthorizeAction::process
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Handler\OrderReauthorizeActionHandler::getPayPalResponse
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Handler\OrderReauthorizeActionHandler::getPayPalRequest
|
||||
*/
|
||||
public function ___testActionReauthorize()
|
||||
{
|
||||
$responseParams = array(
|
||||
'AUTHORIZATIONID' => 'AuthorizationId',
|
||||
'PAYMENTSTATUS' => 'Complete',
|
||||
);
|
||||
|
||||
$action = $this->createAction('reauthorize', 'testOrderId', array(), $responseParams);
|
||||
$action->process();
|
||||
|
||||
$order = $this->getOrder('testOrderId');
|
||||
|
||||
$paymentList = $order->getPaymentList()->getArray();
|
||||
$this->assertEquals(1, count($paymentList));
|
||||
|
||||
$payment = array_shift($paymentList);
|
||||
$this->assertEquals('re-authorization', $payment->getAction());
|
||||
$this->assertEquals('testOrderId', $payment->getOrderId());
|
||||
$this->assertEquals('0.00', $payment->getAmount());
|
||||
$this->assertEquals('Complete', $payment->getStatus());
|
||||
|
||||
$payment->delete();
|
||||
$order->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\OrderVoidAction::process
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Handler\OrderVoidActionHandler::getPayPalResponse
|
||||
* @covers \OxidEsales\PayPalModule\Model\Action\Handler\OrderVoidActionHandler::getPayPalRequest
|
||||
*/
|
||||
public function testActionVoid()
|
||||
{
|
||||
$responseParams = array(
|
||||
'AUTHORIZATIONID' => 'AuthorizationId',
|
||||
);
|
||||
|
||||
$action = $this->createAction('void', 'testOrderId', array(), $responseParams);
|
||||
$action->process();
|
||||
|
||||
$order = $this->getOrder('testOrderId');
|
||||
|
||||
$paymentList = $order->getPaymentList()->getArray();
|
||||
$this->assertEquals(1, count($paymentList));
|
||||
|
||||
$payment = array_shift($paymentList);
|
||||
$this->assertEquals('void', $payment->getAction());
|
||||
$this->assertEquals('testOrderId', $payment->getOrderId());
|
||||
$this->assertEquals('0.00', $payment->getAmount());
|
||||
$this->assertEquals('Voided', $payment->getStatus());
|
||||
|
||||
$payment->delete();
|
||||
$order->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns loaded \OxidEsales\PayPalModule\Model\Action\OrderAction object
|
||||
*
|
||||
* @param string $action
|
||||
* @param string $orderId
|
||||
* @param array $requestParams
|
||||
* @param array $responseParams
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\Action\OrderAction
|
||||
*/
|
||||
protected function createAction($action, $orderId, $requestParams, $responseParams)
|
||||
{
|
||||
$order = $this->getOrder($orderId);
|
||||
$request = $this->getRequestHelper()->getRequest($requestParams);
|
||||
|
||||
$actionFactory = $this->getActionFactory($request, $order);
|
||||
$action = $actionFactory->createAction($action);
|
||||
|
||||
$service = $this->getPayPalCommunicationHelper()->getCaller($responseParams);
|
||||
$captureHandler = $action->getHandler();
|
||||
$captureHandler->setPayPalService($service);
|
||||
|
||||
return $action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OxidEsales\PayPalModule\Tests\Integration\Library\RequestHelper
|
||||
*/
|
||||
protected function getRequestHelper()
|
||||
{
|
||||
return new \OxidEsales\PayPalModule\Tests\Integration\Library\RequestHelper();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OxidEsales\PayPalModule\Tests\Integration\Library\CommunicationHelper
|
||||
*/
|
||||
protected function getPayPalCommunicationHelper()
|
||||
{
|
||||
return new \OxidEsales\PayPalModule\Tests\Integration\Library\CommunicationHelper();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns loaded \OxidEsales\PayPalModule\Model\PayPalOrder object with given id
|
||||
*
|
||||
* @param string $orderId
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\PayPalOrder
|
||||
*/
|
||||
protected function getOrder($orderId)
|
||||
{
|
||||
$order = new \OxidEsales\PayPalModule\Model\PayPalOrder();
|
||||
$order->setOrderId($orderId);
|
||||
$order->load();
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OxidEsales\PayPalModule\Core\Request $request
|
||||
* @param \OxidEsales\PayPalModule\Model\PayPalOrder $payPalOrder
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\Action\OrderActionFactory
|
||||
*/
|
||||
protected function getActionFactory($request, $payPalOrder)
|
||||
{
|
||||
$order = $this->_createStub(Order::class, array('getPayPalOrder' => $payPalOrder));
|
||||
|
||||
$actionFactory = new \OxidEsales\PayPalModule\Model\Action\OrderActionFactory($request, $order);
|
||||
|
||||
return $actionFactory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of O3-Shop Paypal module.
|
||||
*
|
||||
* O3-Shop is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* O3-Shop is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com)
|
||||
* @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
namespace OxidEsales\Eshop\PayPalModule\Tests\Integration;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Basket;
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
use OxidEsales\PayPalModule\Tests\Unit\AdminUserTrait;
|
||||
|
||||
class OrderFinalizationTest extends \OxidEsales\TestingLibrary\UnitTestCase
|
||||
{
|
||||
use AdminUserTrait;
|
||||
|
||||
public function providerFinalizeOrder_TransStatusNotChange()
|
||||
{
|
||||
/** @var \OxidEsales\PayPalModule\Model\Order $order */
|
||||
$order = oxNew(Order::class);
|
||||
return array(
|
||||
array('Pending', $order::OEPAYPAL_TRANSACTION_STATUS_NOT_FINISHED),
|
||||
array('Failed', $order::OEPAYPAL_TRANSACTION_STATUS_NOT_FINISHED),
|
||||
array('Complete', $order::OEPAYPAL_TRANSACTION_STATUS_OK)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* After order is finalized and PayPal order status is not 'complete',
|
||||
* order transaction status should also stay 'NOT FINISHED'.
|
||||
*
|
||||
* @dataProvider providerFinalizeOrder_TransStatusNotChange
|
||||
*
|
||||
* @param string $payPalReturnStatus
|
||||
* @param string $transactionStatus
|
||||
*/
|
||||
public function testFinalizeOrder_TransactionStatus($payPalReturnStatus, $transactionStatus)
|
||||
{
|
||||
$this->getSession()->setVariable('sess_challenge', '_testOrderId');
|
||||
$this->getSession()->setVariable('paymentid', 'oxidpaypal');
|
||||
|
||||
/** @var \OxidEsales\PayPalModule\Model\Basket $basket */
|
||||
$basket = oxNew(Basket::class);
|
||||
|
||||
$paymentGateway = $this->getPaymentGateway($payPalReturnStatus);
|
||||
|
||||
/** @var \OxidEsales\PayPalModule\Model\Order $order */
|
||||
$mockBuilder = $this->getMockBuilder(Order::class);
|
||||
$mockBuilder->setMethods(['_getGateway', '_sendOrderByEmail', 'validateOrder']);
|
||||
$order = $mockBuilder->getMock();
|
||||
$order->expects($this->any())->method('_getGateway')->will($this->returnValue($paymentGateway));
|
||||
|
||||
$order->setId('_testOrderId');
|
||||
$order->finalizeOrder($basket, $this->getUser());
|
||||
|
||||
$updatedOrder = oxNew(Order::class);
|
||||
$updatedOrder->load('_testOrderId');
|
||||
$this->assertEquals($transactionStatus, $updatedOrder->getFieldData('oxtransstatus'));
|
||||
$updatedOrder->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Payment Gateway with mocked PayPal call. Result returns provided return status.
|
||||
*
|
||||
* @param string $payPalReturnStatus
|
||||
*
|
||||
* @return \OxidEsales\PayPalModule\Model\PaymentGateway
|
||||
*/
|
||||
protected function getPaymentGateway($payPalReturnStatus)
|
||||
{
|
||||
/** @var \OxidEsales\PayPalModule\Model\Response\ResponseDoExpressCheckoutPayment $result */
|
||||
$result = oxNew(\OxidEsales\PayPalModule\Model\Response\ResponseDoExpressCheckoutPayment::class);
|
||||
$result->setData(array('PAYMENTINFO_0_PAYMENTSTATUS' => $payPalReturnStatus));
|
||||
|
||||
/** @var \OxidEsales\PayPalModule\Core\PayPalService $service */
|
||||
$mockBuilder = $this->getMockBuilder(\OxidEsales\PayPalModule\Core\PayPalService::class);
|
||||
$mockBuilder->setMethods(['doExpressCheckoutPayment']);
|
||||
$service = $mockBuilder->getMock();
|
||||
$service->expects($this->any())->method('doExpressCheckoutPayment')->will($this->returnValue($result));
|
||||
|
||||
/** @var \OxidEsales\PayPalModule\Model\PaymentGateway $payPalPaymentGateway */
|
||||
$payPalPaymentGateway = oxNew(\OxidEsales\Eshop\Application\Model\PaymentGateway::class);
|
||||
$payPalPaymentGateway->setPayPalCheckoutService($service);
|
||||
|
||||
return $payPalPaymentGateway;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OxidEsales\PayPalModule\Model\User
|
||||
*/
|
||||
protected function getUser()
|
||||
{
|
||||
/** @var \OxidEsales\PayPalModule\Model\User $user */
|
||||
$user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
|
||||
$user->load('oxdefaultadmin');
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user