Skip to content

Commit

Permalink
Added amount_allocations and marked marketplace as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ibarra committed Sep 15, 2022
1 parent 58f98b3 commit 5cbb0da
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/Checkout/Common/AmountAllocations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Checkout\Common;

class AmountAllocations
{
/**
* @var string
*/
public $id;

/**
* @var int
*/
public $amount;

/**
* @var string
*/
public $reference;

/**
* @var Commission
*/
public $commission;
}
16 changes: 16 additions & 0 deletions lib/Checkout/Common/Commission.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Checkout\Common;

class Commission
{
/**
* @var int
*/
public $amount;

/**
* @var float
*/
public $percentage;
}
6 changes: 6 additions & 0 deletions lib/Checkout/Payments/CaptureRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ class CaptureRequest
public $items;

/**
* @deprecated This property will be removed in the future, and should be used {@link amount_allocations} instead
* @var MarketplaceData
*/
public $marketplace;

/**
* @var array values of AmountAllocations
*/
public $amount_allocations;

/**
* @var ProcessingSettings
*/
Expand Down
6 changes: 6 additions & 0 deletions lib/Checkout/Payments/Hosted/HostedPaymentsSessionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ class HostedPaymentsSessionRequest
public $processing_channel_id;

/**
* @deprecated This property will be removed in the future, and should be used {@link amount_allocations} instead
* @var MarketplaceData
*/
public $marketplace;

/**
* @var array values of AmountAllocations
*/
public $amount_allocations;
}
6 changes: 6 additions & 0 deletions lib/Checkout/Payments/Links/PaymentLinkRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ class PaymentLinkRequest
public $processing_channel_id;

/**
* @deprecated This property will be removed in the future, and should be used {@link amount_allocations} instead
* @var MarketplaceData
*/
public $marketplace;

/**
* @var array values of AmountAllocations
*/
public $amount_allocations;
}
6 changes: 6 additions & 0 deletions lib/Checkout/Payments/Request/PaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,16 @@ class PaymentRequest
public $recipient;

/**
* @deprecated This property will be removed in the future, and should be used {@link amount_allocations} instead
* @var MarketplaceData
*/
public $marketplace;

/**
* @var array values of AmountAllocations
*/
public $amount_allocations;

/**
* @var ProcessingSettings
*/
Expand Down
14 changes: 14 additions & 0 deletions test/Checkout/Tests/Payments/Links/PaymentLinksIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Checkout\CheckoutArgumentException;
use Checkout\CheckoutAuthorizationException;
use Checkout\CheckoutException;
use Checkout\Common\AmountAllocations;
use Checkout\Common\Commission;
use Checkout\Common\Currency;
use Checkout\Common\CustomerRequest;
use Checkout\Common\PaymentSourceType;
Expand Down Expand Up @@ -44,6 +46,18 @@ public function shouldCreateAndGetPaymentLink()
{
$request = $this->createPaymentLinkRequest();

$commission = new Commission();
$commission->amount = 1;
$commission->percentage = 0.1;

$allocations = new AmountAllocations();
$allocations->id = "ent_sdioy6bajpzxyl3utftdp7legq";
$allocations->amount=100;
$allocations->reference = uniqid();
$allocations->commission = $commission;

$request->amount_allocations = array($allocations);

$response = $this->checkoutApi->getPaymentLinksClient()->createPaymentLink($request);

$this->assertResponse(
Expand Down

0 comments on commit 5cbb0da

Please sign in to comment.