How to create custom payment gateway in magento?

The only things I need:

  1. Get order id and customer id.
  2. Create redirect url (this must be done on backend, url is signed with private hash)
  3. Redirect user to this user
  4. Upon success verify signature of redirect data and set order status
  5. Upon failure verify signature of redirect data and set order status

Is there some simple module, which does these things so I can modify it for my needs?
This module should not use deprecated AbstractMethod, if possible.

I’m new to magento and documentation about payment gateway is too bloated. Plus it is hard to understant all these config pools and commands in configuration.

P.S. Magento 2 only with new payment gateway api.

.NET Core API – Postman returning error on POST request

I’m learning .NET Core API Web from this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-vsc

As in the tutorial says, I have a Model called TodoItems

I can send GET requests, but I cannot send any POST request to create a TodoItem to my API Web (please head to the “Use Postman to send a Create request” section from the tutorial link above)

I have done exactly as the tutorial, but I got the Unexpected “<“ error on Postman on POST request enter image description here

Please help.

how to grab all the positions of an array and insert individuality into the database

I have a post communication from an application that is in nodejs, it sends me some information that does not change and an array that contains 7 positions and I need to merge this information to insert into the database, I need to get the information that is fixed and one position the array and insert into the database until you read the 7 positions and thus finalize the insertion. But I do not know how I can do this, to insert information in the database I can do normal, I just do not know how to gather the fixed information and get an array position.

here is where I get the json information and insert

var rotina = req.body;
console.log(“processando uma requisição de rotina”);

  var connection = app.persistencia.connectionFactory();
  var pagamentoDao = new app.persistencia.PagamentoDao(connection);

  pagamentoDao.inserir(rotina, function(erro, resultado){

    if (erro){
      console.log('Erro ao gravar' + erro);
      res.status(400).send(erro);

    }else {
      rotina.id = resultado.insertId;
      console.log('Rotina Criada');
      res.status(400).send(rotina);
    }
  });

});

Using django CSRF middleware with views returning JsonResponse

I want to use CSRF middleware with API Views in Django. Here is a demo view I want to use CSRF with, I am confused how to integrate CSRF here.

def login(request):
    try:
        if len(DemoTable.objects.filter(phone=int(request.POST['user'])).filter(password=sha1Engine(request.POST['password'])))==1:
            print(DemoTable.objects.filter(phone=int(request.POST['user'])).filter(password=sha1Engine(request.POST['password'])))
            return JsonResponse({'exit':'0','msg':'Success'})
        return JsonResponse({'exit':'2','msg':'User Invalid'})
    except Exception as e:
        return JsonResponse({'exit':'10','msg':'Unknown Error Occured'})

Any help or suggestions will be appreciated. Thanks.

Node JS – Can’t access object property in response from bing api [on hold]

I’m not sure why but I cant seem to access

insightsMetadata.bestRepresentativeQuery.displayText  

I get the error,

“TypeError: Cannot read property displayText of undefined”.

However if I only do insightsMetadata.bestRepresentativeQuery without the displayText, then it works.

response.on("end", function () {
  res.send(JSON.stringify(JSON.parse(body).value.map(fparse)));
});

function fparse(x) {
  return {
    "imgurl": x.contentUrl,
    "pageurl": x.hostPageUrl,
    "text": x.insightsMetadata.bestRepresentativeQuery.displayText
  };
}

Here body.value =

[{
  "webSearchUrl": "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&q=game&id=36E72804745FE79ECC3893A40AC37DC21388AED0&simid=607991320506073945",
  "name": "MiikaHweb - Game : Split/Second",
  "thumbnailUrl": "https://tse1.mm.bing.net/th?id=OIP.shPW1dfbCt73MbeL-EXUrAHaF7&pid=Api",
  "datePublished": "2011-05-02T06:16:00.0000000Z",
  "contentUrl": "http://miikahweb.com/game/splitsecond04.jpg",
  "hostPageUrl": "http://www.miikahweb.com/en/games/free/splitsecond",
  "contentSize": "508884 B",
  "encodingFormat": "jpeg",
  "hostPageDisplayUrl": "www.miikahweb.com/en/games/free/splitsecond",
  "width": 1280,
  "height": 1024,
  "thumbnail": { "width": 474, "height": 379 },
  "imageInsightsToken": "ccid_shPW1dfb*mid_36E72804745FE79ECC3893A40AC37DC21388AED0*simid_607991320506073945*thid_OIP.shPW1dfbCt73MbeL-EXUrAHaF7",
  "insightsMetadata": {
    "recipeSourcesCount": 0,
    "bestRepresentativeQuery": {
      "text": "Split Second Game",
      "displayText": "Split Second Game",
      "webSearchUrl": "https://www.bing.com/images/search?q=Split+Second+Game&id=36E72804745FE79ECC3893A40AC37DC21388AED0&FORM=IDBQDM"
    },
    "pagesIncludingCount": 5,
    "availableSizesCount": 1
  },
  "imageId": "36E72804745FE79ECC3893A40AC37DC21388AED0",
  "accentColor": "1B4662"
}]

redirect and masking a domain on a restful api

so I’m very new to node.js and back-end.
I’ve just deployed a restful api on AWS just as a little test, it really does nothing special, only some get-post requests updating a json.
It works as expected.

Problem is: the address is of course very long so i also wanted to redirect the requests from a domain easy to remember.
And so i did.
If the domain is unmasked, it works fine, and i can for example get a json:
apiunmasked.pileoni.site/all
Settings on namecheap:
enter image description here

If i do try to mask it, it still works but the browser don’t format it as a json:
api.pileoni.site/all.
enter image description here

Also there is something weird in the marging that happen with the masked version on the main page:
api.pileoni.site
apiunmasked.pileoni.site

I guess is some wrong setting on namecheap?

Thanks

select Query for product based on category for food app

I want to select product based on caegory..Sample json format i want

And my table structure for store_category
enter image description here
And my table structure for store_product
enter image description here

[
{
  "category_id": "1",
  "cat_title": "Breakfast",

  "products": [
    {
      "id": "4",
      "parent_id":"1",
      "product_name":"Burger Xl",
      "price":"60",

      "product_img":"https://hdwallpapers8k.com/wp-content/uploads/hamburger-photography-hd-wallpaper-1920x1080-18994-1680x1050.jpg"

    }
  ]
},
{
  "category_id": "2",
  "cat_title": "Lunch",

  "products": [
    {
      "id": "6",
      "parent_id":"2",
      "product_name":"Fish Meals",
          "price":"100",

      "product_img":"https://hdwallpapers8k.com/wp-content/uploads/fish-meal-photography-hd-wallpaper-1920x1080-33229-1680x1050.jpg"

    }
  ]
}

]

How to select all product based on category in json format so that i can use as api for my food app.

Create External Order in Cdiscount API

Can anybody help me out I am trying to use function “create external order” in Cdiscount using curl php and I am using
use soap api

soap action=”http://www.cdiscount.com/IMarketplaceAPIService/CreateExternalOrder”

and post my data to url=”http://Prod/MarketplaceAPIService.svc”.

but I am not getting the output to be success, please check the code and let me know what wrong I did

soap request is ok, just getting issue in url

$header = array(

    "Content-type: text/xml;charset=\"utf-8\"",
    "Accept-Encoding: gzip,deflate",
    "Cache-Control: no-cache",
    "Pragma: no-cache",
    "SOAPAction: \"http://www.cdiscount.com/IMarketplaceAPIService/CreateExternalOrder",
    "Content-length: ".strlen($soap_request),
);

$soap_do = curl_init();

curl_setopt($soap_do, CURLOPT_URL, "http://Prod/MarketplaceAPIService.svc" );

curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );

curl_setopt($soap_do, CURLOPT_POST, true );

curl_setopt($soap_do, CURLOPT_POSTFIELDS,  $soap_request);

curl_setopt($soap_do, CURLOPT_HTTPHEADER,  $header);

$result = curl_exec($soap_do);