Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[CC-730] add ctp back in" #187

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres
to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## UNRELEASED

Click To Pay payment method is added to SDK.

### Added

* Added `\UnzerSDK\Resources\PaymentTypes\ClickToPay` payment method.

## [3.6.0](https://github.com/unzerdev/php-sdk/compare/3.5.0..3.6.0)

Twint payment method is added to SDK.
Expand All @@ -13,6 +21,7 @@ Twint payment method is added to SDK.

* Added `\UnzerSDK\Resources\PaymentTypes\Twint` payment method.


## [3.5.0](https://github.com/unzerdev/php-sdk/compare/3.4.1..3.5.0)

This version adds support for Google Pay.
Expand Down
1 change: 1 addition & 0 deletions src/Constants/IdStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class IdStrings
public const EPS = 'eps';
public const GIROPAY = 'gro';
public const GOOGLE_PAY = 'gop';
public const CLICK_TO_PAY = 'ctp';
public const HIRE_PURCHASE_DIRECT_DEBIT = 'hdd';
public const IDEAL = 'idl';
public const INSTALLMENT_SECURED = 'ins';
Expand Down
88 changes: 88 additions & 0 deletions src/Resources/PaymentTypes/Clicktopay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

namespace UnzerSDK\Resources\PaymentTypes;

use UnzerSDK\Adapter\HttpAdapterInterface;
use UnzerSDK\Resources\PaymentTypes\BasePaymentType;
use UnzerSDK\Traits\CanAuthorize;
use UnzerSDK\Traits\CanDirectCharge;

class Clicktopay extends BasePaymentType
{

use CanDirectCharge;
use CanAuthorize;

protected $mcCorrelationId;
protected $mcCxFlowId;
protected $mcMerchantTransactionId;
protected $brand;


public function __construct(
?string $mcCorrelationId = null,
?string $mcCxFlowId = null,
?string $mcMerchantTransactionId = null,
?string $brand = null
)
{
$this->mcCorrelationId = $mcCorrelationId;
$this->mcCxFlowId = $mcCxFlowId;
$this->mcMerchantTransactionId = $mcMerchantTransactionId;
$this->brand = $brand;
}


public function getMcCorrelationId() : ?string
{
return $this->mcCorrelationId;
}


public function getMcCxFlowId(): ?string
{
return $this->mcCxFlowId;
}


public function getBrand(): ?string
{
return $this->brand;
}


public function getMcMerchantTransactionId(): ?string
{
return $this->mcMerchantTransactionId;
}


public function setMcCxFlowId($mcCxFlowId): self
{
$this->mcCxFlowId = $mcCxFlowId;
return $this;
}


public function setMcCorrelationId($mcCorrelationId): self
{
$this->mcCorrelationId = $mcCorrelationId;
return $this;
}


public function setMcMerchantTransactionId($mcMerchantTransactionId): self
{
$this->mcMerchantTransactionId = $mcMerchantTransactionId;
return $this;
}


public function setBrand($brand): self
{
$this->brand = $brand;
return $this;
}


}
4 changes: 4 additions & 0 deletions src/Services/ResourceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use UnzerSDK\Exceptions\UnzerApiException;
use UnzerSDK\Resources\Config;
use UnzerSDK\Resources\PaymentTypes\Applepay;
use UnzerSDK\Resources\PaymentTypes\Clicktopay;
use UnzerSDK\Resources\PaymentTypes\Googlepay;
use UnzerSDK\Resources\PaymentTypes\Klarna;
use UnzerSDK\Resources\PaymentTypes\PaylaterDirectDebit;
Expand Down Expand Up @@ -825,6 +826,9 @@ public static function getTypeInstanceFromIdString($typeId): BasePaymentType
case IdStrings::GOOGLE_PAY:
$paymentType = new Googlepay();
break;
case IdStrings::CLICK_TO_PAY:
$paymentType = new Clicktopay();
break;
case IdStrings::HIRE_PURCHASE_DIRECT_DEBIT:
case IdStrings::INSTALLMENT_SECURED:
$paymentType = new InstallmentSecured();
Expand Down
6 changes: 6 additions & 0 deletions test/Fixtures/jsonData/clicktopay/createRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"mcCorrelationId": "corr12345",
"mcCxFlowId": "34f4a04b.5ab95e32-30f7-483f-846f-a08230a6d2ed.1618397078",
"mcMerchantTransactionId": "0a4e0d3.34f4a04b.894125b16ddd1f1b3a58273d63a0894179ac3535",
"brand": "mastercard"
}
14 changes: 14 additions & 0 deletions test/Fixtures/jsonData/clicktopay/fetchResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"id": "s-ctp-q0nucec6itwe",
"method": "card",
"recurring": false,
"geoLocation": {
"clientIp": "0:0:0:0:0:0:0:1",
"countryIsoA2": ""
},
"processing": {
"uniqueId": "31HA07BC8127DC45EE6946C3B070FF71",
"shortId": "5550.0369.6888",
"traceId": "24c0a2ecbe3d54a838c76444d4bdcd1f"
}
}
Loading
Loading