[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: InvoicesTest.php
<?php namespace Srmklive\PayPal\Tests\Unit\Adapter; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Srmklive\PayPal\Tests\MockClientClasses; use Srmklive\PayPal\Tests\MockRequestPayloads; use Srmklive\PayPal\Tests\MockResponsePayloads; class InvoicesTest extends TestCase { use MockClientClasses; use MockRequestPayloads; use MockResponsePayloads; #[Test] public function it_can_generate_unique_invoice_number(): void { $expectedResponse = $this->mockGenerateInvoiceNumberResponse(); $expectedMethod = 'generateInvoiceNumber'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}()); } #[Test] public function it_can_create_a_draft_invoice(): void { $expectedResponse = $this->mockCreateInvoicesResponse(); $expectedParams = $this->createInvoiceParams(); $expectedMethod = 'createInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}($expectedParams)); } #[Test] public function it_can_list_current_invoices(): void { $expectedResponse = $this->mockListInvoicesResponse(); $expectedMethod = 'listInvoices'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}()); } #[Test] public function it_can_delete_an_invoice(): void { $expectedResponse = ''; $expectedMethod = 'deleteInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('INV2-Z56S-5LLA-Q52L-CPZ5')); } #[Test] public function it_can_update_an_invoice(): void { $expectedResponse = $this->mockUpdateInvoicesResponse(); $expectedParams = $this->updateInvoiceParams(); $expectedMethod = 'updateInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('INV2-Z56S-5LLA-Q52L-CPZ5', $expectedParams)); } #[Test] public function it_can_show_details_for_an_invoice(): void { $expectedResponse = $this->mockGetInvoicesResponse(); $expectedMethod = 'showInvoiceDetails'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('INV2-Z56S-5LLA-Q52L-CPZ5')); } #[Test] public function it_can_cancel_an_invoice(): void { $expectedResponse = ''; $expectedParams = $this->cancelInvoiceParams(); $expectedMethod = 'cancelInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}( 'INV2-Z56S-5LLA-Q52L-CPZ5', 'Reminder: Payment due for the invoice #ABC-123', 'Please pay before the due date to avoid incurring late payment charges which will be adjusted in the next bill generated.', true, true, [ 'customer-a@example.com', 'customer@example.com', ] )); } #[Test] public function it_can_generate_qr_code_for_invoice(): void { $expectedResponse = $this->mockGenerateInvoiceQRCodeResponse(); $expectedMethod = 'generateQRCodeInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('INV2-Z56S-5LLA-Q52L-CPZ5', 400, 400)); } #[Test] public function it_can_register_payment_for_invoice(): void { $expectedResponse = $this->mockInvoiceRegisterPaymentResponse(); $expectedMethod = 'registerPaymentInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('INV2-Z56S-5LLA-Q52L-CPZ5', '2018-05-01', 'BANK_TRANSFER', 10.00)); } #[Test] public function it_can_delete_payment_for_invoice(): void { $expectedResponse = ''; $expectedMethod = 'deleteExternalPaymentInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('INV2-Z56S-5LLA-Q52L-CPZ5', 'EXTR-86F38350LX4353815')); } #[Test] public function it_can_refund_payment_for_invoice(): void { $expectedResponse = $this->mockInvoiceRefundPaymentResponse(); $expectedMethod = 'refundInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('INV2-Z56S-5LLA-Q52L-CPZ5', '2018-05-01', 'BANK_TRANSFER', 5.00)); } #[Test] public function it_can_delete_refund_for_invoice(): void { $expectedResponse = ''; $expectedMethod = 'deleteRefundInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('INV2-Z56S-5LLA-Q52L-CPZ5', 'EXTR-2LG703375E477444T')); } #[Test] public function it_can_send_an_invoice(): void { $expectedResponse = ''; $expectedMethod = 'sendInvoice'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}( 'INV2-Z56S-5LLA-Q52L-CPZ5', 'Reminder: Payment due for the invoice #ABC-123', 'Please pay before the due date to avoid incurring late payment charges which will be adjusted in the next bill generated.', true, true, [ 'customer-a@example.com', 'customer@example.com', ] )); } #[Test] public function it_can_send_reminder_for_an_invoice(): void { $expectedResponse = ''; $expectedMethod = 'sendInvoiceReminder'; $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true); $mockClient->setApiCredentials($this->getMockCredentials()); $mockClient->getAccessToken(); $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}( 'INV2-Z56S-5LLA-Q52L-CPZ5', 'Reminder: Payment due for the invoice #ABC-123', 'Please pay before the due date to avoid incurring late payment charges which will be adjusted in the next bill generated.', true, true, [ 'customer-a@example.com', 'customer@example.com', ] )); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002