116 lines
4.0 KiB
PHP
116 lines
4.0 KiB
PHP
<?php
|
|
|
|
// class PayPalWebhookTest extends DatabaseTestCase
|
|
// {
|
|
// /** @var \Symfony\Bundle\FrameworkBundle\Client */
|
|
// private $client;
|
|
//
|
|
// /**
|
|
// * {@inheritdoc}
|
|
// */
|
|
// public static function setUpBeforeClass()
|
|
// {
|
|
// parent::setUpBeforeClass();
|
|
//
|
|
// if (!class_exists('PayPal\Rest\ApiContext')) {
|
|
// self::markTestSkipped('PayPal not installed');
|
|
// }
|
|
// }
|
|
//
|
|
// protected function setUp(): void
|
|
// {
|
|
// parent::setUp();
|
|
//
|
|
// $this->client = $this->createClient();
|
|
//
|
|
// $cfg = &\KupShop\KupShopBundle\Config::get();
|
|
// $cfg['Modules']['payments']['PayPal'] = [
|
|
// 'clientID' => 'AaCvpUIjFL3MBl5CwPl7AiaTpLxuhBk3egE3Iq_GvC676KQ3XaumV4RHkFHl_lgeu32dSkXFpt4cq33a',
|
|
// 'secret' => 'EF_Txa5Oz-_9My-8RTQI6RtNpLil1happlO-4CXl0uKNEvephPwZu_8K_bfpTWR49ZcjfGOVLgaDysMo',
|
|
// 'mode' => 'sandbox',
|
|
// 'enableLog' => false,
|
|
// ];
|
|
// }
|
|
//
|
|
// protected function getDataSet()
|
|
// {
|
|
// return $this->getJsonDataSet('{
|
|
// "orders": [
|
|
// {
|
|
// "id":116452,
|
|
// "order_no":"0391703582",
|
|
// "currency":"EUR",
|
|
// "currency_rate":"1.0000",
|
|
// "id_user":null,
|
|
// "date_created":"2017-08-10 12:05:00",
|
|
// "date_accept":"2017-08-10 12:07:12",
|
|
// "date_handle":null,
|
|
// "date_updated":"2017-08-10 12:07:12",
|
|
// "date_due":null,
|
|
// "status":1,
|
|
// "status_payed":1,
|
|
// "status_dispatch":0,
|
|
// "status_storno":0,
|
|
// "total_price":"6.5000",
|
|
// "invoice_name":"Oldřich",
|
|
// "invoice_surname":"Válek",
|
|
// "invoice_firm":"",
|
|
// "invoice_ico":"",
|
|
// "invoice_dic":"",
|
|
// "invoice_street":"Ulice 24",
|
|
// "invoice_city":"Tak určitě",
|
|
// "invoice_zip":4260,
|
|
// "invoice_country":"SI",
|
|
// "invoice_phone":12345678,
|
|
// "invoice_email":"oldrich@wpj.cz",
|
|
// "delivery_name":"Oldřich",
|
|
// "delivery_surname":"Válek",
|
|
// "delivery_firm":"",
|
|
// "delivery_street":"Ulice 24",
|
|
// "delivery_city":"Tak určitě",
|
|
// "delivery_zip":4260,
|
|
// "delivery_country":"SI",
|
|
// "delivery_type":"PayPal - GLS",
|
|
// "id_delivery":6,
|
|
// "delivery_complete":"",
|
|
// "note_user":"TEST",
|
|
// "note_admin":"{\"payment_data\":[],\"conversion_sent\":1}",
|
|
// "flags":"R",
|
|
// "admin":null
|
|
// }
|
|
// ],
|
|
// "order_payments": [
|
|
// {
|
|
// "id":2654,
|
|
// "id_order":116452,
|
|
// "price":"6.5000",
|
|
// "date":"2017-08-10 12:07:12",
|
|
// "note":"Platba modulu PayPal",
|
|
// "status":1,
|
|
// "payment_data":"{\"session\":\"PAY-8M960553FR6478113LGGEYQA\"}",
|
|
// "admin":null,
|
|
// "method":8
|
|
// }
|
|
// ]
|
|
// }');
|
|
// }
|
|
//
|
|
// public function testPayPalWebhook()
|
|
// {
|
|
// $payment = $this->selectSQL('order_payments', ['id' => 2654])->fetch();
|
|
// $this->assertSame('1', $payment['status']);
|
|
//
|
|
// $this->client->request(
|
|
// 'POST',
|
|
// '/platby/PayPal/10/',
|
|
// [],
|
|
// [],
|
|
// [],
|
|
// file_get_contents(__DIR__.'/PayPalWebhookRequestData.json')
|
|
// );
|
|
//
|
|
// $payment = $this->selectSQL('order_payments', ['id' => 2654])->fetch();
|
|
// $this->assertSame('0', $payment['status']);
|
|
// }
|
|
// }
|