Skip to content
GitLab
Erkunden
Anmelden
Registrieren
Primärnavigation
Suchen oder aufrufen …
Projekt
payment-stripe
Verwalten
Aktivität
Mitglieder
Labels
Planen
Tickets
9
Ticketübersichten
Meilensteine
Wiki
Code
Merge Requests
1
Repository
Branch
Commits
Tags
Repository-Diagramm
Revisionen vergleichen
Code-Schnipsel
Build
Pipelines
Aufgaben
Pipeline-Zeitpläne
Artefakte
Bereitstellung
Releases
Betreiben
Umgebungen
Überwachen
Vorfälle
Service-Desk
Analysieren
Wertschöpfungskettenanalyse
Mitwirkenden-Analyse
CI/CD-Analyse
Repository-Analysen
Hilfe
Hilfe
Support
GitLab-Dokumentation
GitLab-Pläne vergleichen
Community-Forum
Zu GitLab beitragen
Feedback geben
Tastenkürzel
?
Code-Schnipsel
Gruppen
Projekte
Show more breadcrumbs
QUIQQER
payment-stripe
Commits
ece5ca39
Commit
ece5ca39
erstellt
vor 4 Jahren
von
Patrick Müller
Dateien durchsuchen
Optionen
Downloads
Einfaches Diff
Merge branch 'dev'
Übergeordnete
d425ea29
c4f8e62d
No related branches found
Branches enthält Commit
No related tags found
Tags enthält Commit
2 Merge Requests
!6
feat!: quiqqer v2
,
!5
feat!: quiqqer v2
Änderungen
1
Leerzeichenänderungen ausblenden
Inline
Nebeneinander
1 geänderte Datei
src/QUI/ERP/Payments/Stripe/PaymentMethods/Recurring/Subscriptions.php
+26
-47
26 Ergänzungen, 47 Löschungen
...ayments/Stripe/PaymentMethods/Recurring/Subscriptions.php
wird angezeigt
mit
26 Ergänzungen
und
47 Löschungen
src/QUI/ERP/Payments/Stripe/PaymentMethods/Recurring/Subscriptions.php
+
26
−
47
Zeige Datei @
ece5ca39
...
@@ -718,26 +718,6 @@ protected static function refreshTransactionList($subscriptionId)
...
@@ -718,26 +718,6 @@ protected static function refreshTransactionList($subscriptionId)
$data
=
self
::
getSubscriptionData
(
$subscriptionId
);
$data
=
self
::
getSubscriptionData
(
$subscriptionId
);
$globalProcessId
=
$data
[
'global_process_id'
];
$globalProcessId
=
$data
[
'global_process_id'
];
// Determine last subscription ID
$result
=
QUI
::
getDataBase
()
->
fetch
([
'select'
=>
[
'stripe_invoice_id'
],
'from'
=>
Provider
::
getStripeBillingSubscriptionsTransactionsTable
(),
'where'
=>
[
'stripe_subscription_id'
=>
$subscriptionId
],
'order'
=>
[
'field'
=>
'stripe_invoice_date'
,
'sort'
=>
'DESC'
],
'limit'
=>
1
]);
$lastInvoiceId
=
null
;
if
(
!
empty
(
$result
))
{
$lastInvoiceId
=
$result
[
0
][
'stripe_invoice_id'
];
}
// Determine existing transactions
// Determine existing transactions
$result
=
QUI
::
getDataBase
()
->
fetch
([
$result
=
QUI
::
getDataBase
()
->
fetch
([
'select'
=>
[
'stripe_invoice_id'
],
'select'
=>
[
'stripe_invoice_id'
],
...
@@ -754,7 +734,7 @@ protected static function refreshTransactionList($subscriptionId)
...
@@ -754,7 +734,7 @@ protected static function refreshTransactionList($subscriptionId)
}
}
// Parse NEW transactions
// Parse NEW transactions
$transactions
=
self
::
getSubscriptionTransactions
(
$data
[
'stripe_id'
]
,
$lastInvoiceId
);
$transactions
=
self
::
getSubscriptionTransactions
(
$data
[
'stripe_id'
]);
foreach
(
$transactions
as
$transaction
)
{
foreach
(
$transactions
as
$transaction
)
{
$TransactionTime
=
date_create
(
'@'
.
$transaction
[
'created'
]);
$TransactionTime
=
date_create
(
'@'
.
$transaction
[
'created'
]);
...
@@ -771,19 +751,30 @@ protected static function refreshTransactionList($subscriptionId)
...
@@ -771,19 +751,30 @@ protected static function refreshTransactionList($subscriptionId)
$transactionTime
=
$TransactionTime
->
format
(
'Y-m-d H:i:s'
);
$transactionTime
=
$TransactionTime
->
format
(
'Y-m-d H:i:s'
);
if
(
isset
(
$existing
[
$transaction
[
'id'
]]))
{
if
(
isset
(
$existing
[
$transaction
[
'id'
]]))
{
continue
;
QUI
::
getDataBase
()
->
update
(
Provider
::
getStripeBillingSubscriptionsTransactionsTable
(),
[
'stripe_invoice_id'
=>
$transaction
[
'id'
],
'stripe_invoice_data'
=>
\json_encode
(
$transaction
),
'stripe_invoice_date'
=>
$transactionTime
,
'global_process_id'
=>
$globalProcessId
],
[
'stripe_subscription_id'
=>
$subscriptionId
]
);
}
else
{
QUI
::
getDataBase
()
->
insert
(
Provider
::
getStripeBillingSubscriptionsTransactionsTable
(),
[
'stripe_invoice_id'
=>
$transaction
[
'id'
],
'stripe_subscription_id'
=>
$subscriptionId
,
'stripe_invoice_data'
=>
\json_encode
(
$transaction
),
'stripe_invoice_date'
=>
$transactionTime
,
'global_process_id'
=>
$globalProcessId
]
);
}
}
QUI
::
getDataBase
()
->
insert
(
Provider
::
getStripeBillingSubscriptionsTransactionsTable
(),
[
'stripe_invoice_id'
=>
$transaction
[
'id'
],
'stripe_subscription_id'
=>
$subscriptionId
,
'stripe_invoice_data'
=>
\json_encode
(
$transaction
),
'stripe_invoice_date'
=>
$transactionTime
,
'global_process_id'
=>
$globalProcessId
]
);
}
}
self
::
$transactionsRefreshed
[
$subscriptionId
]
=
true
;
self
::
$transactionsRefreshed
[
$subscriptionId
]
=
true
;
...
@@ -800,6 +791,8 @@ protected static function refreshTransactionList($subscriptionId)
...
@@ -800,6 +791,8 @@ protected static function refreshTransactionList($subscriptionId)
*/
*/
protected
static
function
getUnprocessedTransactions
(
$subscriptionId
,
$status
=
StripeInvoice
::
STATUS_PAID
)
protected
static
function
getUnprocessedTransactions
(
$subscriptionId
,
$status
=
StripeInvoice
::
STATUS_PAID
)
{
{
self
::
refreshTransactionList
(
$subscriptionId
);
$result
=
QUI
::
getDataBase
()
->
fetch
([
$result
=
QUI
::
getDataBase
()
->
fetch
([
'select'
=>
[
'stripe_invoice_data'
],
'select'
=>
[
'stripe_invoice_data'
],
'from'
=>
Provider
::
getStripeBillingSubscriptionsTransactionsTable
(),
'from'
=>
Provider
::
getStripeBillingSubscriptionsTransactionsTable
(),
...
@@ -809,20 +802,6 @@ protected static function getUnprocessedTransactions($subscriptionId, $status =
...
@@ -809,20 +802,6 @@ protected static function getUnprocessedTransactions($subscriptionId, $status =
]
]
]);
]);
// Try to refresh list if no unprocessed transactions found
if
(
empty
(
$result
))
{
self
::
refreshTransactionList
(
$subscriptionId
);
$result
=
QUI
::
getDataBase
()
->
fetch
([
'select'
=>
[
'stripe_invoice_data'
],
'from'
=>
Provider
::
getStripeBillingSubscriptionsTransactionsTable
(),
'where'
=>
[
'stripe_subscription_id'
=>
$subscriptionId
,
'quiqqer_transaction_id'
=>
null
]
]);
}
$transactions
=
[];
$transactions
=
[];
foreach
(
$result
as
$row
)
{
foreach
(
$result
as
$row
)
{
...
...
This diff is collapsed.
Zum Erweitern klicken.
Vorschau
0%
Wiederholen
oder
Neue Datei anhängen
.
Abbrechen
You are about to add
0
people
to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Kommentar speichern
Abbrechen
Bitte
registrieren
oder
Anmelden
zum Kommentieren