• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jomweb / billplz / 22912138050

10 Mar 2026 04:09PM UTC coverage: 73.745% (-23.8%) from 97.537%
22912138050

Pull #59

github

web-flow
Merge f68ad896b into 7e55fdd4e
Pull Request #59: Release Billplz 6.0 with Money objects, bundled Codex internals, and updated CI

263 of 443 new or added lines in 24 files covered. (59.37%)

3 existing lines in 2 files now uncovered.

514 of 697 relevant lines covered (73.74%)

24.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/src/Base/Bill.php
1
<?php
2

3
namespace Billplz\Base;
4

5
use Billplz\Contracts\Bill as Contract;
6
use Billplz\Contracts\PaymentCompletion as PaymentCompletionContract;
7
use Billplz\PaymentCompletion as PaymentCompletionUrl;
8
use Billplz\Request;
9
use InvalidArgumentException;
10
use Laravie\Codex\Concerns\Request\Multipart;
11
use Laravie\Codex\Contracts\Response;
12

13
abstract class Bill extends Request implements Contract
14
{
15
    use Multipart,
16
        PaymentCompletion;
17

18
    /**
19
     * Create a new bill.
20
     *
21
     * @param  \Money\Money|int  $amount
22
     * @param  \Billplz\Contracts\PaymentCompletion|string  $paymentCompletion
23
     * @param  array<string, mixed>  $optional
24
     *
25
     * @throws \InvalidArgumentException
26
     */
27
    public function create(
28
        string $collectionId,
29
        ?string $email,
30
        ?string $mobile,
31
        string $name,
32
        $amount,
33
        $paymentCompletion,
34
        string $description,
35
        array $optional = []
36
    ): Response {
37
        if (empty($email) && empty($mobile)) {
6✔
38
            throw new InvalidArgumentException('Either $email or $mobile should be present');
2✔
39
        }
40

41
        $body = array_merge(
4✔
42
            compact('email', 'mobile', 'name', 'amount', 'description'), $optional
4✔
43
        );
4✔
44

45
        $body['collection_id'] = $collectionId;
4✔
46

47
        $paymentCompletion = $paymentCompletion instanceof PaymentCompletionContract
4✔
48
            ? $paymentCompletion
4✔
UNCOV
49
            : new PaymentCompletionUrl($paymentCompletion, $optional['redirect_url'] ?? null);
×
50

51
        $body = array_merge($body, $paymentCompletion->toArray());
4✔
52

53
        return $this->stream('POST', 'bills', [], $body);
4✔
54
    }
55

56
    /**
57
     * Show an existing bill.
58
     */
59
    public function get(string $id): Response
60
    {
61
        return $this->send('GET', "bills/{$id}");
6✔
62
    }
63

64
    /**
65
     * Show an existing bill transactions.
66
     *
67
     * @param  array<string, mixed>  $optional
68
     */
69
    public function transaction(string $id, array $optional = []): Response
70
    {
71
        /** @var \Billplz\Contracts\Bill\Transaction $transaction */
72
        $transaction = $this->client->uses(
2✔
73
            'Bill.Transaction', $this->getVersion()
2✔
74
        );
2✔
75

76
        return $transaction->get($id, $optional);
2✔
77
    }
78

79
    /**
80
     * Destroy an existing bill.
81
     */
82
    public function destroy(string $id): Response
83
    {
84
        return $this->send('DELETE', "bills/{$id}");
2✔
85
    }
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc