Skip to content

Commit

Permalink
Update acceptNotification method
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardjke committed Feb 13, 2022
1 parent 830cafb commit f7527d3
Show file tree
Hide file tree
Showing 7 changed files with 399 additions and 517 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "leonardjke/omnipay-yoomoney",
"type": "library",
"description": "YooMoney driver for Omnipay PHP payment library",
"description": "Yoomoney driver for Omnipay PHP payment library",
"keywords": [
"php",
"omnipay",
Expand Down
150 changes: 10 additions & 140 deletions src/Gateway.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
<?php
/**
* Yandex.Money driver for Omnipay PHP payment library
*
* @link https://github.com/hiqdev/omnipay-yandexmoney
* @package omnipay-yandexmoney
* @license MIT
* @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
*/

namespace Omnipay\Yoomoney;

use Omnipay\Common\AbstractGateway;
use Omnipay\Yoomoney\Message\CompletePurchaseRequest;
use Omnipay\Yoomoney\Message\PurchaseRequest;
use Omnipay\Yoomoney\Message\ServerNotifyRequest;
use Omnipay\Yoomoney\Message\NotificationRequest;
use Omnipay\Yoomoney\Traits\Parametrable;

/**
* @method \Omnipay\Common\Message\RequestInterface authorize(array $options = [])
Expand All @@ -28,6 +21,8 @@
*/
class Gateway extends AbstractGateway
{
use Parametrable;

public function getName()
{
return 'Yoomoney';
Expand All @@ -39,9 +34,12 @@ public function getDefaultParameters()
'secret' => '',
'receiver' => '',
'quickpay_form' => 'shop',
// shop — для универсальной формы, small — для кнопки, donate — для «благотворительной» формы
'payment_type' => 'PC',
// PC - оплата из кошелька ЮMoney, AC - с банковской карты, MC - с баланса мобильного
'success_url' => null,
'targets' => null,
// Необязательный параметр (название магазина)
'need_fio' => false,
'need_email' => false,
'need_phone' => false,
Expand All @@ -50,121 +48,6 @@ public function getDefaultParameters()
];
}

public function setSecret($value)
{
return $this->setParameter('secret', $value);
}

public function getSecret()
{
return $this->getParameter('secret');
}

public function setReceiver($value)
{
return $this->setParameter('receiver', $value);
}

public function getReceiver()
{
return $this->getParameter('receiver');
}

/**
* @param string $value shop — для универсальной формы, small — для кнопки, donate — для «благотворительной» формы
*
* @return Gateway
*/
public function setQuickpayForm($value)
{
return $this->setParameter('quickpay_form', $value);
}

public function getQuickpayForm()
{
return $this->getParameter('quickpay_form');
}

/**
* @param string $value PC - оплата из кошелька ЮMoney, AC - с банковской карты, MC - с баланса мобильного
*
* @return Gateway
*/
public function setPaymentType($value)
{
return $this->setParameter('payment_type', $value);
}

public function getPaymentType()
{
return $this->getParameter('payment_type');
}

public function setSuccessUrl($value)
{
return $this->setParameter('success_url', $value);
}

public function getSuccessUrl()
{
return $this->getParameter('success_url');
}

public function setNeedFio($value)
{
return $this->setParameter('need_fio', $value);
}

public function getNeedFio()
{
return $this->getParameter('need_fio');
}

public function setNeedEmail($value)
{
return $this->setParameter('need_email', $value);
}

public function getNeedEmail()
{
return $this->getParameter('need_email');
}

public function setNeedPhone($value)
{
return $this->setParameter('need_phone', $value);
}

public function getNeedPhone()
{
return $this->getParameter('need_phone');
}

public function setNeedAddress($value)
{
return $this->setParameter('need_address', $value);
}

public function getNeedAddress()
{
return $this->getParameter('need_address');
}

/**
* @param string $value Необязательный параметр (название магазина)
*
* @return Gateway
*/
public function setTargets($value)
{
return $this->setParameter('targets', $value);
}

public function getTargets()
{
return $this->getParameter('targets');
}

/**
* @param array $parameters
*
Expand All @@ -191,24 +74,11 @@ public function completePurchase(array $parameters = [])
* Handle notification callback.
* Replaces completeAuthorize() and completePurchase()
*
* @return \Omnipay\Common\Message\AbstractRequest|ServerNotifyRequest
* @return \Omnipay\Common\Message\NotificationInterface
*/
public function acceptNotification(array $parameters = array())
public function acceptNotification(array $parameters = [])
{
return $this->createRequest(ServerNotifyRequest::class, $parameters);
return $this->createRequest(NotificationRequest::class, $parameters);
}


public function __call1($name, $arguments)
{
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface authorize(array $options = array())
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface completeAuthorize(array $options = array())
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface capture(array $options = array())
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface refund(array $options = array())
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface fetchTransaction(array $options = [])
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface void(array $options = array())
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface createCard(array $options = array())
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface updateCard(array $options = array())
// TODO: Implement @method \Omnipay\Common\Message\RequestInterface deleteCard(array $options = array())
}
}
119 changes: 3 additions & 116 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,129 +3,16 @@
namespace Omnipay\Yoomoney\Message;

use Omnipay\Common\Message\AbstractRequest as OmnipayRequest;
use Omnipay\Yoomoney\Traits\Parametrable;

abstract class AbstractRequest extends OmnipayRequest
{
use Parametrable;

public $endpoint = 'https://yoomoney.ru/quickpay/confirm.xml';

public function getEndpoint()
{
return $this->endpoint;
}

public function setSecret($value)
{
return $this->setParameter('secret', $value);
}

public function getSecret()
{
return $this->getParameter('secret');
}

public function setReceiver($value)
{
return $this->setParameter('receiver', $value);
}

public function getReceiver()
{
return $this->getParameter('receiver');
}

/**
* @param string $value shop — для универсальной формы, small — для кнопки, donate — для «благотворительной» формы
*
* @return AbstractRequest
*/
public function setQuickpayForm($value)
{
return $this->setParameter('quickpay_form', $value);
}

public function getQuickpayForm()
{
return $this->getParameter('quickpay_form');
}

/**
* @param string $value PC - оплата из кошелька ЮMoney, AC - с банковской карты, MC - с баланса мобильного
*
* @return AbstractRequest
*/
public function setPaymentType($value)
{
return $this->setParameter('payment_type', $value);
}

public function getPaymentType()
{
return $this->getParameter('payment_type');
}

public function setSuccessUrl($value)
{
return $this->setParameter('success_url', $value);
}

public function setReturnUrl($value)
{
return $this->setParameter('success_url', $value);
}

public function getSuccessUrl()
{
return $this->getParameter('success_url');
}

public function setNeedFio($value)
{
return $this->setParameter('need_fio', $value);
}

public function getNeedFio()
{
return $this->getParameter('need_fio');
}

public function setNeedEmail($value)
{
return $this->setParameter('need_email', $value);
}

public function getNeedEmail()
{
return $this->getParameter('need_email');
}

public function setNeedPhone($value)
{
return $this->setParameter('need_phone', $value);
}

public function getNeedPhone()
{
return $this->getParameter('need_phone');
}

public function setNeedAddress($value)
{
return $this->setParameter('need_address', $value);
}

public function getNeedAddress()
{
return $this->getParameter('need_address');
}

public function setTargets($value)
{
return $this->setParameter('targets', $value);
}

public function getTargets()
{
return $this->getParameter('targets');
}

}
Loading

0 comments on commit f7527d3

Please sign in to comment.