Skip to content

Commit

Permalink
Enhance invoice response validation logic
Browse files Browse the repository at this point in the history
valentinDamyanovAmpeco committed Jan 6, 2025
1 parent 9c3a623 commit ecbc594
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ampeco/omnipay-cardcom",
"description": "Omnipay plugin for Cardcom payment gateway",
"version": "1.3.3",
"version": "1.3.4",
"type": "library",
"license": "MIT",
"autoload": {
5 changes: 0 additions & 5 deletions src/CommonParameters.php
Original file line number Diff line number Diff line change
@@ -214,11 +214,6 @@ public function getSum()
return $this->getParameter('sum');
}





///v2
public function setInvoiceLines($value)
{
return $this->setParameter('invoice_lines', $value);
2 changes: 1 addition & 1 deletion src/Message/FetchInvoiceResponse.php
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ public function __construct(AbstractRequest $request, $data, $statusCode)

public function isSuccessful() : bool
{
return $this->getCode() < 400 && in_array($this->data['ResponseCode'], [self::INVOICE_RESPONSE_CODE_SUCCESS]);
return $this->getCode() < 400 && $this->getDocumentUrl() !== null && $this->data['ResponseCode'] == self::INVOICE_RESPONSE_CODE_SUCCESS;
}

public function getDocumentUrl()
2 changes: 1 addition & 1 deletion src/Message/IssueInvoiceResponse.php
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ public function __construct(AbstractRequest $request, $data, $statusCode)

public function isSuccessful() : bool
{
return $this->getCode() < 400 && $this->data['ResponseCode'] === self::INVOICE_RESPONSE_CODE_SUCCESS && $this->getInvoiceNumber() !== null;
return $this->getCode() < 400 && $this->data['ResponseCode'] === self::INVOICE_RESPONSE_CODE_SUCCESS && $this->getInvoiceNumber() !== null && $this->getDocumentUrl() !== null;
}

public function getInvoiceNumber()

0 comments on commit ecbc594

Please sign in to comment.