first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
<?php
/** Dependencies: `composer require dodo-it/omnipay-wspay:dev-master */
class WsPay extends \KupShop\OrderingBundle\OmniPay
{
public static $name = 'WsPay platební brána';
public $class = 'WsPay';
public $method;
protected $pay_method = Payment::METHOD_COD;
public static function getOmnipayName(): string
{
return 'WsPay';
}
public static function getSettingsConfiguration(): array
{
return [
'fields' => [
'shopID' => [
'title' => 'Shop ID',
'type' => 'text',
],
'secretKey' => [
'title' => 'Secret key',
'type' => 'text',
],
],
];
}
/**
* @param Omnipay\WsPay\Gateway $gateway
*/
public function configureGateway(Omnipay\Common\GatewayInterface $gateway, Order $order): Omnipay\Common\GatewayInterface
{
$gateway->setTestMode(false);
if (isDevelopment()) {
$gateway->setTestMode(true);
}
$returnUrl = $this->getGenericPaymentUrl(5);
$totalAmount = str_replace('.', ',', $order->total_price->printFloatValue(2));
$gateway
->setShopId($this->config['shopID'])
->setSecretKey($this->config['secretKey'])
->setShoppingCartId($order->order_no)
->setSignature($this->config['shopID'], $this->config['secretKey'], $order->order_no, $totalAmount)
->setTotalAmount($totalAmount)
->setCurrency($order->getCurrency())
->setReturnUrl($returnUrl)
->setReturnErrorURL($returnUrl)
->setCancelURL($returnUrl)
->setLang($order->getLanguage())
->setCustomerEmail($this->order->invoice_email)
->setCustomerFirstName($this->order->invoice_name)
->setCustomerLastName($this->order->invoice_surname)
->setCustomerCountry($this->order->invoice_country)
->setCustomerCity($this->order->invoice_city)
->setCustomerAddress($this->order->invoice_street)
->setCustomerZIP($this->order->invoice_zip)
->setCustomerPhone($this->order->invoice_phone);
return $gateway;
}
public function hasOnlinePayment()
{
return true;
}
}