Skip to content

Commit

Permalink
Merge pull request #7 from g0dReVeN/master
Browse files Browse the repository at this point in the history
Updated repeatedPayment request's payload
  • Loading branch information
garethnic authored May 20, 2020
2 parents 2a103cd + 0911aed commit 5eefccd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Api/Factory/PaymentScheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class PaymentScheme

public function __construct(Setting $settings)
{

$this->settings = $settings;
$this->client = new Client([
'base_uri' => $this->getApiUri(),
Expand All @@ -40,7 +40,7 @@ public function __construct(Setting $settings)

//abstract protected function registerCardDuringPayment(CardBuilder $card);

abstract protected function repeatedPayment(PaymentCard $card, object $owner, int $amount, string $type);
abstract protected function repeatedPayment(PaymentCard $card, object $owner, int $amount, string $customerName, $invoiceId, string $type);

abstract protected function oneClickPayment(PaymentCard $card, int $amount);

Expand Down
4 changes: 3 additions & 1 deletion src/Api/PaymentMethods/CopyAndPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ public function registerCardDuringPayment(int $amount, $preAuth = false)
* @param PaymentCard $card
* @param $owner
* @param int $amount
* @param string $customerName
* @param string $invoiceId
* @param string $type
*
* @return mixed|\Psr\Http\Message\ResponseInterface
*/
public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $type = PaymentScheme::REPEATED_PAYMENT)
public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $customerName = null, $invoiceId = null, string $type = PaymentScheme::REPEATED_PAYMENT)
{
try {
return $this->client->request(
Expand Down
6 changes: 5 additions & 1 deletion src/Api/PaymentMethods/ServerToServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ public function registerCardDuringPayment(CardBuilder $card, int $amount)
* @param $owner
* @param int $amount
* @param string $type
* @param string $customerName
* @param string $invoiceId
*
* @return mixed|\Psr\Http\Message\ResponseInterface
*/
public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $type = PaymentScheme::REPEATED_PAYMENT)
public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $customerName = null, $invoiceId = null, string $type = PaymentScheme::REPEATED_PAYMENT)
{
try {
$response = $this->client->request(
Expand All @@ -106,6 +108,8 @@ public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $
'paymentType' => self::DEBIT,
'recurringType' => $type,
'merchantTransactionId' => class_basename($owner) . '-' . $owner->id,
'customer.givenName' => $customerName,
'merchantInvoiceId' => $invoiceId
],
]
)->getBody()->getContents();
Expand Down

0 comments on commit 5eefccd

Please sign in to comment.