/home/kueuepay/public_html/vendor/fakerphp/faker/src/Faker/Core/DateTime.php
<?php

namespace Faker\Core;

use Faker\Extension\DateTimeExtension;
use Faker\Extension\GeneratorAwareExtension;
use Faker\Extension\GeneratorAwareExtensionTrait;
use Faker\Extension\Helper;

/**
 * @experimental This class is experimental and does not fall under our BC promise
 *
 * @since 1.20.0
 */
final class DateTime implements DateTimeExtension, GeneratorAwareExtension
{
    use GeneratorAwareExtensionTrait;

    /**
     * @var string[]
     */
    private array $centuries = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX', 'XXI'];

    private ?string $defaultTimezone = null;

    /**
     * Get the POSIX-timestamp of a DateTime, int or string.
     *
     * @param \DateTime|float|int|string $until
     *
     * @return false|int
     */
    private function getTimestamp($until = 'now')
    {
        if (is_numeric($until)) {
            return (int) $until;
        }

        if ($until instanceof \DateTime) {
            return $until->getTimestamp();
        }

        return strtotime(empty($until) ? 'now' : $until);
    }

    /**
     * Get a DateTime created based on a POSIX-timestamp.
     *
     * @param int $timestamp the UNIX / POSIX-compatible timestamp
     */
    private function getTimestampDateTime(int $timestamp): \DateTime
    {
        return new \DateTime('@' . $timestamp);
    }

    private function resolveTimezone(?string $timezone): string
    {
        if ($timezone !== null) {
            return $timezone;
        }

        return null === $this->defaultTimezone ? date_default_timezone_get() : $this->defaultTimezone;
    }

    /**
     * Internal method to set the timezone on a DateTime object.
     */
    private function setTimezone(\DateTime $dateTime, ?string $timezone): \DateTime
    {
        $timezone = $this->resolveTimezone($timezone);

        return $dateTime->setTimezone(new \DateTimeZone($timezone));
    }

    public function dateTime($until = 'now', string $timezone = null): \DateTime
    {
        return $this->setTimezone(
            $this->getTimestampDateTime($this->unixTime($until)),
            $timezone,
        );
    }

    public function dateTimeAD($until = 'now', string $timezone = null): \DateTime
    {
        $min = (PHP_INT_SIZE > 4) ? -62135597361 : -PHP_INT_MAX;

        return $this->setTimezone(
            $this->getTimestampDateTime($this->generator->numberBetween($min, $this->getTimestamp($until))),
            $timezone,
        );
    }

    public function dateTimeBetween($from = '-30 years', $until = 'now', string $timezone = null): \DateTime
    {
        $start = $this->getTimestamp($from);
        $end = $this->getTimestamp($until);

        if ($start > $end) {
            throw new \InvalidArgumentException('"$from" must be anterior to "$until".');
        }

        $timestamp = $this->generator->numberBetween($start, $end);

        return $this->setTimezone(
            $this->getTimestampDateTime($timestamp),
            $timezone,
        );
    }

    public function dateTimeInInterval($from = '-30 years', string $interval = '+5 days', string $timezone = null): \DateTime
    {
        $intervalObject = \DateInterval::createFromDateString($interval);
        $datetime = $from instanceof \DateTime ? $from : new \DateTime($from);

        $other = (clone $datetime)->add($intervalObject);

        $begin = min($datetime, $other);
        $end = $datetime === $begin ? $other : $datetime;

        return $this->dateTimeBetween($begin, $end, $timezone);
    }

    public function dateTimeThisWeek($until = 'sunday this week', string $timezone = null): \DateTime
    {
        return $this->dateTimeBetween('monday this week', $until, $timezone);
    }

    public function dateTimeThisMonth($until = 'last day of this month', string $timezone = null): \DateTime
    {
        return $this->dateTimeBetween('first day of this month', $until, $timezone);
    }

    public function dateTimeThisYear($until = 'last day of december', string $timezone = null): \DateTime
    {
        return $this->dateTimeBetween('first day of january', $until, $timezone);
    }

    public function dateTimeThisDecade($until = 'now', string $timezone = null): \DateTime
    {
        $year = floor(date('Y') / 10) * 10;

        return $this->dateTimeBetween("first day of january $year", $until, $timezone);
    }

    public function dateTimeThisCentury($until = 'now', string $timezone = null): \DateTime
    {
        $year = floor(date('Y') / 100) * 100;

        return $this->dateTimeBetween("first day of january $year", $until, $timezone);
    }

    public function date(string $format = 'Y-m-d', $until = 'now'): string
    {
        return $this->dateTime($until)->format($format);
    }

    public function time(string $format = 'H:i:s', $until = 'now'): string
    {
        return $this->date($format, $until);
    }

    public function unixTime($until = 'now'): int
    {
        return $this->generator->numberBetween(0, $this->getTimestamp($until));
    }

    public function iso8601($until = 'now'): string
    {
        return $this->date(\DateTime::ISO8601, $until);
    }

    public function amPm($until = 'now'): string
    {
        return $this->date('a', $until);
    }

    public function dayOfMonth($until = 'now'): string
    {
        return $this->date('d', $until);
    }

    public function dayOfWeek($until = 'now'): string
    {
        return $this->date('l', $until);
    }

    public function month($until = 'now'): string
    {
        return $this->date('m', $until);
    }

    public function monthName($until = 'now'): string
    {
        return $this->date('F', $until);
    }

    public function year($until = 'now'): string
    {
        return $this->date('Y', $until);
    }

    public function century(): string
    {
        return Helper::randomElement($this->centuries);
    }

    public function timezone(string $countryCode = null): string
    {
        if ($countryCode) {
            $timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $countryCode);
        } else {
            $timezones = \DateTimeZone::listIdentifiers();
        }

        return Helper::randomElement($timezones);
    }
}
Access Token

Get Access Token

Get access token to initiates payment transaction.

Endpoint: POST generate-token
Parameter Type Comments
client_id string Enter merchant API client/primary key
secret_id string Enter merchant API secret key
env string Enter merchant API environment
merchant_id string Enter merchant API merchant id
Just request to that endpoint with all parameter listed below:
                    
                        Request Example (guzzle)
                        

<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', $base_url. 'v1/generate-token', [
'headers' => [
  'accept' => 'application/json',
  'content-type' => 'application/json',
 ],
'form_params' => [
  'client_id' => '$client_id',
  'secret_id' => 'secret_id',
  'env' => 'env',
  'merchant_id' => 'merchant_id',
 ],
]);
echo $response->getBody();
                    
                        
**Response: SUCCESS (200 OK)**
{
 "message": {
 "success": [
  "Successfully token is generated"
 ]
},
"data": {
 "token":"eyJpdiI6InpkczhjTjhQdVhUL2lKQ0pSUUx6aUE9P
SIsInZhbHVlIjoiVGVBTVBDTXltbjNZcEIvdEJveGpTSno3TU5NRUtn
VkhCZ1pHTFNCUnZGQ2UxMnYxN202cEE1YVRDTEFsc0ZERExoTjdtL0dTL2x
oU3QzeUJJOExiMUx5T0w1L0llUXhTUkU1cWVLWEdEbEplb0dKNXcwbTNRM0
VxdkUwYzZuNFdtNkhMQ0pRZysyNWkvdzBxSlBoSVBSOGFTekNnR2RXNHVtc
G9lMGZOTmNCcm1hR3c5Sk9KTnB4Y3ltZDl6cm90MThrR21Ca3B1azc3bXRi
Q0J6SW96UVo1elNkU1ZqeE05bTcwWGp1MEUxWlJFdnNWTmpSbnVpeW92b2U
4dXZkUGgyb1VmK0luaGdyaFlsVTZlcVpVRnZlTG1DeFF6Ykk2T2h6Z3Jzbn
IyNHpNdHowSE5JdDR0Y0pZT20zUm1XYW8iLCJtYWMiOiJlY2M4NGE1OGUzYz
kzYzk0YzljNmVmNjE0YWI0ZDIwOGI3NDQ2YWEyY2ZhNzc0NzE4ZmY1ZmYyMz
IyZmQzNDY1IiwidGFnIjoiIn0=",
},
"type": "success"
}
                    
                        
**Response: ERROR (400 FAILED)**
{
 "message": {
 "error": [
  "Invalid credentials."
 ]
},
"data": null,
"type": "error"
}