Skip to content

Instantly share code, notes, and snippets.

# à mettre dans mercanet/views.py dans MercanetViewSet
@csrf_exempt
@api_view(['POST'])
@authentication_classes([])
@permission_classes([])
@parser_classes((JSONParser,))
@csrf_exempt
@method_decorator(csrf_exempt)
{"Seal": "fc70595248c8951596bb3cf2fbde5a0dcceb0c0d64c45affc8fb8fdee8418a12", "InterfaceVersion": "HP_2.16", "Data": {"s10TransactionId": "86", "transactionDateTime": "2017-11-25T18:10:44+01:00", "maskedPan": "5017##########10", "preAuthenticationValue": "null", "mandateUsage": "null", "instalmentAmountsList": "null", "valueDate": "null", "captureLimitDate": "20171125", "s10transactionIdsList": "null", "dccResponseCode": "null", "paymentMeanBrand": "VISA", "orderChannel": "INTERNET", "cardProductCode": "F", "acquirerResponseMessage": "null", "amount": "123", "transactionActors": "null", "paymentMeanTradingName": "null", "paymentMeanType": "CARD", "paymentMeanId": "null", "mandateCertificationType": "null", "dccProvider": "null", "holderAuthentRelegation": "N", "acquirerResponseIdentifier": "null", "mandateId": "null", "mandateAuthentMethod": "null", "instalmentNumber": "null", "customerMobilePhone": "null", "complementaryCode": "00", "responseCode": "00", "preAuthenticationProfile": "null", "dccExchangeRate":
@JeanRibes
JeanRibes / gist:18e833c4121e5e00e2890f2cce3e8bda
Created November 28, 2017 20:54
réponse client Mercanet (avec httpbin.org/post)
{
"args": {},
"data": "",
"files": {},
"form": {
"Data": "captureDay=0|captureMode=AUTHOR_CAPTURE|currencyCode=978|merchantId=211000021310001|orderChannel=INTERNET|responseCode=00|transactionDateTime=2017-11-28T21:53:00+01:00|transactionReference=2017112821632667547e7cd3e0466547863|keyVersion=1|acquirerResponseCode=00|amount=279|authorisationId=672173|panExpiryDate=201801|paymentMeanBrand=VISA|paymentMeanType=CARD|complementaryCode=00|complementaryInfo=<CARD_INFOS BDOM=XXX COUNTRY=FRA PRODUCTCODE=F NETWORK=VISA BANKCODE=20041 PRODUCTNAME=VISA CLASSIC PRODUCTPROFILE=XXX />|customerIpAddress=134.214.181.92|maskedPan=5017##########01|scoreProfile=profil1|holderAuthentRelegation=N|holderAuthentStatus=NOT_ENROLLED|transactionOrigin=INTERNET|paymentPattern=ONE_SHOT|customerMobilePhone=null|mandateAuthentMethod=null|mandateUsage=null|transactionActors=null|mandateId=null|captureLimitDate=20171128|dccStatus=null|dccResponseCode=null|dccAmount=null|dccCurrencyCode=null|dccExchangeRate=null|dccExchangeRa
@JeanRibes
JeanRibes / build.xml
Created November 18, 2018 09:58
Boilerplate Ant pour des projets Java simples avec dépendances
<project name="chat" default="all" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Paramètres du projet -->
<property name="projet.sources.dir" value="src"/>
<property name="projet.lib.dir" value="lib"/>
<property name="projet.jar.file" value="release.jar"/>
<property name="projet.bin.dir" value="out"/>
<property name="projet.class.main" value="MaClassePrincipale" />
<!-- Dépendances du projet-->
<target name="resolve" depends="install-ivy,setup" description="Use ivy to resolve classpaths">
<ivy:retrieve pathid="libs.path">
@JeanRibes
JeanRibes / arrow-prompt-builder.sh
Created December 1, 2018 16:56
create a stylish bash prompt with powerline-like arrows
#!/bin/bash
# Use this script to create a cool bash prompt: paste the output into your .bashrc
# look https://misc.flogisoft.com/bash/tip_colors_and_formatting#colors1 to get a list of available colors for 256-color terminals
# also, if you do not see the '>' character in your terminal, install the powerline fonts
PS1=""
lastbg=-1
function append {
PS1+="$1"
}
function color {
@JeanRibes
JeanRibes / logoskell.hs
Last active November 27, 2019 23:23
ELP Logoskell
import Prelude hiding (Left, Right)
data Instruction = Forward Int| Left Int| Right Int| Repeat Int [Instruction] deriving (Show, Read)
derouler [] a = a
derouler (i:rprog) a = case i of
(Repeat x ri)->derouler rprog ((concat (replicate x (derouler ri [])) )++a)
_ ->derouler rprog (i:a)
points [] posx posy angle pts = pts
points (i:rprog) posx posy angle pts = case i of
Left t->points rprog posx posy (angle+((realToFrac t)*3.1415/180)) pts
@JeanRibes
JeanRibes / haskell-powerline-prompt-generator.hs
Last active January 2, 2020 11:33
Powerline prompt generator for bash, in haskell
--EXAMPLE : of course you need GHC installed, and ghci's `runhaskell
-- wanted prompt : [Segment 8 202 [Bold,Text " \\u "],Segment 202 16 [Bold,Text "@ "],Segment 240 255 [Underline,Text "\\H",StopUnderline,Text " "],Segment 220 16 [Bold,Text "$ "]]
-- run in shell export PS1=$(echo '[Segment 8 202 [Bold,Text " \\u "],Segment 202 16 [Bold,Text "@ "],Segment 240 255 [Underline,Text "\\H",StopUnderline,Text " "],Segment 220 16 [Bold,Text "$ "]]' | runhaskell haskell-powerline-prompt-generator.hs )
-- my prompt : [Segment 10 202 [Bold,Text " \\u "],Segment 202 16 [Bold,Text "\\H "],Segment 12 231 [Underline,Text "\\w",StopUnderline,Text " "],Segment 220 16 [Bold,Text "$ "]]
data PromptPart = ForegroundColor Int |BackgroundColor Int | Bold| StopBold|Underline|StopUnderline | Text String | Reset
deriving (Show, Read, Ord, Eq)
data Segment = Segment Int Int [PromptPart] deriving (Show, Read, Ord, Eq)
-- bg fg
@JeanRibes
JeanRibes / chat.py
Last active January 2, 2020 21:47
broadcast python chat
from socket import socket, AF_INET, SOCK_DGRAM, IPPROTO_UDP, SOL_SOCKET, SO_BROADCAST, SO_REUSEPORT, SO_REUSEADDR
from threading import Thread
import sys
import readline
class NetworkListener(Thread):
def __init__(self, sock, run):
self.sock = sock
self.running=run
super().__init__()
self.daemon = True
@JeanRibes
JeanRibes / .vimrc
Last active August 16, 2023 14:55
Fichier de conf pour VIM
set ts=4
set sw=4
augroup configgroup
autocmd VimEnter * highlight clear SignColumn
autocmd FileType python set sw=4
autocmd FileType python let python_highlight_all = 1
autocmd FileType python set ts=4
autocmd FileType python set sts=4
" " expand tabs into spaces
autocmd FileType python set expandtab
@JeanRibes
JeanRibes / README.md
Last active June 7, 2020 17:36
code pour un clavier PS/2 attaché à une arduino qui siffle en morse le texte entré. les keypress sont envoyés en I2C à un raspebrry pi et l'arduino siffle aussi les requêtes I2C