1
0
mirror of synced 2024-12-01 09:26:03 +03:00
atol-online-client/tests/AtolOnlineClient/Traits/PaymentReceiptRequestTrait.php

59 lines
2.0 KiB
PHP
Raw Normal View History

2019-08-22 17:04:26 +03:00
<?php
namespace AtolOnlineClient\AtolOnlineClient\Traits;
use AtolOnlineClient\Request\V4\ClientReceiptRequest;
use AtolOnlineClient\Request\V4\CompanyReceiptRequest;
use AtolOnlineClient\Request\V4\PaymentReceiptRequest;
use AtolOnlineClient\Request\V4\ReceiptItemRequest;
use AtolOnlineClient\Request\V4\ReceiptPaymentRequest;
use AtolOnlineClient\Request\V4\ReceiptRequest;
use AtolOnlineClient\Request\V4\ServiceRequest;
use AtolOnlineClient\Request\V4\VatReceiptRequest;
trait PaymentReceiptRequestTrait
{
/**
* @return PaymentReceiptRequest
*/
protected function getPaymentReceiptRequest(): PaymentReceiptRequest
{
$service = new ServiceRequest();
$service->setCallbackUrl('test.local');
$client = new ClientReceiptRequest('test@test.local');
$company = new CompanyReceiptRequest();
$company->setEmail('test@test.local');
$company->setInn('11111111');
$company->setPaymentAddress('address');
$item = new ReceiptItemRequest();
$item->setName('test item');
2019-12-26 11:36:15 +03:00
$item->setPrice(100.1);
$item->setQuantity(1.1);
2019-12-26 11:36:15 +03:00
$item->setSum(100.1);
2019-08-22 17:04:26 +03:00
$item->setMeasurementUnit('kg');
$item->setPaymentMethod(ReceiptItemRequest::PAYMENT_METHOD_ADVANCE);
$item->setPaymentObject(ReceiptItemRequest::PAYMENT_OBJECT_AGENT_COMMISSION);
2019-12-26 11:36:15 +03:00
$item->setVat(new VatReceiptRequest('vat20', 20.2));
2019-08-22 17:04:26 +03:00
$item->setNomenclatureCode('00');
$receipt = new ReceiptRequest();
2019-12-26 11:36:15 +03:00
$receipt->setTotal(100.1);
2019-08-22 17:04:26 +03:00
$receipt->setClient($client);
$receipt->setCompany($company);
$receipt->setItems([$item]);
2019-12-26 11:36:15 +03:00
$receipt->setPayments([new ReceiptPaymentRequest(0, 100.1)]);
$receipt->setVats([new VatReceiptRequest('vat20', 20.2)]);
2019-08-22 17:04:26 +03:00
/** @var PaymentReceiptRequest $request */
$request = new PaymentReceiptRequest();
$request->setExternalId('test');
$request->setService($service);
$request->setReceipt($receipt);
return $request;
}
}