定制 saeid-khaleghi/police-reporter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

saeid-khaleghi/police-reporter

最新稳定版本:1.6.0

Composer 安装命令:

composer require saeid-khaleghi/police-reporter

包简介

A package for securely reporting business transactions to the New Zealand Police for compliance and transparency purposes.

README 文档

README

This package will help you generate an XML file for New Zealand Police reports.

Installation

You can install this package via Composer:

composer require saeid-khaleghi/police-reporter

Usage

use SaeidKhaleghi\PoliceReporter\XMLGenerator;

$transactions = Transaction::all();

$reporter = XMLGenerator::create($transactions)->writeToFile($path);

You can add your models directly by implementing the \SaeidKhaleghi\PoliceReporter\Contracts\Reportable interface.

use SaeidKhaleghi\PoliceReporter\Contracts\Reportable;

class Transaction extends Model implements Reportable
{
    public function toReportTransaction(): Url | string | array
    {
        return (new ReportTransaction($this))->transaction();
    }
}

Your PoliceReportTransactionMaker should be like this:

use SaeidKhaleghi\PoliceReporter\Tags\Person;
use SaeidKhaleghi\PoliceReporter\Tags\Signatory;
use SaeidKhaleghi\PoliceReporter\Tags\ToAccount;
use SaeidKhaleghi\PoliceReporter\Tags\FromAccount;
use SaeidKhaleghi\PoliceReporter\Tags\TransactionTo;
use SaeidKhaleghi\PoliceReporter\Tags\TransactionFrom;
use SaeidKhaleghi\PoliceReporter\Tags\Transaction as ReportTransaction;

class PoliceReportTransactionMaker
{
    private Transaction $transaction;

    public function __construct(Transaction $transaction)
    {
        $this->transaction = $transaction;
    }

    public function transactionFrom()
    {
        return new TransactionFrom('From fund code', 'From country');
    }

    public function fromAccount()
    {
        return new FromAccount(env('APP_FORMAL_NAME'), env('APP_INSTITUTION_CODE'), 'Branch', 'Account', 'Account_name');
    }

    public function accountRelatedPerson()
    {
        $identification = new PersonIdentification('Type', 'id_number', 'country', 'Expiry date');
        $user = new Person('Gender', 'First name', 'Last name', 'Birthdate', 'Id Type',  'Id number', 'Issue Country (Two-Letter Country Code)', $identification);

        return new AccountRelatedPerson($user);
    }

    public function transactionTo()
    {
        return new TransactionTo('To fund code', 'Destination Currency', 'Destination amount', 'To country');
    }

    public function toAccount()
    {
        return ToAccount::create('Institution name', 'Account', 'Account_name', 'swift');
    }

    public function transaction()
    {
        return ReportTransaction::create($this->transfer->reference, $this->transfer->updated_at, $this->transfer->origin_amount)
            ->addFromMyClient($this->transactionFrom()->addFromAccount($this->fromAccount()->addAccountRelatedPerson($this->accountRelatedPerson())))
            ->addTransactionTo($this->transactionTo()->addToAccount($this->toAccount()));
    }
}

The generated XML will look similar to this:

<reportdata>
    <transactions>
        <transaction>
            <transactionnumber>TW01182606-101023</transactionnumber>
            <transaction_location>web</transaction_location>
            <date_transaction>2023-10-11T11:03:51</date_transaction>
            <transmode_code>BA</transmode_code>
            <amount_local>129.06</amount_local>
            <t_from_my_client>
                <from_funds_code>N</from_funds_code>
                <from_account>
                    <institution_name>Your Company</institution_name>
                    <institution_code>12345</institution_code>
                    <branch>web</branch>
                    <account>ABC123</account>
                    <account_name>Saeid Khaleghi</account_name>
                    <related_persons>
                        <account_related_person>
                            <t_person>
                                <gender>M</gender>
                                <first_name>Saeid</first_name>
                                <last_name>Khaleghi</last_name>
                                <birthdate>1980-06-24T00:00:00</birthdate>
                                <id_number>ZYXWV123</id_number>
                                <identifications>
                                    <identification>
                                        <type>A</type>
                                        <number>ZYXWV123</number>
                                        <issue_country>NZ</issue_country>
                                    </identification>
                                </identifications>
                            </t_person>
                        </account_related_person>
                    </related_persons>
                </from_account>
                <from_country>NZ</from_country>
            </t_from_my_client>
            <t_to>
                <to_funds_code>N</to_funds_code>
                <to_account>
                    <institution_name>BNZ</institution_name>
                    <swift>BSIRIRTH</swift>
                    <account>ABCDEFGHIJK1234567890</account>
                    <account_name>RECIPIENT NAME</account_name>
                </to_account>
                <to_country>US</to_country>
            </t_to>
        </transaction>
        <transaction>
            ...
        </transaction>
    </transactions>
</reportdata>

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 100
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-27