Skip to content

Commit

Permalink
Updated for new platform
Browse files Browse the repository at this point in the history
  • Loading branch information
toooni committed Dec 22, 2023
1 parent 8134639 commit df7c2a3
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 0 additions & 2 deletions .gitignore
@@ -1,3 +1 @@
/.idea
/vendor/
/composer.lock
2 changes: 1 addition & 1 deletion Action/Api/ObtainSnippetAction.php
Expand Up @@ -28,7 +28,7 @@ public function execute($request)
$model = ArrayObject::ensureArrayObject($request->getModel());

throw new PublicReply(
$this->api->getOptions()['publishable_key'],
$this->api->getOptions()['public_key'],
$this->api->getOptions()['framesjs_path']
);
}
Expand Down
5 changes: 3 additions & 2 deletions Action/AuthorizeAction.php
Expand Up @@ -4,9 +4,9 @@

namespace Payum\Checkoutcom\Action;

use Checkout\Previous\CheckoutApi;
use Checkout\CheckoutApi;
use Checkout\CheckoutApiException;
use Checkout\Payments\Previous\PaymentRequest;
use Checkout\Payments\Request\PaymentRequest;
use Checkout\Payments\Request\Source\RequestTokenSource;
use Payum\Checkoutcom\Action\Api\BaseApiAwareAction;
use Payum\Core\Bridge\Spl\ArrayObject;
Expand Down Expand Up @@ -39,6 +39,7 @@ public function execute($request)
$requestTokenSource->token = $model['token'];

$paymentRequest = new PaymentRequest();
$paymentRequest->processing_channel_id = $this->api->getOptions()['channel_id'];
$paymentRequest->amount = $model['amount'];
$paymentRequest->source = $requestTokenSource;
$paymentRequest->currency = $model['currency'];
Expand Down
2 changes: 1 addition & 1 deletion Action/CancelAction.php
Expand Up @@ -4,7 +4,7 @@

namespace Payum\Checkoutcom\Action;

use Checkout\Previous\CheckoutApi;
use Checkout\CheckoutApi;
use Checkout\CheckoutApiException;
use Payum\Checkoutcom\Action\Api\BaseApiAwareAction;
use Payum\Core\Bridge\Spl\ArrayObject;
Expand Down
4 changes: 2 additions & 2 deletions Action/CaptureAction.php
Expand Up @@ -4,9 +4,9 @@

namespace Payum\Checkoutcom\Action;

use Checkout\Previous\CheckoutApi;
use Checkout\CheckoutApi;
use Checkout\CheckoutApiException;
use Checkout\Payments\Previous\CaptureRequest;
use Checkout\Payments\CaptureRequest;
use Payum\Checkoutcom\Action\Api\BaseApiAwareAction;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\GatewayAwareTrait;
Expand Down
2 changes: 1 addition & 1 deletion Action/RefundAction.php
Expand Up @@ -4,7 +4,7 @@

namespace Payum\Checkoutcom\Action;

use Checkout\Previous\CheckoutApi;
use Checkout\CheckoutApi;
use Checkout\CheckoutApiException;
use Checkout\Payments\RefundRequest;
use Payum\Checkoutcom\Action\Api\BaseApiAwareAction;
Expand Down
2 changes: 1 addition & 1 deletion Action/SyncAction.php
Expand Up @@ -4,7 +4,7 @@

namespace Payum\Checkoutcom\Action;

use Checkout\Previous\CheckoutApi;
use Checkout\CheckoutApi;
use Checkout\CheckoutApiException;
use Payum\Checkoutcom\Action\Api\BaseApiAwareAction;
use Payum\Core\Bridge\Spl\ArrayObject;
Expand Down
5 changes: 2 additions & 3 deletions Api.php
Expand Up @@ -7,7 +7,7 @@

use Checkout\CheckoutSdk;
use Checkout\Environment;
use Checkout\Previous\CheckoutApi;
use Checkout\CheckoutApi;
use Payum\Checkoutcom\Checkout\HttpClientBuilder;

class Api
Expand All @@ -31,9 +31,8 @@ public function __construct(array $options)
public function getCheckoutApi(): CheckoutApi
{
return CheckoutSdk::builder()
->previous()
->staticKeys()
->secretKey($this->options['secrety_key'])
->secretKey($this->options['secret_key'])
->environment($this->options['environment'] === self::PRODUCTION ? Environment::production() : Environment::sandbox())
->build();
}
Expand Down
10 changes: 6 additions & 4 deletions CheckoutcomGatewayFactory.php
Expand Up @@ -38,15 +38,17 @@ protected function populateConfig(ArrayObject $config)
'environment' => Api::TEST,
);
$config->defaults($config['payum.default_options']);
$config['payum.required_options'] = ['publishable_key'];
$config['payum.required_options'] = ['secrety_key'];
$config['payum.required_options'] = ['public_key'];
$config['payum.required_options'] = ['secret_key'];
$config['payum.required_options'] = ['channel_id'];

$config['payum.api'] = function (ArrayObject $config) {
$config->validateNotEmpty($config['payum.required_options']);
$checkoutcomConfig = [
'publishable_key' => $config['publishable_key'],
'secrety_key' => $config['secrety_key'],
'public_key' => $config['public_key'],
'secret_key' => $config['secret_key'],
'environment' => $config['environment'],
'channel_id' => $config['channel_id'],
];

$checkoutcomConfig['checkoutjs_path'] =
Expand Down

0 comments on commit df7c2a3

Please sign in to comment.