In Commerce 2, how can we allow users with a role to bypass payment during checkout (bill me later)

We have a Commerce 2 site that we need to be able to assign users a role (‘Bill Me Later’) that will allow the user to select the payment option ‘Bill Me Later’ during checkout.

I have not found a module that provides this functionality. I started to dive into creating a custom payment processor but I’m not sure if this is the correct route to go. If the user were to select ‘Bill Me Later’ then no further information would be needed. The order would go through (completed) but now marked paid.

Could someone offer some insight into the best way to achieve this? We’re open to building a custom payment gateway module if that is required but could use a little guidance as to get started since this technically is not a payment gateway.

How to remove payment gateway for users with a specific role?

We have a Drupal 8 Commerce 2 site that needs to dynamically remove the payment gateway for users with a specific role that will be ‘billed later’.

The conditions for the payment gateways all showing a gateway for specific roles but does not allow for negating the settings.

Is there a way to accomplish allow customers with a role to bypass payment during checkout? Is there a hook that we can use to perhaps accomplish this through code since we can’t negate the setting in the UI?

Component playing OSI layer role during browser to server communication?

I have gone through OSI model and got the high level understand of this model. While going through it I am trying to find out which component on my computer plays the role of which layer when I type google.com on browser

My understanding:-

  1. Browser plays the role of Application/Presentation/Session layer as it collects the data from user/ encode it to present to lower layer/ establishes the socket connect connection to maintain the session. Right ?

  2. Not sure which software/hardware component is playing the role of transport layer / network layer/data link layer/physical layer ?

Role of weak entities in avoiding inconsistencies

My material on database claims that:

Weak entities help to avoid data duplication and inconsistencies arising due to duplicating the key of the strong entity.

My question is how can a strong entity key even be duplicated? This would make the key lose its uniqueness property.

Can anyone please help? How is the statement provided in the material justified?

Thanks in advance!

Component playing the role of each layer in browser to server communication?

I have gone through OSI model and got the high level understand of this model. While going through it I am trying to find out which component on my computer plays the role of which layer when I type google.com on browser

My understanding:-

  1. Browser plays the role of Application/Presentation/Session layer as it collects the data from user/ encode it to present to lower layer/ establishes the socket connect connection to maintain the session. Right ?

  2. Not sure who is playing the role of transport layer / network layer/data link layer/physical layer ?

Add Media button of WP_Editor on custom role profile page not working

I have a custom role defined which has a separate profile page in the front-end. In the profile page there is a wp_editor with Add Media button. But the image is not being attached. This is the error seen when uploading the image – Sorry, you are not allowed to attach files to this post.

This is the capability of the custom role:

$  admins = get_role( 'trip_vendor' ); $  admins->add_cap( 'upload_files' ); $  admins->add_cap( 'level_1' ); $  admins->add_cap( 'edit_post' );                                                    $  admins->add_cap( 'edit_posts' );  $  admins->add_cap( 'edit_other_posts' );  $  admins->add_cap( 'publish_posts' );  $  admins->add_cap( 'read_post' );  $  admins->add_cap( 'read_private_posts' );  $  admins->add_cap( 'delete_post' ); $  admins->add_cap( 'can_edit_posts' ); 

This is how the custom role is logged in with ajax:

$  user = $  _POST['user'];         $  pass = $  _POST['pass'];         $  creds = array();         $  creds['user_login'] = $  user;         $  creds['user_password'] = $  pass;         $  creds['remember'] = true;         $  user = wp_signon( $  creds, is_ssl() );         if ( is_wp_error($  user) )          {           $  result['type'] = 'failed';           $  result['message'] = __( 'Incorrect Login Credentials!.', 'wp-travel-engine' );             if ( defined( 'DOING_AJAX' ) && DOING_AJAX )             {                $  result = json_encode($  result);                echo $  result;             }         }         else{             $  _SESSION['login'] = 'login';             $  _SESSION['user'] = $  user;             $  _SESSION['pass'] = $  pass;             $  result['type'] = 'success';             $  result['message'] = __( 'Logging In...', 'wp-travel-engine' );             if ( defined( 'DOING_AJAX' ) && DOING_AJAX )             {                 $  result = json_encode($  result);                 echo $  result;             }         } 

Can someone please provide some guidelines on this?

discord.js mandar mensagens privadas programadas para user com uma role

Ola

Nao sei se alguem tem conhecimento de discord.js porem mesmo assim vou perguntar

Estou fazendo um pequeno guia de aluno, ou seja, algo que possa avisar o aluno do que esta acontecendo na sua vida escolar

O que estou tentando fazer nao e mandar mensagens privadas programadas visto que uso node.schedule para tal, mas sim envialas para pessoas com uma role especifica

    const botconfig = require('./botconfig.json'); const token = '*'; const Discord = require('discord.js'); const schedule = require('node-schedule'); const client = new Discord.Client(); var classA = '?'; var sumaryA = '?'; var profA = '?';  client.on('ready', () => {   console.log(`Logged in as $  {client.user.tag}!`);      var class8_30 = schedule.scheduleJob({hour: 8, minute: 30, dayOfWeek: 1}, function(){     classA = 'English';      client.users.get("500087456046120961").send("Class now");   });  });  client.on('message', msg => {    if (msg.content === 'ping') {     msg.reply('pong');   }    if(msg.content.toLowerCase().startsWith('!myclassis')){     var args = msg.content.toLowerCase().split(' ');     console.log(args);     if(args[1] === '10a'){       var t10A = msg.guild.roles.find('name', 'Class_10A');       msg.member.addRole(t10A.id);       msg.channel.send('You\'re now part of class 10A');     }   }    if (msg.content.toLowerCase() === "class"){     let c10A = msg.guild.roles.find("name", "Class_10A");     if (msg.member.roles.has(c10A.id))          msg.author.send(aulaA);   }  });  client.login(token); 

A forma que tenho agora e mandar mensagem por id o que e bastante (in)pratico e nao e automatico, ja vi uma quantidade enorme de videos, ja li os docs mas eu nao consigo encontrar em lado nenhum porem acho que existe

Se alguem me pudesse ajudar eu agradecia pela ajuda e pelo tempo gasto com este meu problema 🙂

Obs: peco desculpas pela falta de acentos, teclado ingles em linux ingles :/ Obs 2: discord.js nao tem reputacao suficiente nas tags por isso coloquei no titulo