| Conditions | 5 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public function linkToSubscription(Payment $payment, AbstractCharge $charge): void |
||
| 32 | { |
||
| 33 | if (!$charge->hasExternalInvoiceId()) { |
||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | $invoice = $this->provider->invoices()->fetch($charge->getExternalInvoiceId()); |
||
|
|
|||
| 38 | |||
| 39 | foreach ($invoice->getLines() as $line) { |
||
| 40 | if (!$line->hasReferences()) { |
||
| 41 | continue; |
||
| 42 | } |
||
| 43 | try { |
||
| 44 | $subscription = $this->subscriptionRepository->getForMainAndChildExternalReference($line->getMainSubscriptionReference(), $line->getChildSubscriptionReference()); |
||
| 45 | $payment->addSubscription($subscription); |
||
| 46 | } catch (NoEntityFoundException $e) { |
||
| 47 | } |
||
| 51 |