mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-01 12:48:08 +09:00
Add type hints to Stripe and update tests/template (#3785)
Add type hints to Stripe; update tests/template
This commit is contained in:
1 parent
eaaf137315
commit
239321a2f7
3 files changed
+11
-9
No files matched your search
@@ -91,7 +91,7 @@ class Payment_Adapter_Stripe implements FOSSBilling\InjectionAwareInterface
|
||||
];
|
||||
}
|
||||
|
||||
public function getHtml($api_admin, $invoice_id, $subscription): string
|
||||
public function getHtml(FOSSBilling\Api\Proxy $api_admin, int $invoice_id, bool $subscription): string
|
||||
{
|
||||
$invoiceModel = $this->di['db']->load('Invoice', $invoice_id);
|
||||
|
||||
@@ -161,7 +161,7 @@ class Payment_Adapter_Stripe implements FOSSBilling\InjectionAwareInterface
|
||||
throw new Exception($tx->error);
|
||||
}
|
||||
|
||||
public function processTransaction($api_admin, $id, $data, $gateway_id): void
|
||||
public function processTransaction(FOSSBilling\Api\Proxy $api_admin, int $id, array $data, int $gateway_id): void
|
||||
{
|
||||
$tx = $this->di['db']->getExistingModelById('Transaction', $id);
|
||||
$invoiceService = $this->di['mod_service']('Invoice');
|
||||
|
||||
@@ -200,10 +200,10 @@ test('gets search query with various parameters', function (array $data, array $
|
||||
['txn_id' => 'longTxn_id'], ['txn_id' => 'longTxn_id'], 'AND m.txn_id = :txn_id',
|
||||
],
|
||||
[
|
||||
['date_from' => '2012-12-12'], ['date_from' => 1_355_270_400], 'AND UNIX_TIMESTAMP(m.created_at) >= :date_from',
|
||||
['date_from' => '2012-12-12'], ['date_from' => strtotime('2012-12-12 00:00:00 UTC')], 'AND UNIX_TIMESTAMP(m.created_at) >= :date_from',
|
||||
],
|
||||
[
|
||||
['date_to' => '2012-12-12'], ['date_to' => 1_355_270_400], 'AND UNIX_TIMESTAMP(m.created_at) <= :date_to',
|
||||
['date_to' => '2012-12-12'], ['date_to' => strtotime('2012-12-12 00:00:00 UTC')], 'AND UNIX_TIMESTAMP(m.created_at) <= :date_to',
|
||||
],
|
||||
]);
|
||||
|
||||
@@ -249,7 +249,7 @@ test('createAndProcess marks transaction as error when processing throws', funct
|
||||
$service->shouldReceive('processTransaction')
|
||||
->with(1)
|
||||
->once()
|
||||
->andThrow(new RuntimeException('Processing failed'));
|
||||
->andThrow(new RuntimeException('Processing failed', 1234));
|
||||
$service->setDi($di);
|
||||
|
||||
$thrown = null;
|
||||
@@ -263,7 +263,8 @@ test('createAndProcess marks transaction as error when processing throws', funct
|
||||
expect($thrown)->toBeInstanceOf(RuntimeException::class)
|
||||
->and($thrown->getMessage())->toBe('Processing failed')
|
||||
->and($transactionModel->status)->toBe(Model_Transaction::STATUS_ERROR)
|
||||
->and($transactionModel->error)->toBe('Processing failed');
|
||||
->and($transactionModel->error)->toBe('Processing failed')
|
||||
->and($transactionModel->error_code)->toBe(1234);
|
||||
});
|
||||
|
||||
test('createAndProcess skips processing when transaction is already processed', function (): void {
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
{% set canonical_url = guest.system_current_url|url %}
|
||||
{% set company = guest.system_company %}
|
||||
{% set public_logo_url = settings.theme == 'dark' ? company.logo_url_dark : company.logo_url %}
|
||||
{% set page_title = (settings.meta_title_prefix ~ ' ' ~ block('meta_title') ~ ' ' ~ settings.meta_title_suffix)|trim %}
|
||||
<html class="no-js" lang="{{ active_locale }}" data-bs-theme="{{ settings.theme|default('light') }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ (settings.meta_title_prefix ~ ' ' ~ block('meta_title') ~ ' ' ~ settings.meta_title_suffix)|trim }}</title>
|
||||
<title>{{ page_title }}</title>
|
||||
|
||||
<meta name="description" content="{% block meta_description %}{{ settings.meta_description }}{% endblock %}">
|
||||
<meta name="keywords" content="{{ settings.meta_keywords }}">
|
||||
@@ -20,7 +21,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block opengraph %}
|
||||
<meta property="og:title" content="{{ (settings.meta_title_prefix ~ ' ' ~ block('meta_title') ~ ' ' ~ settings.meta_title_suffix)|trim }}" />
|
||||
<meta property="og:title" content="{{ page_title }}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:description" content="{{ block('meta_description') }}" />
|
||||
<meta property="og:url" content="{{ canonical_url }}" />
|
||||
@@ -51,7 +52,7 @@
|
||||
<body class="{% block body_class %}{% endblock %}">
|
||||
{{ render_widgets('client.theme.body.start') }}
|
||||
{% block body %}{% endblock %}
|
||||
<div class="toast-container position-fixed bottom-0 end-0 p-3" style="z-index: 1070;" aria-live="polite" aria-atomic="true"></div>
|
||||
<div class="toast-container position-fixed bottom-0 end-0 p-3" style="z-index: 1070;" aria-live="polite" aria-atomic="false"></div>
|
||||
{{ include('partial_pending_messages.html.twig', ignore_missing: true) }}
|
||||
{{ render_widgets('client.theme.body.end') }}
|
||||
</body>
|
||||
|
||||
Reference in new issue
Block a user