Skip to content

Commit

Permalink
fix: add support for external reference error (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
faso-dev authored Apr 1, 2024
1 parent 5ac21ed commit 9af611e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Http/RequestBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function from(Credentials $credentials, TransactionData $transacti
<PAYID2>12</PAYID2>
<otp>{$transactionData->getOtp()}</otp>
<reference_number>{$transactionData->getReferenceNumber()}</reference_number>
<ext_txn_id>201500068544</ext_txn_id>
<ext_txn_id>{$transactionData->getExternalReference()}</ext_txn_id>
</COMMAND>";
}
}
23 changes: 20 additions & 3 deletions src/Sdk/Config/TransactionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ class TransactionData

protected string $otp;

protected string $externalReference;

private function __construct(string $clientNumber, string $paymentAmount, string $otp)
private function __construct(string $clientNumber, string $paymentAmount, string $otp, string $externalReference)
{
$this->otp = $otp;
$this->paymentAmount = $paymentAmount;
$this->clientNumber = $clientNumber;
$this->externalReference = $externalReference;
}

public static function from(string $clientNumber, string $paymentAmount, string $otp): self
public static function from(string $clientNumber, string $paymentAmount, string $otp, string $externalReference): self
{
return new self($clientNumber, $paymentAmount, $otp);
return new self($clientNumber, $paymentAmount, $otp, $externalReference);
}

/**
Expand Down Expand Up @@ -99,4 +101,19 @@ public function setReferenceNumber(string $referenceNumber): TransactionData
return $this;
}

/**
* @return string
*/
public function getExternalReference(): string
{
return $this->externalReference;
}

/**
* @param string $externalReference
*/
public function setExternalReference(string $externalReference): void
{
$this->externalReference = $externalReference;
}
}
8 changes: 7 additions & 1 deletion src/Sdk/OrangeMoneyAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class OrangeMoneyAPI implements TransactionInterface
{
protected const DEV_API_URL = "https://testom.orange.bf:9008/payment";
protected const PROD_API_URL = "https://apiom.orange.bf:9007/payment";
protected const PROD_API_URL = "https://apiom.orange.bf";

protected TransactionData $transactionData;

Expand Down Expand Up @@ -92,6 +92,12 @@ public function withCustomReference(string $reference): self
return $this;
}

public function withExternalReference(string $externalReference): self
{
$this->transactionData->setExternalReference($externalReference);
return $this;
}

/**
* @param TransactionData $transactionData
* @return $this
Expand Down

1 comment on commit 9af611e

@saifonglee
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Salut, je remarque que le PROD_API_URL a change. est-ce la nouvelle url pour la prod?
parce que actuelement dans mon application, je n'arrive plus a me connecter via l'ancienne URL. (:9007/payment a la fin).

Ont-il changer quelque chose?

Please sign in to comment.