Skip to content

Commit

Permalink
Merge pull request #9 from Jooyeshgar/7-update-27-3-1402
Browse files Browse the repository at this point in the history
Update for compatibility with Moadian API V6.4 27-3-1402
  • Loading branch information
hadi60 authored Jun 20, 2023
2 parents ca8a8ae + 70e38b9 commit 0ae69b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/Http/invoicePacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class invoicePacket extends Packet
{
public function __construct(string $username, Invoice $invoice) {

parent::__construct();

$this->path = 'req/api/self-tsp/async/normal-enqueue';
Expand All @@ -17,5 +17,7 @@ public function __construct(string $username, Invoice $invoice) {
$this->needEncrypt = true;
$this->data = $invoice->toArray();
$this->retry = $invoice->retry;

unset($this->data['header']['clientId']);
}
}
12 changes: 6 additions & 6 deletions src/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ class Invoice
{
private InvoiceHeader $header;
private array $body = [];
private array $payment = [];
private array $payments = [];

public $retry = false;

public function __construct(InvoiceHeader $header)
{
$this->header = $header;
Expand All @@ -22,21 +22,21 @@ public function addItem(InvoiceItem $item)

public function addPayment(Payment $payment)
{
$this->payment[] = $payment;
$this->payments[] = $payment;
}

public function toArray()
{
return [
'header' => $this->header->toArray(),

'body' => array_map(function ($item){
'body' => array_map(function ($item){
return $item->toArray();
}, $this->body),

'payment' => array_map(function ($item){
'payments' => array_map(function ($item){
return $item->toArray();
}, $this->payment),
}, $this->payments),

'extension' => null,
];
Expand Down

0 comments on commit 0ae69b3

Please sign in to comment.