Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioMadness committed Dec 12, 2017
2 parents 9a29f7a + a7fd66b commit 8417148
Show file tree
Hide file tree
Showing 12 changed files with 526 additions and 329 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "professionalweb/payment-laravel",
"version": "2.1.3",
"version": "2.1.4",
"description": "Payment drivers for laravel",
"homepage": "http://web-development.pw/",
"keywords": [
Expand Down
24 changes: 14 additions & 10 deletions src/Payment.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace professionalweb\payment;

use Illuminate\Contracts\Support\Arrayable;
use professionalweb\payment\contracts\PayService;
use professionalweb\payment\contracts\PayProtocol;
use professionalweb\payment\contracts\PaymentFacade;
Expand Down Expand Up @@ -34,14 +35,15 @@ class Payment implements PaymentFacade
/**
* Pay
*
* @param int $orderId
* @param int $paymentId
* @param float $amount
* @param string $currency
* @param string $successReturnUrl
* @param string $failReturnUrl
* @param string $description
* @param array $extraParams
* @param int $orderId
* @param int $paymentId
* @param float $amount
* @param string $currency
* @param string $successReturnUrl
* @param string $failReturnUrl
* @param string $description
* @param array $extraParams
* @param Arrayable $receipt
*
* @return string
*/
Expand All @@ -52,7 +54,8 @@ public function getPaymentLink($orderId,
$successReturnUrl = '',
$failReturnUrl = '',
$description = '',
$extraParams = [])
$extraParams = [],
$receipt = null)
{
return $this->getCurrentDriver()->getPaymentLink($orderId,
$paymentId,
Expand All @@ -61,7 +64,8 @@ public function getPaymentLink($orderId,
$successReturnUrl,
$failReturnUrl,
$description,
$extraParams);
$extraParams,
$receipt);
}

/**
Expand Down
13 changes: 8 additions & 5 deletions src/contracts/PayService.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace professionalweb\payment\contracts;

use Illuminate\Http\Response;
use Illuminate\Contracts\Support\Arrayable;

/**
* Interface payment service
Expand All @@ -24,14 +25,15 @@ public function getName();
/**
* Pay
*
* @param int $orderId
* @param int $paymentId
* @param float $amount
* @param int $orderId
* @param int $paymentId
* @param float $amount
* @param string $currency
* @param string $successReturnUrl
* @param string $failReturnUrl
* @param string $description
* @param array $extraParams
* @param array $extraParams
* @param Arrayable $receipt
*
* @return string
*/
Expand All @@ -42,7 +44,8 @@ public function getPaymentLink($orderId,
$successReturnUrl = '',
$failReturnUrl = '',
$description = '',
$extraParams = []);
$extraParams = [],
$receipt = null);

/**
* Validate request
Expand Down
4 changes: 3 additions & 1 deletion src/drivers/payonline/PayOnlineDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function __construct($config)
* @param string $failReturnUrl
* @param string $description
* @param array $extraParams
* @param object $receipt
*
* @return string
*/
Expand All @@ -56,7 +57,8 @@ public function getPaymentLink($orderId,
$successReturnUrl = '',
$failReturnUrl = '',
$description = '',
$extraParams = [])
$extraParams = [],
$receipt = null)
{
if (empty($successReturnUrl)) {
$successReturnUrl = $this->getConfig()['successURL'];
Expand Down
126 changes: 126 additions & 0 deletions src/drivers/receipt/Receipt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?php namespace professionalweb\payment\drivers\receipt;

use Illuminate\Contracts\Support\Arrayable;

abstract class Receipt implements Arrayable
{
/**
* Phone number or e-mail
*
* @var string
*/
private $contact;

/**
* Tax system
* Система налогообложения магазина (СНО). Параметр необходим, только если у вас несколько систем налогообложения. В остальных случаях не передается.
*
* @var int
*/
private $taxSystem;

/**
* Items
*
* @var ReceiptItem[]
*/
private $items = [];

/**
* Receipt constructor.
*
* @param string $contact
* @param array|null $items
* @param int $taxSystem
*/
public function __construct($contact = null, array $items = [], $taxSystem = null)
{
$this->setContact($contact)->setItems($items)->setTaxSystem($taxSystem);
}

/**
* Get contact
*
* @return string
*/
public function getContact()
{
return $this->contact;
}

/**
* Set contact
*
* @param string $contact
*
* @return $this
*/
public function setContact($contact)
{
$this->contact = $contact;

return $this;
}

/**
* Get tax system
*
* @return int
*/
public function getTaxSystem()
{
return $this->taxSystem;
}

/**
* Set tax system
*
* @param int $taxSystem
*
* @return $this
*/
public function setTaxSystem($taxSystem)
{
$this->taxSystem = $taxSystem;

return $this;
}

/**
* Get all items in receipt
*
* @return ReceiptItem[]
*/
public function getItems()
{
return $this->items;
}

/**
* Set items in receipt
*
* @param ReceiptItem[] $items
*
* @return $this
*/
public function setItems(array $items)
{
$this->items = $items;

return $this;
}

/**
* Add item
*
* @param ReceiptItem $item
*
* @return $this
*/
public function addItem(ReceiptItem $item)
{
$this->items[] = $item;

return $this;
}
}
Loading

0 comments on commit 8417148

Please sign in to comment.