| 1 |
<?php |
| 2 |
|
| 3 |
namespace BitCode\BitForm\Admin\Form\InitJs; |
| 4 |
|
| 5 |
use BitCode\BitForm\Admin\Form\Helpers; |
| 6 |
use BitCode\BitForm\Core\Integration\IntegrationHandler; |
| 7 |
|
| 8 |
class Razorpay { |
| 9 |
public static function init($fk, $config, $contentId) { |
| 10 |
$src = 'https://checkout.razorpay.com/v1/checkout.js'; |
| 11 |
$integrity = ''; |
| 12 |
|
| 13 |
$integrationHandler = new IntegrationHandler(0); |
| 14 |
$config = json_decode($config); |
| 15 |
$paypalIntegration = $integrationHandler->getAIntegration($config->payIntegID); |
| 16 |
$integrationDetails = json_decode($paypalIntegration[0]->integration_details); |
| 17 |
$clientID = $integrationDetails->apiKey; |
| 18 |
$config->clientId = $clientID; |
| 19 |
$config->contentId = $contentId; |
| 20 |
$config = json_encode($config); |
| 21 |
$id = 'razorpaysrc'; |
| 22 |
return Helpers::scriptLoader($src, $id, "window.bf_globals.{$contentId}.inits['{$fk}'] = new bit_razorpay_field(fld,{$config})", ".{$fk}-razorpay-wrp", [], $integrity, "{$contentId}"); |
| 23 |
} |
| 24 |
} |
| 25 |
|