Skip to content

Commit

Permalink
updated integrator
Browse files Browse the repository at this point in the history
  • Loading branch information
BeycanDeveloper committed Mar 8, 2024
1 parent f21aa7f commit 1a9919d
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 29 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
}
},
"require": {
"beycanpress/cryptopay-integrator": "^0.1.5"
"beycanpress/cryptopay-integrator": "^0.1.7"
}
}
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/beycanpress/cryptopay-integrator/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beycanpress/cryptopay-integrator",
"version": "0.1.5",
"version": "0.1.7",
"description": "CryptoPay and CryptoPay Lite integration wrapper",
"type": "library",
"license": "MIT",
Expand Down
34 changes: 28 additions & 6 deletions vendor/beycanpress/cryptopay-integrator/src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use BeycanPress\CryptoPay\Pages\TransactionPage;
use BeycanPress\CryptoPay\Types\Order\OrderType;
use BeycanPress\CryptoPay\PluginHero\Http\Response;
use BeycanPress\CryptoPay\Types\Transaction\ParamsType;
// Lite
use BeycanPress\CryptoPayLite\Loader as LiteLoader;
use BeycanPress\CryptoPayLite\Payment as LitePayment;
Expand All @@ -19,6 +20,7 @@
use BeycanPress\CryptoPayLite\Types\Order\OrderType as LiteOrderType;
use BeycanPress\CryptoPayLite\PluginHero\Http\Response as LiteResponse;
use BeycanPress\CryptoPayLite\Pages\TransactionPage as LiteTransactionPage;
use BeycanPress\CryptoPayLite\Types\Transaction\ParamsType as LiteParamsType;

class Helpers
{
Expand Down Expand Up @@ -189,9 +191,13 @@ public static function listenSPP(): void
if ($token && Session::has($token)) {
extract(Session::get($token));
if (Type::PRO === $type) {
$cryptopay = self::createProPayment($addon, (array) $order);
$cryptopay = self::createProPayment($addon, (array) $order, [
'token' => $token
]);
} else {
$cryptopay = self::createLitePayment($addon, (array) $order);
$cryptopay = self::createLitePayment($addon, (array) $order, [
'token' => $token
]);
}
require dirname(__DIR__) . '/views/pay.php';
exit;
Expand All @@ -201,20 +207,36 @@ public static function listenSPP(): void
/**
* @param string $addon
* @param array<mixed> $order
* @param array<mixed> $params
* @return string
*/
public static function createProPayment(string $addon, array $order): string
public static function createProPayment(string $addon, array $order, array $params = []): string
{
return (new Payment($addon))->setOrder(OrderType::fromArray($order))->html(loading:true);
return (new Payment($addon))
->setOrder(
OrderType::fromArray($order)
)
->setParams(
ParamsType::fromArray($params)
)
->html(loading:true);
}

/**
* @param string $addon
* @param array<mixed> $order
* @param array<mixed> $params
* @return string
*/
public static function createLitePayment(string $addon, array $order): string
public static function createLitePayment(string $addon, array $order, array $params = []): string
{
return (new LitePayment($addon))->setOrder(LiteOrderType::fromArray($order))->html(loading:true);
return (new LitePayment($addon))
->setOrder(
LiteOrderType::fromArray($order)
)
->setParams(
LiteParamsType::fromArray($params)
)
->html(loading:true);
}
}
4 changes: 2 additions & 2 deletions vendor/beycanpress/cryptopay-integrator/views/pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
<?php if (isset($order['amount'])): ?>
<p><strong><?php echo esc_html__('Amount') ?>:</strong> <?php echo esc_html($order['amount']) ?> <?php echo esc_html($order['currency']) ?></p>
<?php endif; ?>
<?php if (isset($addon)): ?>
<p><strong><?php echo esc_html__('Addon') ?>:</strong> <?php echo esc_html($addon) ?></p>
<?php if (isset($addonName)): ?>
<p><strong><?php echo esc_html__('Addon') ?>:</strong> <?php echo esc_html($addonName) ?></p>
<?php endif; ?>
<p>
<?php echo esc_html__('This page is the single payment page, after you make your payment on this page you will be returned to the addon\'s page that redirected you to this page.') ?>
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
"packages": [
{
"name": "beycanpress/cryptopay-integrator",
"version": "0.1.5",
"version_normalized": "0.1.5.0",
"version": "0.1.7",
"version_normalized": "0.1.7.0",
"source": {
"type": "git",
"url": "https://github.com/BeycanPress/cryptopay-integrator.git",
"reference": "3e09b41450580cf9591b52f9e4f73bbce0970637"
"reference": "94c4b4a91b304bfbb8a2c430cc5f0c141143a30e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/3e09b41450580cf9591b52f9e4f73bbce0970637",
"reference": "3e09b41450580cf9591b52f9e4f73bbce0970637",
"url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/94c4b4a91b304bfbb8a2c430cc5f0c141143a30e",
"reference": "94c4b4a91b304bfbb8a2c430cc5f0c141143a30e",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"time": "2024-03-06T14:42:16+00:00",
"time": "2024-03-08T03:17:38+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -34,7 +34,7 @@
"homepage": "https://github.com/BeycanPress/cryptopay-integrator",
"support": {
"issues": "https://github.com/BeycanPress/cryptopay-integrator/issues",
"source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.5"
"source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.7"
},
"install-path": "../beycanpress/cryptopay-integrator"
}
Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'eed674329ff24d457c761e7fb3951c71c5821eff',
'reference' => 'f21aa7f3b6ea6e29b208d4a2bd68115d6a4d205d',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,16 +13,16 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'eed674329ff24d457c761e7fb3951c71c5821eff',
'reference' => 'f21aa7f3b6ea6e29b208d4a2bd68115d6a4d205d',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'beycanpress/cryptopay-integrator' => array(
'pretty_version' => '0.1.5',
'version' => '0.1.5.0',
'reference' => '3e09b41450580cf9591b52f9e4f73bbce0970637',
'pretty_version' => '0.1.7',
'version' => '0.1.7.0',
'reference' => '94c4b4a91b304bfbb8a2c430cc5f0c141143a30e',
'type' => 'library',
'install_path' => __DIR__ . '/../beycanpress/cryptopay-integrator',
'aliases' => array(),
Expand Down

0 comments on commit 1a9919d

Please sign in to comment.