Skip to content

Commit

Permalink
Added support to ACH and Level 2 & 3 fields
Browse files Browse the repository at this point in the history
Added Palestine Country code
API Updates: Payments
  • Loading branch information
a-ibarra committed Aug 4, 2022
1 parent 9bb9951 commit 671a1af
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 56 deletions.
1 change: 1 addition & 0 deletions lib/Checkout/Common/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,5 @@ final class Country
public static $YE = "YE";
public static $ZM = "ZM";
public static $ZW = "ZW";
public static $PS = "PS";
}
4 changes: 4 additions & 0 deletions lib/Checkout/Common/PaymentSourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ class PaymentSourceType
public static $alipay_cn = "alipay_cn";
public static $gcash = "gcash";
public static $wechatpay = "wechatpay";
public static $dana = "dana";
public static $kakaopay = "kakaopay";
public static $truemoney = "truemoney";
public static $tng = "tng";
}
37 changes: 37 additions & 0 deletions lib/Checkout/Payments/CaptureRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Checkout\Payments;

use Checkout\Common\MarketplaceData;

class CaptureRequest
{
/**
Expand All @@ -19,6 +21,41 @@ class CaptureRequest
*/
public $reference;

/**
* @var PaymentCustomerRequest
*/
public $customer;

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

/**
* @var BillingDescriptor
*/
public $billing_descriptor;

/**
* @var ShippingDetails
*/
public $shipping;

/**
* @var array of Checkout\Payments\Product
*/
public $items;

/**
* @var MarketplaceData
*/
public $marketplace;

/**
* @var ProcessingSettings
*/
public $processing;

/**
* @var array
*/
Expand Down
13 changes: 13 additions & 0 deletions lib/Checkout/Payments/PaymentCustomerRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Checkout\Payments;

use Checkout\Common\CustomerRequest;

class PaymentCustomerRequest extends CustomerRequest
{
/**
* @var string
*/
public $tax_number;
}
40 changes: 31 additions & 9 deletions lib/Checkout/Payments/ProcessingSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,50 @@
class ProcessingSettings
{
/**
* @var bool
* @var string
*/
public $aft;
public $order_id;

/**
* @var string value of MerchantInitiatedReason
* @var int
*/
public $merchant_initiated_reason;
public $tax_amount;

/**
* @var DLocalProcessingSettings
* @var int
*/
public $dlocal;
public $discount_amount;

/**
* @var int
*/
public $tax_amount;
public $duty_amount;

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

/**
* @var Aggregator
* @var int
*/
public $aggregator;
public $shipping_tax_amount;

/**
* @var bool
*/
public $aft;

/**
* @var string value of PreferredSchema
*/
public $preferred_scheme;

/**
* @var string value of MerchantInitiatedReason
*/
public $merchant_initiated_reason;

/**
* @var string value of ProductType
*/
Expand Down Expand Up @@ -103,4 +113,16 @@ class ProcessingSettings
* @var array of AirlineData
*/
public $airline_data;

/**
* @var DLocalProcessingSettings
*/
public $dlocal;

/**
* @var Aggregator
*/
public $aggregator;


}
16 changes: 11 additions & 5 deletions lib/Checkout/Payments/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class Product
/**
* @var string
*/
public $image_url;
public $commodity_code;

/**
* @var string
*/
public $url;
public $unit_of_measure;

/**
* @var int
Expand All @@ -52,15 +52,21 @@ class Product
/**
* @var string
*/
public $sku;
public $wxpay_goods_id;

/**
* @var string
*/
public $goods_id;
public $image_url;

/**
* @var string
*/
public $wxpay_goods_id;
public $url;

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

}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Checkout\Payments\Request\Source\Apm;

use Checkout\Common\PaymentSourceType;
use Checkout\Payments\Request\Source\AbstractRequestSource;

class RequestAlipayPlusSource extends AbstractRequestSource
{
public static function requestAlipayPlusCNSource()
{
return new RequestAlipayPlusSource(PaymentSourceType::$alipay_cn);
}

public static function requestAlipayPlusGCashSource()
{
return new RequestAlipayPlusSource(PaymentSourceType::$gcash);
}

public static function requestAlipayPlusHKSource()
{
return new RequestAlipayPlusSource(PaymentSourceType::$alipay_hk);
}

public static function requestAlipayPlusDanaSource()
{
return new RequestAlipayPlusSource(PaymentSourceType::$dana);
}

public static function requestAlipayPlusKakaoPaySource()
{
return new RequestAlipayPlusSource(PaymentSourceType::$kakaopay);
}

public static function requestAlipayPlusTrueMoneySource()
{
return new RequestAlipayPlusSource(PaymentSourceType::$truemoney);
}

public static function requestAlipayPlusTNGSource()
{
return new RequestAlipayPlusSource(PaymentSourceType::$tng);
}

}
5 changes: 5 additions & 0 deletions lib/Checkout/Payments/Request/Source/RequestIdSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ public function __construct()
* @var string
*/
public $cvv;

/**
* @var string
*/
public $payment_method;
}
5 changes: 5 additions & 0 deletions lib/Checkout/Payments/ShippingDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ class ShippingDetails
* @var Phone
*/
public $phone;

/**
* @var string
*/
public $from_address_zip;
}
26 changes: 26 additions & 0 deletions test/Checkout/Tests/Payments/RequestApmPaymentsIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Checkout\Tests\Payments;

use Checkout\CheckoutApiException;
use Checkout\CheckoutSdk;
use Checkout\Common\Address;
use Checkout\Common\Country;
Expand All @@ -12,13 +13,38 @@
use Checkout\Environment;
use Checkout\Payments\ProcessingSettings;
use Checkout\Payments\Request\PaymentRequest;
use Checkout\Payments\Request\Source\Apm\RequestAlipayPlusSource;
use Checkout\Payments\Request\Source\Apm\RequestIdealSource;
use Checkout\Payments\Request\Source\Apm\RequestPayPalSource;
use Checkout\Payments\Request\Source\Apm\RequestSofortSource;
use Checkout\Payments\Request\Source\Apm\RequestTamaraSource;
use Exception;

class RequestApmPaymentsIntegrationTest extends AbstractPaymentsIntegrationTest
{
/**
* @test
*/
public function shouldMakeAliPayPayment()
{
$requestSource = RequestAlipayPlusSource::requestAlipayPlusCNSource();

$paymentRequest = new PaymentRequest();
$paymentRequest->reference = $this->randomEmail();
$paymentRequest->source = $requestSource;
$paymentRequest->capture = true;
$paymentRequest->amount = 1000;
$paymentRequest->currency = Currency::$EUR;
$paymentRequest->success_url = "https://testing.checkout.com/sucess";
$paymentRequest->failure_url = "https://testing.checkout.com/failure";

try {
$this->checkoutApi->getPaymentsClient()->requestPayment($paymentRequest);
} catch (Exception $ex) {
self::assertTrue($ex instanceof CheckoutApiException);
}
}

/**
* @test
*/
Expand Down

0 comments on commit 671a1af

Please sign in to comment.