Commit c59d50e5 authored by Ankitha Shetty's avatar Ankitha Shetty Committed by jyoti
Browse files

Issue #3255761 by ankithashetty, no_one, tdnshah, i-trokhanenko, kevinsiji,...

Issue #3255761 by ankithashetty, no_one, tdnshah, i-trokhanenko, kevinsiji, nehajyoti: Key ID and secret not showing on configuration page
parent 2e54669a
Loading
Loading
Loading
Loading
+32 −14
Original line number Diff line number Diff line
@@ -5,13 +5,17 @@ namespace Drupal\commerce_razorpay\Plugin\Commerce\PaymentGateway;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\commerce_payment\Entity\PaymentInterface;
use Drupal\commerce_payment\Exception\InvalidRequestException;
use Drupal\commerce_payment\PaymentMethodTypeManager;
use Drupal\commerce_payment\PaymentTypeManager;
use Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\OffsitePaymentGatewayBase;
use Drupal\commerce_price\MinorUnitsConverterInterface;
use Drupal\commerce_price\Price;
use Drupal\Core\Form\FormStateInterface;
use GuzzleHttp\Exception\RequestException;
use Razorpay\Api\Api;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
@@ -32,29 +36,43 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 */
class RazorpayRedirect extends OffsitePaymentGatewayBase {

  /**
   * The Time Interface
   *
   * @var \Drupal\Component\Datetime\TimeInterface
   */
  protected $dateTime;

  /**
   * Constructs a RazorpayRedirect object.
   *
   * @param \Drupal\Component\Datetime\TimeInterface $dateTime
   *   The time interface.
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\commerce_payment\PaymentTypeManager $payment_type_manager
   *   The payment type manager.
   * @param \Drupal\commerce_payment\PaymentMethodTypeManager $payment_method_type_manager
   *   The payment method type manager.
   * @param \Drupal\Component\Datetime\TimeInterface $time
   *   The time.
   * @param \Drupal\commerce_price\MinorUnitsConverterInterface $minor_units_converter
   *   The minor units converter.
   */
  public function __construct(TimeInterface $dateTime) {
    $this->dateTime = $dateTime;
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, PaymentTypeManager $payment_type_manager, PaymentMethodTypeManager $payment_method_type_manager, TimeInterface $time, MinorUnitsConverterInterface $minor_units_converter = NULL) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $payment_type_manager, $payment_method_type_manager, $time, $minor_units_converter);
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $container->get('datetime.time')
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('entity_type.manager'),
      $container->get('plugin.manager.commerce_payment_type'),
      $container->get('plugin.manager.commerce_payment_method_type'),
      $container->get('datetime.time'),
      $container->get('commerce_price.minor_units_converter'),
    );
  }

@@ -114,7 +132,7 @@ class RazorpayRedirect extends OffsitePaymentGatewayBase {
    // Succeessful.
    $message = '';
    $remote_status = '';
    $request_time = $this->dateTime->getRequestTime();
    $request_time = $this->time->getRequestTime();
    if ($status == "captured") {
      // Status is success.
      $remote_status = t('Success');