Uploaded image for project: 'WPWC_RESURS'
  1. WPWC_RESURS
  2. RWC-82

Make sure payment gateways are country based

    XMLWordPrintable

    Details

    • Type: Task
    • Status: To Do (View Workflow)
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 1.0.0, 0.0.1.0
    • Component/s: None
    • Labels:
      None

      Description

      Template:

      function woocommerce_resurs_bank_available_payment_gateways($gateways)
      {
          unset($gateways['resurs-bank']);
          global $woocommerce;
      
          $selectedCountry = getResursOption('country');
      
          $customerCountry = isset($woocommerce->customer) &&
          method_exists($woocommerce->customer, 'get_billing_country') ?
              $woocommerce->customer->get_billing_country() : '';
      
          // Do not distribute payment methods for countries that do not belong to current
          // Resurs setup, with an exception for VISA/Mastercard.
          if (strtolower($customerCountry) !== strtolower($selectedCountry)) {
              foreach ($gateways as $gatewayName => $gatewayClass) {
                  if (preg_match('/^resurs_bank_nr/i', $gatewayName)) {
                      $type = isset($gatewayClass->type) ? $gatewayClass->type : '';
                      $specificType = isset($gatewayClass->specificType) ? $gatewayClass->specificType : '';
      
                      if (strtoupper($type) === 'PAYMENT_PROVIDER' && preg_match('/card/i', $specificType)) {
                          continue;
                      }
                      unset($gateways[$gatewayName]);
                  }
              }
          }
      
          return $gateways;
      }
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            Tornevall Tomas Tornevall
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration