language
stringclasses 15
values | src_encoding
stringclasses 34
values | length_bytes
int64 6
7.85M
| score
float64 1.5
5.69
| int_score
int64 2
5
| detected_licenses
listlengths 0
160
| license_type
stringclasses 2
values | text
stringlengths 9
7.85M
|
|---|---|---|---|---|---|---|---|
C#
|
UTF-8
| 1,180
| 3.125
| 3
|
[] |
no_license
|
using System;
using System.Windows.Input;
namespace VideoFeatureMatching.Utils
{
public class Command<T> : ICommand
{
private readonly Action<T> _action;
private readonly Func<T, bool> _canExecute;
public Command(Action<T> action)
: this(action, parametr => true)
{ }
public Command(Action<T> action, Func<T, bool> canExecute)
{
_action = action;
_canExecute = canExecute;
}
public Command(Action<T> action, Func<bool> canExecute)
: this(action, arg => canExecute())
{
}
public void Execute(T parametr)
{
if (CanExecute(parametr))
{
_action(parametr);
}
}
public bool CanExecute(T parametr)
{
return _canExecute.Invoke(parametr);
}
bool ICommand.CanExecute(object parametr)
{
return CanExecute((T)parametr);
}
void ICommand.Execute(object parametr)
{
Execute((T)parametr);
}
public event EventHandler CanExecuteChanged;
}
}
|
Markdown
|
UTF-8
| 1,880
| 2.796875
| 3
|
[] |
no_license
|
She's just woken up. The dim lighting of her room soft to her eyes.
Rolling over, she gathers the blankets around her and looks down at
herself. Smiling as she compares herself to a string bean or pea pod,
she shifts her thoughts over again.
The words are hesitant to come. _Depressed_. It wasn't official by any
means, a single therapist asking about it wasn't anything to worry about
right? She turns over again and resumes staring at the ceiling. It
didn't feel like it to her. After all, weren't people who were depressed
sad all the time?
She smiles. _Of course, I have tons of happy times! There are lots of
days where things are going well, and things are looking up!_ The
feeling inside doesn't seem to pass though. She tries again: _I'm really
lucky, I have some many things others don't have, I should be grateful_.
But the glow of her room which seemed comforting before now seems
gloomy. Eyebrow's furrowed, she tells herself again: _the doctor only
asked! that's not saying I am!_
Worried, she gets up and looks into the mirror. Staring at her own eyes
for a minute blankly until starting to feel silly. _What am I doing?_
Shaking her head, she stares herself down and opens her mouth.
**"Are you depressed?"**
The girl looking back at her face doesn't seem to give way. There's no
tick, no slight sign one way or the other. Closing her eyes she asks
herself again. Searching for an answer somewhere in her head. _Everyone
has ups and downs in life_, she thinks. _There's nothing wrong with
that, it's all part of growing_.
Opening and meeting her own eyes again she looks at herself. _Would I be
asking myself these questions if I wasn't?_. A bit of mist appears in
one of her eyes. _Would I be asking myself this if that doctor hadn't
asked first?_. Briefly turning away she slumps onto the bed and hugs a
pillow. Which one is it? Suggestion? Or reality?
|
PHP
|
UTF-8
| 54
| 2.859375
| 3
|
[] |
no_license
|
<?php
fscanf(STDIN, "%d", $x);
echo $x >= 0 ? $x : 0;
|
Markdown
|
UTF-8
| 2,764
| 2.875
| 3
|
[] |
no_license
|
---
layout: post
title: Fried chicken chops with cheese sauce
date: 2019-04-15 22:30:00 +0800
categories: Chinese_snacks_DIY
---
# Fried chicken chops with cheese sauce

# Introduction
**"Cheese is extracted from milk. It is rich in protein, calcium, fat, phosphorus and vitamins. It is a pure natural food.Material often used in West Point.The cheese slices into the chicken chops, after baking, cheese will melt, crisp appearance, chicken tender, cut into a piece, there is flow out, mouth satisfaction.**
# Materials
## Main material
Material|Quantity
--|--
Chicken breast|3 pieces
cheese slice|3 tablets
Egg|One
## accessories
Material|Quantity
--|--
breadcrumbs|Appropriate amount
salt|Appropriate amount
oil|Appropriate amount
sugar|Appropriate amount
Black pepper|Appropriate amount
Ginger slices|Appropriate amount
# Characteristics
Property|--
--|--
Flavor|Other
Technology|roast
time consuming|Twenty minutes
difficulty|ordinary
# Steps
## step 1:
Marinate chicken breast with salt, oil, sugar, black pepper and ginger slices until tasty. Seal and marinate for one hour.

## step 2:
Take out the salted chicken breast and cut the chicken breast flat from the side. Divide it into two parts.

## step 3:
Spread the chicken breast with cheese slices and cover the other.

## step 4:
Stir the eggs evenly and brush them with a brush.

## step 5:
The surface was covered with bread bran.

## step 6:
Spread grease paper on the baking tray and drain the chicken chops.

## step 7:
Preheat the oven at 190 degrees for 10 minutes. Place it in the middle and bake for 15-20 minutes.

## step 8:
Food in baking.

## step 9:
Sprinkle tomato sauce after baking.

## step 10:
Cut the cheese out of the oven and eat it while it's hot. The tomato paste is sour, sweet and sour. It tastes good.

# Tips
Chicken roast time is less than 20 minutes, remember not too long, otherwise the meat will become old, affecting the taste.
# Info
- From the world of gourmet food I love Baking Works
- Kitchenware used: electric oven
- Classification: snacks, household dishes, oven dishes, snacks
|
Java
|
UTF-8
| 176
| 1.8125
| 2
|
[] |
no_license
|
package com.MO.MatterOverdrive.gui.events;
/**
* Created by Simeon on 5/5/2015.
*/
public interface IListHandler
{
void ListSelectionChange(String name,int selected);
}
|
Java
|
UTF-8
| 10,399
| 2.0625
| 2
|
[] |
no_license
|
/**
*/
package statemachine.impl;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import statemachine.FinalState;
import statemachine.InitialState;
import statemachine.MyFSM;
import statemachine.State;
import statemachine.StatemachineFactory;
import statemachine.StatemachinePackage;
import statemachine.Transition;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Package</b>.
* <!-- end-user-doc -->
* @generated
*/
public class StatemachinePackageImpl extends EPackageImpl implements StatemachinePackage {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass myFSMEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass stateEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass transitionEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass initialStateEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass finalStateEClass = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
* <p>Note: the correct way to create the package is via the static
* factory method {@link #init init()}, which also performs
* initialization of the package, or returns the registered package,
* if one already exists.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.ecore.EPackage.Registry
* @see statemachine.StatemachinePackage#eNS_URI
* @see #init()
* @generated
*/
private StatemachinePackageImpl() {
super(eNS_URI, StatemachineFactory.eINSTANCE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static boolean isInited = false;
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link StatemachinePackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/
public static StatemachinePackage init() {
if (isInited)
return (StatemachinePackage) EPackage.Registry.INSTANCE.getEPackage(StatemachinePackage.eNS_URI);
// Obtain or create and register package
Object registeredStatemachinePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
StatemachinePackageImpl theStatemachinePackage = registeredStatemachinePackage instanceof StatemachinePackageImpl
? (StatemachinePackageImpl) registeredStatemachinePackage
: new StatemachinePackageImpl();
isInited = true;
// Create package meta-data objects
theStatemachinePackage.createPackageContents();
// Initialize created meta-data
theStatemachinePackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
theStatemachinePackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(StatemachinePackage.eNS_URI, theStatemachinePackage);
return theStatemachinePackage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMyFSM() {
return myFSMEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMyFSM_State() {
return (EReference) myFSMEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMyFSM_Tr() {
return (EReference) myFSMEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMyFSM_Name() {
return (EAttribute) myFSMEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMyFSM_Initialstate() {
return (EReference) myFSMEClass.getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getState() {
return stateEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getState_Name() {
return (EAttribute) stateEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTransition() {
return transitionEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getTransition_Name() {
return (EAttribute) transitionEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTransition_To() {
return (EReference) transitionEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getInitialState() {
return initialStateEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getFinalState() {
return finalStateEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTransition_From() {
return (EReference) transitionEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StatemachineFactory getStatemachineFactory() {
return (StatemachineFactory) getEFactoryInstance();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isCreated = false;
/**
* Creates the meta-model objects for the package. This method is
* guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createPackageContents() {
if (isCreated)
return;
isCreated = true;
// Create classes and their features
myFSMEClass = createEClass(MY_FSM);
createEReference(myFSMEClass, MY_FSM__STATE);
createEReference(myFSMEClass, MY_FSM__TR);
createEAttribute(myFSMEClass, MY_FSM__NAME);
createEReference(myFSMEClass, MY_FSM__INITIALSTATE);
stateEClass = createEClass(STATE);
createEAttribute(stateEClass, STATE__NAME);
transitionEClass = createEClass(TRANSITION);
createEAttribute(transitionEClass, TRANSITION__NAME);
createEReference(transitionEClass, TRANSITION__FROM);
createEReference(transitionEClass, TRANSITION__TO);
initialStateEClass = createEClass(INITIAL_STATE);
finalStateEClass = createEClass(FINAL_STATE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isInitialized = false;
/**
* Complete the initialization of the package and its meta-model. This
* method is guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void initializePackageContents() {
if (isInitialized)
return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
initialStateEClass.getESuperTypes().add(this.getState());
finalStateEClass.getESuperTypes().add(this.getState());
// Initialize classes, features, and operations; add parameters
initEClass(myFSMEClass, MyFSM.class, "MyFSM", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getMyFSM_State(), this.getState(), null, "state", null, 0, -1, MyFSM.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
IS_ORDERED);
initEReference(getMyFSM_Tr(), this.getTransition(), null, "tr", null, 0, -1, MyFSM.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
IS_ORDERED);
initEAttribute(getMyFSM_Name(), ecorePackage.getEString(), "name", null, 0, 1, MyFSM.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getMyFSM_Initialstate(), this.getInitialState(), null, "initialstate", null, 0, 1, MyFSM.class,
!IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE,
IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(stateEClass, State.class, "State", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getState_Name(), ecorePackage.getEString(), "name", null, 0, 1, State.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(transitionEClass, Transition.class, "Transition", !IS_ABSTRACT, !IS_INTERFACE,
IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getTransition_Name(), ecorePackage.getEString(), "name", null, 0, 1, Transition.class,
!IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getTransition_From(), this.getState(), null, "from", null, 0, 1, Transition.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
IS_ORDERED);
initEReference(getTransition_To(), this.getState(), null, "to", null, 0, 1, Transition.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
IS_ORDERED);
initEClass(initialStateEClass, InitialState.class, "InitialState", !IS_ABSTRACT, !IS_INTERFACE,
IS_GENERATED_INSTANCE_CLASS);
initEClass(finalStateEClass, FinalState.class, "FinalState", !IS_ABSTRACT, !IS_INTERFACE,
IS_GENERATED_INSTANCE_CLASS);
// Create resource
createResource(eNS_URI);
}
} //StatemachinePackageImpl
|
Python
|
UTF-8
| 195
| 3.28125
| 3
|
[] |
no_license
|
nama = 'Ahmad Rizky Febianto'
nim = 212410102097
umur = '18 tahun'
tinggi_badan = 172.5
berat_badan = 65
print(nama)
print(nim)
print(umur)
print(tinggi_badan, 'cm')
print(berat_badan, 'Kg')
|
C
|
UTF-8
| 1,665
| 3.484375
| 3
|
[] |
no_license
|
/*
** EPITECH PROJECT, 2019
** PSU_minishell1_2018
** File description:
** minishell1
*/
#include "include_linked_list/linked_list.h"
void norme_function(list_t *list, elem_t *new_elem, int pos)
{
int i = 0;
for (elem_t *elem = list->start; elem != NULL
&& i < pos; elem = elem->next, i++) {
new_elem->next = elem->next;
new_elem->prev = elem;
elem->next = new_elem;
new_elem->next->prev = new_elem;
list->size++;
}
}
bool push_elem_haroun(list_t *list, char *data, int pos)
{
elem_t *new_elem = create_new_elem_haroun(data);
if (list->end == NULL && new_elem != NULL)
push_back_haroun(list, data);
else if (list->start == NULL && new_elem != NULL)
push_front_haroun(list, data);
else
norme_function(list, new_elem, pos);
return (true);
}
bool push_back_haroun(list_t *list, char *data)
{
elem_t *elem = create_new_elem_haroun(data);
if (elem == NULL)
return (false);
if (list->end == NULL) {
list->end = elem;
list->start = elem;
list->size++;
} else {
list->end->next = elem;
elem->prev = list->end;
list->end = elem;
list->size++;
}
return (true);
}
bool push_front_haroun(list_t *list, char *data)
{
elem_t *elem = create_new_elem_haroun(data);
if (elem == NULL)
return (false);
if (list->start == NULL) {
list->end = elem;
list->start = elem;
list->size++;
} else {
list->start->prev = elem;
elem->next = list->start;
list->start = elem;
list->size++;
}
return (true);
}
|
Markdown
|
UTF-8
| 1,929
| 3.296875
| 3
|
[
"LicenseRef-scancode-free-unknown",
"MIT"
] |
permissive
|
---
sidebar_position: 2
sidebar_label: Panel
---
# Module: Panel
An extension can register a Panel Module by defining a `getPanelModule` method.
The panel module provides the ability to define `menuOptions` and `components`
that can be used by the consuming application. `components` are React Components
that can be displayed in the consuming application's "Panel" Component.

<center><i>A panel extension example</i></center>
The `menuOptions`'s `target` key points to a registered `components`'s `id`. A
`defaultContext` is applied to all `menuOption`s; however, each `menuOption` can
optional provide it's own `context` value.
The `getPanelModule` receives an object containing the `ExtensionManager`'s
associated `ServicesManager` and `CommandsManager`.
```js
import MyComponent from './MyComponent.js';
export default {
id: 'example-panel-module',
/**
* @param {object} params
* @param {ServicesManager} params.servicesManager
* @param {CommandsManager} params.commandsManager
*/
getPanelModule({ servicesManager, commandsManager }) {
return {
menuOptions: [
{
// A suggested icon
// Available icons determined by consuming app
icon: 'list',
// A suggested label
label: 'Magic',
// 'right' or 'left'
from: 'right',
// The target component to toggle open/close
target: 'target-component-id',
// UI Hint; If the target panel is in a "disabled" state
isDisabled: studies => {
return false;
},
// Overrides `defaultContext`, if specified
context: ['ACTIVE_VIEWPORT:MAGIC'],
},
],
components: [
{
id: 'target-component-id',
component: MyComponent,
},
],
defaultContext: ['ROUTE:VIEWER'],
};
},
};
```
|
C#
|
UTF-8
| 1,230
| 2.71875
| 3
|
[
"MIT"
] |
permissive
|
using MJKProjectsDAL.Models.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Microsoft.EntityFrameworkCore;
namespace MJKProjectsDAL.Models
{
[Table("projects")]
public class Project : DBModelBase
{
[Required]
[Column("project_title")]
public string Title { get; set; }
[Required]
[Column("project_content")]
public string Content { get; set; }
[Column("project_post_slug")]
public string Slug { get; set; }
public string ShortContent()
{
return Content.Substring(0, Content.Length < 200 ? Content.Length - 1 : 200);
}
public static Project MakeProject(string title, string content)
{
return new Project()
{
Title = title,
Content = content,
};
}
public virtual string AllCapsTitle()
{
return Title.ToUpper();
}
public virtual string TitleToURL()
{
return Title.ToLower().Replace(' ', '-');
}
}
}
|
C#
|
UTF-8
| 2,305
| 2.921875
| 3
|
[] |
no_license
|
using TMPro;
using UnityEngine;
namespace Managers
{
public class ScoreManager : MonoBehaviour
{
private int _score, _lines, _level;
private bool _didLevelUp;
[SerializeField] private int linesPerLevel = 5;
private const int MinLines = 1;
private const int MaxLines = 4;
[SerializeField] private TextMeshProUGUI scoreText, linesText, levelText;
// Start is called before the first frame update
private void Start()
{
Reset();
UpdateUIText();
if (!scoreText || !linesText || !levelText)
Debug.Log("Text element references not set!");
}
public void Reset()
{
_level = 1;
_lines = linesPerLevel * _level;
}
public void ScoreLines(int numberOfLines)
{
numberOfLines = Mathf.Clamp(numberOfLines, MinLines, MaxLines);
_didLevelUp = false;
switch (numberOfLines)
{
case 1:
_score += 40 * _level;
break;
case 2:
_score += 100 * _level;
break;
case 3:
_score += 300 * _level;
break;
case 4:
_score += 1200 * _level;
break;
}
_lines -= numberOfLines;
if (_lines <= 0)
LevelUp();
UpdateUIText();
}
private void UpdateUIText()
{
scoreText.text = PadZero(_score, 5);
linesText.text = _lines.ToString();
levelText.text = _level.ToString();
}
private static string PadZero(int number, int numberOfDigits)
{
string numberStr = number.ToString();
while (numberStr.Length < numberOfDigits)
{
numberStr = "0" + numberStr;
}
return numberStr;
}
private void LevelUp()
{
_level++;
_lines = linesPerLevel * _level;
_didLevelUp = true;
}
public bool GetDidLevelUp() => _didLevelUp;
public int GetLevel() => _level;
}
}
|
Markdown
|
UTF-8
| 1,094
| 3.25
| 3
|
[] |
no_license
|
# SuperJDBC
Turn your Java models into Super Models
This is a lightweight Java library that lets you concentrate on your application's logic rather than database stuff. No more SQL
in your code. Yes, there is Hibernate, ActiveJDBC, ActiveJPA and so on but this is much simpler to get started with and use.
And, it is customizable and extensible.
### Getting Started
1. Put JAR in your classpath
2. Have the models you want to interact with the database extend `SuperModel`
3. This library is a bit opinionated so, make sure you follow the conventions below for this to work smoothly
4. Create a runnable class (with a main method) to run database migrations
And, off you go!
### Conventions
1. Model name should to be in singular form. This is mapped to a table whose name is the plural of the class name. If you provide
a name which is already plural or whose plural form cannot be determined, 'es' will be appended to the class name. This is all
abstracted away so you won't have a problem with it. But, it is recommended that the model names are in singular form
|
Java
|
UTF-8
| 1,271
| 2.3125
| 2
|
[
"Apache-2.0"
] |
permissive
|
package hu.unideb.inf.rft.neuban.service.annotations.validators;
import hu.unideb.inf.rft.neuban.service.annotations.FieldMatch;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
@Slf4j
public class FieldMatchConstraintValidator implements ConstraintValidator<FieldMatch, Object> {
private String firstFieldName;
private String secondFieldName;
@Override
public void initialize(final FieldMatch fieldMatch) {
firstFieldName = fieldMatch.firstFieldName();
secondFieldName = fieldMatch.secondFieldName();
}
@Override
public boolean isValid(final Object value, final ConstraintValidatorContext constraintValidatorContext) {
try {
final Object firstObject = BeanUtils.getProperty(value, firstFieldName);
final Object secondObject = BeanUtils.getProperty(value, secondFieldName);
return firstObject == null && secondObject == null || firstObject != null && firstObject.equals(secondObject);
} catch (final Exception e) {
log.debug(FieldMatchConstraintValidator.class.getName(), e.getMessage());
}
return true;
}
}
|
Python
|
UTF-8
| 262
| 3.609375
| 4
|
[] |
no_license
|
# if문
print('누구십니까?')
your_name = input()
if your_name == '도깨비':
print('안녕하세요. 도깨비님!')
elif your_name == '저승사자':
print('저승사자님, 또 야근이시군요!')
else:
print(your_name + '..., 뉘신지?')
|
Java
|
UTF-8
| 2,699
| 2.453125
| 2
|
[] |
no_license
|
package com.example.dreizehn.mypopularmoviesproject.utility.AdapterPackage;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.dreizehn.mypopularmoviesproject.R;
import com.example.dreizehn.mypopularmoviesproject.utility.PojoPackage.ReviewResultPojo;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by Dreizehn on 12/4/2017.
*/
public class ReviewAdapter extends RecyclerView.Adapter <ReviewAdapter.RevHolder> {
Context con;
List<ReviewResultPojo> results;
public ReviewAdapter(Context con, List<ReviewResultPojo> results) {
this.con = con;
this.results = results;
}
@Override
public RevHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_review, parent, false);
RevHolder holderz = new RevHolder(v,con,results);
return holderz;
}
@Override
public void onBindViewHolder(RevHolder holder, int position) {
ReviewResultPojo res = results.get(position);
holder.nama.setText(res.getAuthor());
holder.line=true;
holder.komen.setText(res.getContent());
holder.komen.setMaxLines(2);
holder.more.setVisibility(View.VISIBLE);
}
@Override
public int getItemCount() {
return results.size();
}
public class RevHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
Context con;
List<ReviewResultPojo> results;
@BindView(R.id.nameBy)TextView nama;
@BindView(R.id.reviewValue)TextView komen;
@BindView(R.id.more)ImageView more;
@BindView(R.id.less)ImageView less;
public RevHolder(View itemView, Context con, List<ReviewResultPojo> results) {
super(itemView);
this.con = con;
this.results = results;
ButterKnife.bind(this,itemView);
itemView.setOnClickListener(this);
}
boolean line=true;
@Override
public void onClick(View v) {
if(line){
komen.setMaxLines(Integer.MAX_VALUE);
line=false;
more.setVisibility(View.GONE);
less.setVisibility(View.VISIBLE);
}else{
komen.setMaxLines(2);
line=true;
less.setVisibility(View.GONE);
more.setVisibility(View.VISIBLE);
}
}
}
}
|
JavaScript
|
UTF-8
| 3,777
| 2.84375
| 3
|
[] |
no_license
|
import React, { useState } from "react";
const Form = () => {
const [txtUsername, setTxtUsername] = useState("");
const [age, setAge] = useState(0);
const [formErrors, setFormErrors] = useState({ textUsername: "", age: "" });
const [fieldValidity, setFieldValidity] = useState({
textUsername: false,
age: false
});
const [successMessage, setSuccessMessage] = useState("");
// const [formValid, setformValid] = useState(false);
return (
<div style={{ width: 400, margin: "10px auto" }}>
<form
onSubmit={(event) => {
event.preventDefault();
setSuccessMessage(
`Form submitted with username ${txtUsername} and age ${age}`
);
}}
>
<div className="form-group">
<label htmlFor="txtUsername">User name</label>
<input
className="form-control"
type="text"
placeholder="Please enter your username"
name="txtUsername"
value={txtUsername}
onChange={(event) => {
setTxtUsername(event.target.value);
if (event.target.value.length < 5) {
setFormErrors((formErrors) => ({
...formErrors,
textUsername: "Please enter atleat 5 characters"
}));
setFieldValidity((fieldValidity) => ({
...fieldValidity,
textUsername: false
}));
} else {
setFormErrors((formErrors) => ({
...formErrors,
textUsername: ""
}));
setFieldValidity((fieldValidity) => ({
...fieldValidity,
textUsername: true
}));
}
// const form = !(fieldValidity.textUsername && fieldValidity.age);
// setformValid({ form });
// console.log(form);
}}
/>
<div style={{ color: "red" }} id="errorMsg">
{formErrors.textUsername}
</div>
</div>
<div className="form-group">
<label htmlFor="age">Age</label>
<input
className="form-control"
type="number"
name="age"
placeholder="18"
value={age}
onChange={(event) => {
setAge(event.target.value);
if (event.target.value < 18) {
setFormErrors((formErrors) => ({
...formErrors,
age: "Cannot be less than 18"
}));
setFieldValidity((fieldValidity) => ({
...fieldValidity,
age: false
}));
} else {
setFormErrors((formErrors) => ({ ...formErrors, age: "" }));
setFieldValidity((fieldValidity) => ({
...fieldValidity,
age: true
}));
}
// const form = !(fieldValidity.textUsername && fieldValidity.age);
// setformValid({ form });
// console.log(form);
}}
/>
<div style={{ color: "red" }} id="errorMsg">
{formErrors.age}
</div>
</div>
<button
type="submit"
className="btn btn-primary"
disabled={!(fieldValidity.textUsername && fieldValidity.age)}
>
Submit
</button>
</form>
<div style={{ color: "green" }} id="successMessage">
{successMessage}
</div>
</div>
);
};
export default Form;
|
Java
|
UTF-8
| 819
| 2.625
| 3
|
[] |
no_license
|
package com.jinxp09277.j.library.log;
import android.util.Log;
import androidx.annotation.NonNull;
import static com.jinxp09277.j.library.log.JLogConfig.MAX_LEN;
/**
* Created by LWB on 2020/10/27
*/
public class JConsolePrinter implements JLogPrinter{
@Override
public void print(@NonNull JLogConfig config, int level, String tag, @NonNull String printString) {
int len = printString.length();
int countOfSub = len/MAX_LEN;
if(countOfSub>0){
int index = 0;
for(int i = 0 ;i<countOfSub;i++){
Log.println(level,tag,printString.substring(index,index+MAX_LEN));
index += MAX_LEN;
}
if(index!=len){
Log.println(level,tag,printString.substring(index,len));
}
}
}
}
|
Markdown
|
UTF-8
| 755
| 2.734375
| 3
|
[] |
no_license
|
# BusyBus
A public transportation application project designed to apply frontend skills to build bus route views. HTML and CSS were the primary coding languages used to complete this project but Figma was used to design the application.
## Colors
* **Black** - Used as a nuetral color to be easy on the eyes when a user is browsing through the application
* **Blue** - To highlight bus numbers and route names
* **White** - The current time it will take the bus to arrive at a destination
* **Orange** - The amount of time it takes for each bus to arrive at that specific destination
* **Red** - A warning notification to let users know the bus is having issues arriving on time
* **Grey** - Route is not in service

|
Java
|
UTF-8
| 333
| 2.515625
| 3
|
[] |
no_license
|
public class AdapterPattern {
//This is the client class.
public static void main(String args[]){
Extension targetInterface=new parkingCustomer();
targetInterface.giveVehicleDetails();
System.out.print(targetInterface.getFeeDetails());
}
}//End of the BankCustomer class.
|
Java
|
UTF-8
| 934
| 2.5
| 2
|
[] |
no_license
|
package controllers;
import models.*;
import java.util.List;
/**
* Write a description of class SwitchUserController here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SwitchUserController extends Controller {
/**
* Constructor for objects of class SwitchUserController
*/
public SwitchUserController(Reception reception) {
super(reception);
}
public void switchUser(User user) {
this.getReception().setUser(user);
}
public Administrator getAdministrator() {
return this.getReception().getAdministrator();
}
public List<Technician> getTechnicianList() {
return this.getReception().getTechnicianList();
}
public List<Nurse> getNurseList() {
return this.getReception().getNurseList();
}
public List<Patient> getPatientList() {
return this.getReception().getPatientList();
}
}
|
Java
|
UTF-8
| 1,539
| 3.15625
| 3
|
[] |
no_license
|
package com.yale.test.design.iterator;
import java.util.Iterator;
import com.yale.test.design.iterator.before.CafeMenu;
import com.yale.test.design.iterator.before.DinerMenu;
import com.yale.test.design.iterator.before.MenuItem;
import com.yale.test.design.iterator.before.PancakeHouseMenu;
public class Test {
Menu pancakeHouseMenu;
Menu dinerMenu;
Menu cafeMenu;
public Test(PancakeHouseMenu pancakeHouseMenu,DinerMenu dinerMenu,CafeMenu cafeMenu){
this.pancakeHouseMenu = pancakeHouseMenu;
this.dinerMenu = dinerMenu;
this.cafeMenu = cafeMenu;
}
public static void main(String[] args) {
PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu();
DinerMenu dinerMenu = new DinerMenu();
CafeMenu cafeMenu = new CafeMenu();
Test test = new Test(pancakeHouseMenu,dinerMenu,cafeMenu);
test.printMenu();
}
public void printMenu(){
Iterator pancakeHouseMenu = this.pancakeHouseMenu.createIterator();
Iterator dinerIterator = this.dinerMenu.createIterator();
Iterator cafeIterator = this.cafeMenu.createIterator();
System.out.println("菜单----湘菜\n");
printMenu(pancakeHouseMenu);
System.out.println("菜单----湘菜\n");
printMenu(dinerIterator);
System.out.println("菜单----湘菜\n");
printMenu(cafeIterator);
}
private void printMenu(Iterator iterator){
while(iterator.hasNext()){
MenuItem menuItem = (MenuItem)iterator.next();
System.out.println("菜名:" + menuItem.getName() + ",菜系:" + menuItem.getDescription() + ",价钱:" + menuItem.getPrice());
}
}
}
|
Shell
|
UTF-8
| 92
| 2.828125
| 3
|
[] |
no_license
|
#!/bin/bash
# id command (internal)
case $1 in
("-u" | "-g")
echo `id $1 $2`
;;
esac
|
C#
|
UTF-8
| 1,539
| 2.578125
| 3
|
[
"MIT"
] |
permissive
|
using System;
using Zilon.Core.Schemes;
namespace Zilon.Core.Persons
{
/// <summary>
/// Текущее состояние перка персонажа.
/// </summary>
public class Perk : IPerk
{
public Perk(IPerkScheme scheme)
{
Scheme = scheme ?? throw new ArgumentNullException(nameof(scheme));
}
/// <summary>
/// Достигнутые уровени перка.
/// </summary>
public PerkLevelSubScheme[]? ArchievedLevelSchemes { get; set; }
/// <summary>
/// Признак того, что целевой уровень перка проплачен.
/// </summary>
public bool IsLevelPaid { get; internal set; }
/// <summary>
/// Схема уровеня перка, которая прокачивается.
/// </summary>
public PerkLevelSubScheme? TargetLevelScheme { get; set; }
/// <summary>
/// Схема перка.
/// </summary>
public IPerkScheme Scheme { get; set; }
/// <summary>
/// Аккумулированные работы по перку.
/// Засчитываются в зависимости от области действия работ перка.
/// </summary>
public IJob[]? CurrentJobs { get; set; }
/// <summary>
/// Текущий уровень перка.
/// </summary>
public PerkLevel? CurrentLevel { get; set; }
}
}
|
Markdown
|
UTF-8
| 286,257
| 2.75
| 3
|
[] |
no_license
|
---
layout: manual
title: Integration Manual
description: The purpose of this documentation is to guide the developer on how to integrate with Cielo's API Cielo eCommerce.
search: true
translated: true
categories: manual
tags:
- API e-Commerce Cielo
language_tabs:
json: JSON
shell: cURL
---
# Overview - API Cielo eCommerce
The purpose of this documentation is to guide the developer on how to integrate with Cielo's API Cielo eCommerce, describing the features, methods to be used, listing information to be sent and received, and providing examples.
The integration mechanism with Cielo eCommerce is simple, so only intermediate knowledge in Web programming language, HTTP/HTTPS requests and JSON file manipulation are required to successfully deploy the Cielo eCommerce solution.
In this manual you will find the reference on all operations available on API REST of API Cielo eCommerce. These operations must be performed using its specific key (Merchant ID and Merchant Key) in the respective environment endpoints:
Production Environment
* **Transaction request**: https://api.cieloecommerce.cielo.com.br/
* **Transaction query**: https://apiquery.cieloecommerce.cielo.com.br/
Sandbox Environment
* **Transaction request**: https://apisandbox.cieloecommerce.cielo.com.br
* **Transaction query**: https://apiquerysandbox.cieloecommerce.cielo.com.br
To perform an operation, combine the base URL of the environment with the URL of the desired operation and send it using the HTTP verb as described in the operation.
## Solution features
The API Cielo eCommerce solution of the Cielo eCommerce platform was developed with REST technology, which is market standard and also independent of the technology used by our customers. In this way, it is possible to integrate using the most varied programming languages, such as: ASP, ASP. Net, Java, PHP, Ruby, Python, etc.
For examples of these languages, see our conversion tutorial via our [**Postman Tutorial**](https://developercielo.github.io/Tutorial//Postman)
Among other features, the attributes that stand out most in the Cielo eCommerce platform:
* **No proprietary apps**: it is not necessary to install applications in the virtual shop environment under no circumstances.
* **Simplicity**: the protocol used is purely the HTTPS.
* **Ease of testing**: the Cielo platform offers a publicly accessible Sandbox environment, which allows the developer to create a test account without the need for accreditation, making it easier and faster to start integration.
* **Credentials**: the handling of the customers's credentials (affiliation number and access key) traffics in the header of the HTTP request of the message.
* **Safety**: the information exchange always takes place between the Store Server and Cielo Server, that is, without the buyer's browser.
* **Multiplatform**: the integration is performed through Web Service REST.
## Architecture
Integration is performed through services provided as Web Services. The model employed is quite simple: There are two URLs (endpoint), a specific one for operations that cause side effects - such as authorization, capture and cancellation of transactions, and a specific URL for operations that do not cause side effects, such as transaction searching. These two URLs will receive the HTTP messages through the POST, GET or PUT methods. Each message type must be sent to a resource identified through the path.
| Method | Description |
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| **POST** | The `POST` HTTP method is used in the creation of resources or in sending information that will be processed. For example, creation of a transaction. |
| **PUT** | The`PUT` HTTP method is used to update an already existing resource. For example, capture or canceltation of a previously authorized transaction. |
| **GET** | The `GET` HTTP method is used for querying already existing resources. For example, transaction query. |
## Glossary
In order to facilitate the understanding, we have listed below a short glossary with the main terms related to eCommerce and also to card and acquiring market:
|Term|Description|
|---|---|
|**Authentication**|process to ensure that the buyer is actually the one who claims to be (lawful carrier), usually occurs at the issuing bank using a digital token or card with security keys.|
|**Authorization**|rocess to check whether a purchase can or not be realized with a card. At this point, several checks are done with the card and the carrier (e.g., timely payments, card locks, etc.). It is also at this point that the card limit is sensitized with the transaction value.|
|**Cancellation**|process to cancel a purchase made with card.|
|**Capture**|process that confirms an authorization that was previously made. It is only after the capture that the card carrier will be able to view it on their bank statement or invoice.|
|**Access key**|it is a store-specific security code, generated by Cielo, which is used to perform the authentication and communication on all messages exchanged with Cielo. Also known as production key and key data.|
|**Buyer**|is the one who effects purchase at the virtual store.|
|**Issuer (or issuing bank)**|It is the financial institution that issues the credit card, debit card or voucher.|
|**Commercial establishment or CE**|Entity that responds by the virtual store.|
|**Payment Gateway**|Company responsible for technical integration and transaction processing.|
|**Accreditation number**|is an identifier number that the merchant receives after their accreditation with Cielo.|
|**Carrier**|is the person who carries the card at the time of sale.|
|**SecureCode**|Mastercard international program to enable buyer authentication at the time of purchase in eCommerce environment.|
|**TID (Transaction Identifier)**|code consisting of 20 characters that identifies only one Cielo eCommerce transaction.|
|**Transaction**|is the purchase order of the card carrier in Cielo.|
|**VBV (Verified by Visa)**|Visa international program that enables buyer authentication at the time of purchase in eCommerce environment.|
## Products and Supported Issuers
The current version of Cielo Webservice supports the following issuers and products:
| Issuer | Demand credit | Installment credit Store | Debit | Voucher |
|------------------|---------------|--------------------------|-------|---------|
| Visa | Yes | Yes | Yes | *No* |
| Master Card | Yes | Yes | Yes | *No* |
| American Express | Yes | Yes | *No* | *No* |
| Elo | Yes | Yes | *No* | *No* |
| Diners Club | Yes | Yes | *No* | *No* |
| Discover | Yes | *No* | *No* | *No* |
| JCB | Yes | Yes | *No* | *No* |
| Aura | Yes | Yes | *No* | *No* |
| Hipercard | Yes | Yes | *No* | *No* |
# Extended Validation Certificate
## What is SSL Certificate?
The SSL Certificate for web server offers authenticity and integrity of web site data, giving customers of virtual stores the guarantee that they are actually accessing the web site they want, not a fraudster web site.
Specialized companies are responsible for domain validating and, depending on the type of certificate, they are also responsible for the validation of the entity that owns the domain.
### Internet Explorer:

### Firefox

### Google Chrome

## What is EV SSL Certificate?
The EV Certificate has been recently released on market and ensures a higher level of security for virtual stores customers.
It is a certificate of greater confidence and when https is accessed the address bar will turn green, giving more reliability for site visitors.
## How to install the Extended Validation Certificate on the Store server?
Just install the following three files in the server Trustedstore. Cielo does not offer support to the installation of the Certificate. If you are unsure about how to install the EV Certificate, then you should contact your server vendor support.
* [Root Certificate]({{ site.baseurl }}/attachment/Root.crt)
* [Intermediate 1 certificate]({{ site.baseurl }}/attachment/Intermediate1.crt)
* [Intermediate 2 certificate]({{ site.baseurl }}/attachment/Intermediate2.crt)
* [E-Commerce Cielo certificate]({{ site.baseurl }}/attachment/ServerCertificate.crt)
## Step-by-Step for Installation
### Installation on the Virtual Store Server
The step-by-step of the EV Certificate installation must contact your server vendor support.
<aside class="warning">Cielo does not offer support for the installation of the Certificate.</aside>
### Client Access to Virtual Store
Normally, the browser automatically updates the Certificate. If it does not and the client contacts, the following steps must be informed:
**Step 1:**
Save the three files below into a new folder, or into a folder that can be easily remembered, as it will be used later:
* [Root Certificate]({{ site.baseurl }}/attachment/Root.crt)
* [Intermediate 1 certificate]({{ site.baseurl }}/attachment/Intermediate1.crt)
* [Intermediate 2 certificate]({{ site.baseurl }}/attachment/Intermediate2.crt)
* [E-Commerce Cielo certificate]({{ site.baseurl }}/attachment/ServerCertificate.crt)
**Step 2:**
In “Internet Explorer”, click on “Tools” menu and go to “Internet Options”:

In “Firefox”, click on “Open Menu” menu and go to “Advanced” and “Options”:

Control Google Chrome” and go to “Settings” and “Show advanced settings... “Change Proxy Settings and “Content” and Certificates:

**Step 3:**
In Internet Explorer, under “Certificates”, click on “Import.”

In Firefox, click on “View Certificates”, click on “Import”

In Chrome, click on “Manage Certificates”, click on “Import”v

**Step 4:**
In Internet Explorer and Chrome “Certificate Import Wizard”, click on “Next”.


In Firefox “Servers Tab”, click on “Import”

**Step 5:**
In Chrome and Internet Explorer “Certificate Import Wizard”, click on “Search”, look for the folder where the files are and select the file “cieloecommerce.cielo.com.br.crt, click on “Open” and then “Next”.


**Step 6:**
Select the desired option: add the Certificate in a default folder or search for the folder of your choice.

**Step 7:**
Click on “Finish”.

**Step 8:**
Click on “Ok” to complete the import.

<aside class="notice">In Firefox there is no Successfull Import message, it only completes the import.</aside>
The Certificate may be viewed in the default tab “Other People” or at the one chosen by the customer.

**Step 9:**
Repeat the same procedure for the 3 sent files.
# Sandbox and Tools
## About Sandbox
To facilitate testing during integration, Cielo offers a Sandbox environment that is composed by two areas:
1. Test account register
2. Transactional Endpoints
* **Request**: https://apisandbox.cieloecommerce.cielo.com.br
* **Query**: https://apiquerysandbox.cieloecommerce.cielo.com.br
**Advantages of using the Sandbox**
* No affiliation is required to use Sandbox Cielo.
* Just access the [**Sandbox Registration**](https://cadastrosandbox.cieloecommerce.cielo.com.br/) create an accounta.
* with the registration you will receive a `MerchantId` and a `MerchantKey`, which are the credentials required for the API methods
## Integration Toolo: POSTMAN
**Postman** is an API Client that makes it easier for developers to create, share, test, and document APIs. This is done by allowing users to create and save simple and complex HTTP requests, as well as read their responses.
Cielo offers complete collections of its integrations via Postamn, which facilitates the integration process with the API Cielo.
We suggest developers to access our [**Tutorial**](https://developercielo.github.io/Tutorial//Postman) about the tool to better understand all the advantages it offers.
## Credit card - Sandbox
In sandbox, it is necessary to use the `Provider` as **SIMULATED**
The Simulated is a configuration that emulates the use of payments with Credit Card.
With this means of payment it is possible to simulate the flows of:
* Authorization
* Capture
* Cancellation.
For best use of the Simulated Payment Means, we are providing **test cards** in the table below.
<aside class="notice">The <code>status</code> of the transactions are defined by the FINALS of each card, as well as the <code>ReturnCode</code>.</aside>
|Transaction Status|Card End|Return Code|Return message|
|---|---|---|---|
|Authorized|0000.0000.0000.0001<br>0000.0000.0000.0004|4/6|Operation performed successfully|
|Not Authorized|0000.0000.0000.0002|05|Not Authorized|
|Not Authorized|0000.0000.0000.0003|57|Expired Card|
|Not Authorized|0000.0000.0000.0005|78|Locked Card|
|Not Authorized|0000.0000.0000.0006|99|Time Out|
|Not Authorized|0000.0000.0000.0007|77|Canceled Card||
|Not Authorized|0000.0000.0000.0008|70|Problems with the Credit Card|
|Random Authorization|0000.0000.0000.0009|99|Operation Successful / Time Out|
Example of a Test card - 4024.0071.5376.3191
The information of **Security Code (CVV)** and validity may be random, keeping the format - CVV (3 digits) Validity (MM/YYYY).
<aside class="notice"><strong>Warning:</strong> The **sandbox** environment evaluates the format and end of the card, if an actual card is sent, the result of the operation will be identical to that described in the test cards table.</aside>
<aside class="notice"><strong>Tokenization:</strong> Transactions in sandbox environment involving tokenization did not work based on test cards. Every card saved at the tokenization is treated as a real card, so it is not used in the simulation process</aside>
## Debit card - Sandbox
Debit cards do not have simulated cards or specific data, such as in the case of a credit card.
The transactional flow of the Debit card works with the Response of the transaction by returning an *AUTHENTICATION URL* . In the authentication screen, the chosen option defines the status of the transaction.
|Option|Status|
|---|---|
|Authenticated|Authorized|
|Not Authenticate|Denied|
|Do not use the URL|Not Finished|
<aside class="notice"><strong>Online Transfer:</strong> The same behavior of the Debit card in Sanbox is valid for debit card</aside>
## Other means of payment - Sandbox
Other means of payment do not have simulated specific data or cards, as in the case of credit card.
Below we specify any existing differences:
|Means of payment|Differences|
|---|---|
|Bank slip|There is no bank validation. The bank slip behaves as a bank slip without registration|
|Debit cardo|The `provider` used must be **SIMULATED** <br> The redirection URL for the bank environment will actually be a screen for choosing the authentication status|
|Online transfer|The `provider` used must be **SIMULATED** <br> The redirection URL for the bank environment will actually be a screen for choosing the authentication status|
## Notification Post
The Notification Post is sent based on a selection of events to be made in the API Cielo E-commerce register.
The events that can be notified are:
|Means of payment|Event|
|---|---|
|Credit card|Capture|
|Credit card|Cancellation|
|Credit card|Survey|
|Bank slip|Conciliation|
|Bank slip|Manual Cancellation|
|Electronic transfer|Confirmed|
|Recurrence|Disabled on reaching maximum number of attempts (denied transactions)|
|Recurrence|Waiting for bank slip conciliation|
|Recurrence|Rehabilitation - After payment of bank slip|
|Recurrence|Finished - Finished date reached|
|Recurrence|Deactivation|
<aside class="notice"><strong>Debit card:</strong> We do not notify Debit card transactions. We suggest creating a RETURN URL, where the buyer will be sent if the transaction is completed in the bank environment. When this URL is triggered, our suggestion is for a `GET` to be run by searching for order information in the API Cielo</aside>
An `URL Status Payment` must be registered by Cielo Support, so that the notification POST is executed.
Features of the `URL Status Payment`
* Must be **static**
* 255 characters limit.
The store **must** return in response to notification: **HTTP Status Code 200 OK**
If not returned the **HTTP Status Code 200 OK**, more **two** Notification Post submissions will occur.
```json
{
"RecurrentPaymentId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"PaymentId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"ChangeType": "2"
}
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`RecurrentPaymentId`|Identifier that represents the Recurring order (applicable only to ChangeType 2 or 4)|GUID|36|No|
|`PaymentId`|Identifier that represents the transaction|GUID|36|Yes|
|`ChangeType`|Specifies the type of notification. See table below|Number|1|Yes|
|ChangeType|Description|
|---|---|
|1|Payment status change|
|2|Recurrence created|
|3|AntiFraud status change|
|4|Recurring payment status change (Ex. automatic deactivation)|
|5|cancellation denied|
# Payments with Credit Card
For you to enjoy all the features available in our API, it is important that you first understand the concepts involved in processing a credit card transaction.
|Concept|Description|
|---|---|
|**Authorization**|The authorization (or pre-authorization) is the main operation in eCommerce, because through it is that a sale can be realized. Pre-authorization only sensitizes the customer's limit, but does not yet generate charge for the consumer.|
|**Capture**|When making a pre-authorization, it is necessary to confirm it, so that the charge is effected to the card carrier. Through this operation a pre-authorization is effected, and it can be executed normally within 5 days after the pre-authorization date.|
|**Cancellation**|The cancellation is necessary when, for some reason, a sale will not be effected anymore.|
|**Authentication**|The authentication process makes it possible to effective a sale, which will pass through the authentication process of the card issuing bank, thus providing more security for the sale and transferring the risk of fraud to the bank.|
|**Protected Card**|It is a platform that allows secure storage of credit card sensitive data. This data are transformed into an encrypted code named “token”, which can be stored in a database. With the platform, the store can offer features like “1 Click Buy” and “Rettry transaction sending”, always preserving integrity and confidentiality of information.|
|**Anti fraud**|It is a fraud prevention platform that provides a detailed risk analysis of online purchases. Each transaction is submitted to more than 260 rules, besides the specific rules of each segment, and generate a risk recommendation in approximately two seconds. This process is completely transparent to the card carrier. According to the pre-established criteria, the order can be automatically accepted, rejected or sent to manual analysis.|
|**Recurrent**|The Smart Recurrence is an indispensable resource for establishments that regularly need to charge for their products/services. It is widely used for magazine subscriptions, monthly fees, software licenses, among others. The merchants will count with differentiated resources to model their charging according to their business, as all parameterization is configurable, such as: periodicity, start and end date, number of attempts, interval between them, among others.|
## Creating a simple transaction
To create a transaction that will use a credit card, it is necessary to send a request using the `POST` method to the Payment feature, as shown. This example covers the minimum of fields required to be submitted for authorization.
<aside class="notice"><strong>Warning:</strong> It is not possible to carry out a transaction with its value as (`Amount`) 0.</aside>
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111703",
"Customer":{
"Name":"Comprador crédito simples"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111703",
"Customer":{
"Name":"Comprador crédito simples"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`MerchantId`|Guid|36|Yes|Store identifier in Cielo.|
|`MerchantKey`|Text|40|Yes|Public Key for Double Authentication in Cielo.|
|`RequestId`|Guid|36|No|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT.|
|`MerchantOrderId`|Text|50|Yes|Order ID number.|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Installments`|Number|2|Yes|Number of installments.|
|`Payment.SoftDescriptor`|Text|13|No|Text printed on buyer's bank invoice - Available only for VISA/MASTER - does not allow special characters - See Attachment|
|`CreditCard.CardNumber`|Text|19|Yes|Buyer's Card Number.|
|`CreditCard.Holder`|Text|25|No|Buyer's name printed on the card.|
|`CreditCard.ExpirationDate`|Text|7|Yes|Expiry date printed on card.|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Attachment.|
|`CreditCard.Brand`|Text|10|Yes|Card issuer (Visa / Master / Amex / Elo / Aura / JCB / Diners / Discover / Hipercard).|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador crédito simples"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "674532",
"Tid": "0305023644309",
"AuthorizationCode": "123456",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador crédito simples"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "674532",
"Tid": "0305023644309",
"AuthorizationCode": "123456",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
|`SoftDescriptor`|Text printed on the buyer's bank invoice - Available only for VISA/MASTER - does not allow special characters - See Attachment|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric text|
## Creating a complete transaction
To create a transaction that will use a credit card, it is necessary to send a request using the `POST` method to the Payment feature as shown. This example covers all the possible fields that can be sent.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111701",
"Customer":{
"Name":"Comprador crédito completo",
"Email":"compradorteste@teste.com",
"Birthdate":"1991-01-02",
"Address":{
"Street":"Rua Teste",
"Number":"123",
"Complement":"AP 123",
"ZipCode":"12345987",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
},
"DeliveryAddress": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Currency":"BRL",
"Country":"BRA",
"ServiceTaxAmount":0,
"Installments":1,
"Interest":"ByMerchant",
"Capture":true,
"Authenticate":false,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111701",
"Customer":{
"Name":"Comprador crédito completo",
"Identity":"11225468954",
"IdentityType":"CPF",
"Email":"compradorteste@teste.com",
"Birthdate":"1991-01-02",
"Address":{
"Street":"Rua Teste",
"Number":"123",
"Complement":"AP 123",
"ZipCode":"12345987",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
},
"DeliveryAddress": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"ServiceTaxAmount":0,
"Installments":1,
"Interest":"ByMerchant",
"Capture":true,
"Authenticate":false,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardNumber":"4551870000000183",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`MerchantId`|Guid|36|Yes|Store identifier in Cielo.|
|`MerchantKey`|Text|40|Yes|Public Key for Double Authentication in Cielo.|
|`RequestId`|Guid|36|No|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT.|
|`MerchantOrderId`|Text|50|Yes|Order ID number.|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Customer.Status`|Text|255|No|Buyer registration status in store (NEW / EXISTING)|
|`Customer.Identity`|Text|14|No|Customer's RG, CPF or CNPJ number.|
|`Customer.IdentityType`|Text|255|No|Type of buyer ID document (CFP/CNPJ).|
|`Customer.Email`|Text|255|No|Buyer's e-mail.|
|`Customer.Birthdate`|Date|10|No|Buyer's date of birth.|
|`Customer.Address.Street`|Text|255|No|Buyer's address.|
|`Customer.Address.Number`|Text|15|No|Buyer's address number.|
|`Customer.Address.Complement`|Text|50|No|Buyer's address complement.br|
|`Customer.Address.ZipCode`|Text|9|No|Buyer's address zip code.|
|`Customer.Address.City`|Text|50|No|Buyer's address city.|
|`Customer.Address.State`|Text|2|No|Buyer's address state.|
|`Customer.Address.Country`|Text|35|No|Buyer's address country.|
|`Customer.DeliveryAddress.Street`|Text|255|No|Buyer's address.|
|`Customer.Address.Number`|Text|15|No|Buyer's address number.|
|`Customer.DeliveryAddress.Complement`|Text|50|No|Buyer's address complement.|
|`Customer.DeliveryAddress.ZipCode`|Text|9|No|Buyer's address zip code.|
|`Customer.DeliveryAddress.City`|Text|50|No|Buyer's address city.|
|`Customer.DeliveryAddress.State`|Text|2|No|Buyer's address state.|
|`Customer.DeliveryAddress.Country`|Text|35|No|Buyer's address country.|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Currency`|Text|3|No|Currency in which payment will be made (BRL).|
|`Payment.Country`|Text|3|No|Country where payment will be made.|
|`Payment.Provider`|Text|15|---|Defines behavior of the means of payment (see Annex)/NOT REQUIRED FOR CREDIT.|
|`Payment.ServiceTaxAmount`|Number|15|No|[See Annex](https://developercielo.github.io/Webservice-3.0/#anexos)|
|`Payment.SoftDescriptor`|Text|13|No|Text printed on the buyer's bank invoice - Only available for VISA/MASTER - does not allow special characters - See Annex|
|`Payment.Installments`|Number|2|Yes|Number of Installments.|
|`Payment.Interest`|Text|10|No|Type of installment - Store (ByMerchant) or Card (ByIssuer).|
|`Payment.Capture`|Boolean|---|No (Default false)|Boolean that identifies that the authorization should be with automatic capture.|
|`Payment.Authenticate`|Booleano|---|No (Default false)|Defines whether the buyer will be directed to the Issuing bank for card authentication|
|`CreditCard.CardNumber`|Text|19|Yes|Buyer's Card Number.|
|`CreditCard.Holder`|Text|25|No|Buyer's name printed on card.|
|`CreditCard.ExpirationDate`|Text|7|Yes|Expiry date printed on card.|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`CreditCard.SaveCard`|Boolean|---|No (Default false)|Boolean that identifies whether the card will be saved to generate the CardToken.|
|`CreditCard.Brand`|Text|10|Yes|Card issuer (Visa / Master / Amex / Elo / Aura / JCB / Diners / Discover / Hipercard).|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador crédito completo",
"Identity":"11225468954",
"IdentityType":"CPF",
"Email": "compradorteste@teste.com",
"Birthdate": "1991-01-02",
"Address": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
},
"DeliveryAddress": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": true,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "674532",
"Tid": "0305020554239",
"AuthorizationCode": "123456",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"CapturedAmount": 15700,
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 2,
"ReturnCode": "6",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador crédito completo",
"Identity":"11225468954",
"IdentityType":"CPF",
"Email": "compradorteste@teste.com",
"Birthdate": "1991-01-02",
"Address": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
},
"DeliveryAddress": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": true,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "674532",
"Tid": "0305020554239",
"AuthorizationCode": "123456",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"CapturedAmount": 15700,
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 2,
"ReturnCode": "6",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
|`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric texto|
## Creating a sale with Authentication
To create a transaction with authentication that will use a credit card, it is necessary to submit a request using the `POST` method for the Payment feature as shown.
<aside class="notice"><strong>Authentication:</strong> In this mode, the card carrier is directed to the authentication environment of the card issuing bank where the inclusion of the card password will be requested.</aside>
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111903",
"Customer":
{
"Name":"Comprador crédito autenticação"
},
"Payment":
{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"Authenticate":true,
"SoftDescriptor":"123456789ABCD",
"ReturnUrl":"https://www.cielo.com.br",
"CreditCard":
{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111903",
"Customer":{
"Name":"Comprador crédito autenticação"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"Authenticate":true,
"ReturnUrl":"http://www.cielo.com.br",
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardNumber":"4551870000000183",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`MerchantId`|Guid|36|Yes|Store identifier in Cielo.|
|`MerchantKey`|Text|40|Yes|Public Key for Double Authentication in Cielo.|
|`RequestId`|Guid|36|No|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT.|
|`MerchantOrderId`|Text|50|Yes|Order ID number.|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Customer.Status`|Text|255|No|Buyer registration status in store (NEW / EXISTING)|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Provider`|Text|15|---|Defines behavior of the means of payment (see Annex)/NOT REQUIRED FOR CREDIT.|
|`Payment.Installments`|Number|2|Yes|Number of Installments.|
|`Payment.Authenticate`|Boolean|---|No (Default false)|Defines whether the buyer will be directed to the Issuing bank for card authentication|
|`CreditCard.CardNumber.`|Text|19|Yes|Buyer's Card Number|
|`CreditCard.Holder`|Text|25|No|Buyer's name printed on card.|
|`CreditCard.ExpirationDate`|Text|7|Yes|Expiry date printed on card.|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`CreditCard.Brand`|Text|10|Yes|Card issuer (Visa / Master / Amex / Elo / Aura / JCB / Diners / Discover / Hipercard).|
### Response
```json
{
"MerchantOrderId":"2014111903",
"Customer":
{
"Name":"Comprador crédito autenticação"
},
"Payment":
{
"ServiceTaxAmount":0,
"Installments":1,
"Interest":"ByMerchant",
"Capture":false,
"Authenticate":true,
"CreditCard":
{
"CardNumber":"123412******1112",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SaveCard":false,
"Brand":"Visa"
},
"AuthenticationUrl":"https://xxxxxxxxxxxx.xxxxx.xxx.xx/xxx/xxxxx.xxxx?id=c5158c1c7b475fdb91a7ad7cc094e7fe",
"Tid": "1006993069257E521001",
"SoftDescriptor":"123456789ABCD",
"PaymentId":"f2dbd5df-c2ee-482f-ab1b-7fee039108c0",
"Type":"CreditCard",
"Amount":15700,
"Currency":"BRL",
"Country":"BRA",
"ExtraDataCollection":[],
"Status":0,
"ReturnCode": "0",
"Links":
[
{
"Method":"GET",
"Rel":"self",
"Href":"https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{Paymentid}"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111903",
"Customer":
{
"Name":"Comprador crédito autenticação"
},
"Payment":
{
"ServiceTaxAmount":0,
"Installments":1,
"Interest":"ByMerchant",
"Capture":false,
"Authenticate":true,
"CreditCard":
{
"CardNumber":"123412******1112",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SaveCard":false,
"Brand":"Visa"
},
"AuthenticationUrl":"https://xxxxxxxxxxxx.xxxxx.xxx.xx/xxx/xxxxx.xxxx?id=c5158c1c7b475fdb91a7ad7cc094e7fe",
"Tid": "1006993069257E521001",
"SoftDescriptor":"123456789ABCD",
"PaymentId":"f2dbd5df-c2ee-482f-ab1b-7fee039108c0",
"Type":"CreditCard",
"Amount":15700,
"Currency":"BRL",
"Country":"BRA",
"ExtraDataCollection":[],
"Status":0,
"ReturnCode": "0",
"Links":
[
{
"Method":"GET",
"Rel":"self",
"Href":"https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{Paymentid}"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
|`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric texto|
## Creating a sale with Fraud Analysis
To create a sale with credit card and fraud analysis, it is necessary to submit a request using the `POST` method for Payment feature as shown.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"201411173454307",
"Customer":{
"Name":"Comprador crédito AF",
"Email":"compradorteste@live.com",
"Birthdate":"1991-01-02",
"Address":{
"Street":"Rua Júpter",
"Number":"174",
"Complement":"AP 201",
"ZipCode":"21241140",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
},
"DeliveryAddress":{
"Street":"Rua Júpter",
"Number":"174",
"Complement":"AP 201",
"ZipCode":"21241140",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
}
},
"Payment":{
"Type":"CreditCard",
"Amount":100,
"Currency":"BRL",
"Country":"BRA",
"ServiceTaxAmount":0,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"Interest":"ByMerchant",
"Capture":false,
"Authenticate":false,
"CreditCard":{
"CardNumber":"4024007197692931",
"Holder":"Teste accept",
"ExpirationDate":"12/2030",
"SecurityCode":"023",
"Brand":"Visa"
},
"FraudAnalysis":{
"Sequence":"AuthorizeFirst",
"SequenceCriteria":"Always",
"FingerPrintId":"074c1ee676ed4998ab66491013c565e2",
"Browser":{
"CookiesAccepted":false,
"Email":"compradorteste@live.com",
"HostName":"Teste",
"IpAddress":"200.190.150.350",
"Type":"Chrome"
},
"Cart":{
"IsGift":false,
"ReturnsAccepted":true,
"Items":[{
"GiftCategory":"Undefined",
"HostHedge":"Off",
"NonSensicalHedge":"Off",
"ObscenitiesHedge":"Off",
"PhoneHedge":"Off",
"Name":"ItemTeste",
"Quantity":1,
"Sku":"201411170235134521346",
"UnitPrice":123,
"Risk":"High",
"TimeHedge":"Normal",
"Type":"AdultContent",
"VelocityHedge":"High",
"Passenger":{
"Email":"compradorteste@live.com",
"Identity":"1234567890",
"Name":"Comprador accept",
"Rating":"Adult",
"Phone":"999994444",
"Status":"Accepted"
}
}]
},
"MerchantDefinedFields":[{
"Id":95,
"Value":"Eu defini isso"
}],
"Shipping":{
"Addressee":"Sr Comprador Teste",
"Method":"LowCost",
"Phone":"21114740"
},
"Travel":{
"DepartureTime":"2010-01-02",
"JourneyType":"Ida",
"Route":"MAO-RJO",
"Legs":[{
"Destination":"GYN",
"Origin":"VCP"
}]
}
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"201411173454307",
"Customer":{
"Name":"Comprador crédito AF",
"Email":"compradorteste@live.com",
"Birthdate":"1991-01-02",
"Address":{
"Street":"Rua Júpter",
"Number":"174",
"Complement":"AP 201",
"ZipCode":"21241140",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
},
"DeliveryAddress":{
"Street":"Rua Júpter",
"Number":"174",
"Complement":"AP 201",
"ZipCode":"21241140",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
}
},
"Payment":{
"Type":"CreditCard",
"Amount":100,
"Country":"BRA",
"ServiceTaxAmount":0,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"Interest":"ByMerchant",
"Capture":false,
"Authenticate":false,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardNumber":"4024007197692931",
"Holder":"Teste accept",
"ExpirationDate":"12/2030",
"SecurityCode":"023",
"Brand":"Visa"
},
"FraudAnalysis":{
"Sequence":"AuthorizeFirst",
"SequenceCriteria":"Always",
"FingerPrintId":"074c1ee676ed4998ab66491013c565e2",
"Browser":{
"CookiesAccepted":false,
"Email":"compradorteste@live.com",
"HostName":"Teste",
"IpAddress":"200.190.150.350",
"Type":"Chrome"
},
"Cart":{
"IsGift":false,
"ReturnsAccepted":true,
"Items":[{
"GiftCategory":"Undefined",
"HostHedge":"Off",
"NonSensicalHedge":"Off",
"ObscenitiesHedge":"Off",
"PhoneHedge":"Off",
"Name":"ItemTeste",
"Quantity":1,
"Sku":"201411170235134521346",
"UnitPrice":123,
"Risk":"High",
"TimeHedge":"Normal",
"Type":"AdultContent",
"VelocityHedge":"High",
"Passenger":{
"Email":"compradorteste@live.com",
"Identity":"1234567890",
"Name":"Comprador accept",
"Rating":"Adult",
"Phone":"999994444",
"Status":"Accepted"
}
}]
},
"MerchantDefinedFields":[{
"Id":95,
"Value":"Eu defini isso"
}],
"Shipping":{
"Addressee":"Sr Comprador Teste",
"Method":"LowCost",
"Phone":"21114740"
},
"Travel":{
"DepartureTime":"2010-01-02",
"JourneyType":"Ida",
"Route":"MAO-RJO",
"Legs":[{
"Destination":"GYN",
"Origin":"VCP"
}]
}
}
}
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`MerchantId`|Guid|36|Yes|Store identifier in Cielo.|
|`MerchantKey`|Text|40|Yes|Public Key for Double Authentication in Cielo.|
|`RequestId`|Guid|36|No|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT.|
|`MerchantOrderId`|Text|50|Yes|Order ID number.|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Customer.Status`|Text|255|No|Buyer registration status in store (NEW / EXISTING)|
|`Customer.Email`|Text|255|No|Buyer's e-mail.|
|`Customer.Birthdate`|Date|10|No|Buyer's date of birth.|
|`Customer.Address.Street`|Text|255|No|Buyer's address.|
|`Customer.Address.Number`|Text|15|No|Buyer's address number.|
|`Customer.Address.Complement`|Text|50|No|Buyer's address complement.|
|`Customer.Address.ZipCode`|Text|9|No|Buyer's address zip code.|
|`Customer.Address.City`|Text|50|No|Buyer's address city.|
|`Customer.Address.State`|Text|2|No|Buyer's address state.|
|`Customer.Address.Country`|Text|35|No|Buyer's address country.|
|`Customer.DeliveryAddress.Street`|Text|255|No|Buyer's address.|
|`Customer.Address.Number`|Text|15|No|Buyer's address number.|
|`Customer.DeliveryAddress.Complement`|Text|50|No|Buyer's address complement.|
|`Customer.DeliveryAddress.ZipCode`|Text|9|No|Buyer's address zip code.|
|`Customer.DeliveryAddress.City`|Text|50|No|Buyer's address city.|
|`Customer.DeliveryAddress.State`|Text|2|No|Buyer's address stater.|
|`Customer.DeliveryAddress.Country`|Text|35|No|Buyer's address country.|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Currency`|Text|3|No|Currency in which payment will be made (BRL).|
|`Payment.Country`|Text|3|No|Country where payment will be made.|
|`Payment.Provider`|Text|15|---|Defines behavior of the means of payment (see Annex)/NOT REQUIRED FOR CREDIT.|
|`Payment.ServiceTaxAmount`|Number|15|No|[See Annex](https://developercielo.github.io/Webservice-3.0/#anexos)|
|`Payment.Installments`|Number|2|Yes|Number of Installments.|
|`Payment.Interest`|Text|10|No|Type of installment - Store (ByMerchant) or Card (ByIssuer).|
|`Payment.Capture`|Boolean|---|No (Default false)|Boolean that identifies that the authorization should be with automatic capture.|
|`Payment.Authenticate`|Boolean|---|No (Default false)|Defines whether the buyer will be directed to the Issuing bank for card authentication|
|`CreditCard.CardNumber`|Text|19|Yes|Buyer's Card Number.|
|`CreditCard.Holder`|Text|25|No|Buyer's name printed on card.|
|`CreditCard.ExpirationDate`|Text|7|Yes|Expiry date printed on card.|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`CreditCard.SaveCard`|Boolean|---|No (Default false)|Boolean that identifies whether the card will be saved to generate the CardToken.|
|`CreditCard.Brand`|Text|10|Yes|Card issuer (Visa / Master / Amex / Elo / Aura / JCB / Diners / Discover / Hipercard).|
|`FraudAnalysis.Sequence`|Text|14|No|Flow type to perform the fraud analysis. Standard: AuthorizeFirst|
|`FraudAnalysis.SequenceCriteria`|Text|9|No|Flow criterion. OnSuccess - Only performs the analysis if it succeeds in the transaction. Always - Always perform the analysis|
|`FraudAnalysis.FingerPrintId`|Text|50|No|Identifier used to cross information obtained by the internet user Browser with the data sent for analysis. This same value must be passed in the SESSIONID variable of theDeviceFingerPrint script.|
|`FraudAnalysis.Browser.CookiesAccepted`|Boolean|---|No|Boolean to identify whether the client browser accepts cookies.|
|`FraudAnalysis.Browser.Email`|Text|100|No|E-mail registered in the buyer's browser.|
|`FraudAnalysis.Browser.HostName`|Text|60|No|Host name where the buyer was before entering the store web site.|
|`FraudAnalysis.Browser.IpAddress`|Text|15|No|IP address of the buyer. It is strongly recommend sending this field.|
|`FraudAnalysis.Browser.Type`|Text|40|No|Browser name used by the buyer.|
|`FraudAnalysis.Cart.IsGift`|Boolean|---|No|Boolean indicating whether the order is a gift or not.|
|`FraudAnalysis.Cart.ReturnsAccepted`|Boolean|---|No|Boolean that defines whether returns are accepted for the order.|
|`FraudAnalysis.Items.GiftCategory`|Text|9|No|Field that will evaluate the billing and delivery addresses for different cities, states or countries.[Values](#fraudanalysisitemsgiftcategory)|
|`FraudAnalysis.Items.HostHedge`|Text|No|Level of importance of e-mail and IP addresses of customers at risk of scoring.[Values](#fraudanalysisitemshosthedge)|
|`FraudAnalysis.Items.NonSensicalHedge`|Text|6|No|Level of testing performed on buyer data with meaningless received orders.[Values](#fraudanalysisitemsnonsensicalhedge)|
|`FraudAnalysis.Items.ObscenitiesHedge`|Text|6|No|Level of obscenity of received orders.[Values](#fraudanalysisitemsobscenitieshedge)|
|`FraudAnalysis.Items.PhoneHedge`|Text|6|No|Level of tests performed with telephone numbers.[Values](#fraudanalysisitemsphonehedge)|
|`FraudAnalysis.Items.Name`|Text|255|No|Product's name.|
|`FraudAnalysis.Items.Quantity`|Number|15|No|Quantity of product to be purchased.|
|`FraudAnalysis.Items.Sku`|Text|255|No|Código comerciante identificador do produto.|
|`FraudAnalysis.Items.UnitPrice`|Number|15|No|Unit price of the product.|
|`FraudAnalysis.Items.Risk`|Text|6|No|Product risk level.[Values](#fraudanalysisitemsrisk)|
|`FraudAnalysis.Items.TimeHedge`|Text|No|Level of importance of customer's order day time.[Values](#fraudanalysisitemstimehedge)|
|`FraudAnalysis.Items.Type`|Text|No|Product type.[Values](#fraudanalysisitemstype)|
|`FraudAnalysis.Items.VelocityHedge`|Text|6|No|Level of importance of customer purchase frequency.[Values](#fraudanalysisitemsvelocityhedge)|
|`FraudAnalysis.Items.Passenger.Email`|Text|255|No|Email do passageiro.|
|`FraudAnalysis.Items.Passenger.Identity`|Text|32|No|Id of the passenger to whom the ticket was issued.|
|`FraudAnalysis.Items.Passenger.Name`|Text|120|No|Passenger name.|
|`FraudAnalysis.Items.Passenger.Rating`|Text|No|Passenger classification.[Values](#fraudanalysisitemspassengerrating)|
|`FraudAnalysis.Items.Passenger.Phone`|Text|15|No|Passenger phone number. For orders outside the U.S., CyberSource recommends to include the country code.|
|`FraudAnalysis.Items.Passenger.Status`|Text|32|No|Classification of the airline. It can be used values such as Gold or Platinum.|
|`FraudAnalysis.MerchantDefinedFields.Id`|Text|---|No|Id of the additional information to be sent.|
|`FraudAnalysis.MerchantDefinedFields.Value`|Text|255|No|Value of the additional information to be sent.|
|`FraudAnalysis.Shipping.Addressee`|Text|255|No|Name of delivery recipient.|
|`FraudAnalysis.Shipping.Method`|Text|No|Type of product delivery service.[Values](#fraudanalysisshippingmethod)|
|`FraudAnalysis.Shipping.Phone`|Text|15|No|Delivery recipient's phone number.|
|`FraudAnalysis.Travel.DepartureTime`|DateTime|23|No|Date, hour and minute of flight departure.|
|`FraudAnalysis.Travel.JourneyType`|Text|32|No|Trip type.|
|`FraudAnalysis.Travel.Route`|Text|255|No|Route of the trip. Concatenation of individual travel legs in the format ORIG1- DEST1.|
|`FraudAnalysis.Travel.Legs.Destination`|Text|3|No|Travel destination point airport code.|
|`FraudAnalysis.Travel.Legs.Origin`|Text|3|No|Travel origin point airport code.|
### Response
```json
{
"MerchantOrderId": "201411173454307",
"Customer": {
"Name": "Comprador crédito AF",
"Email": "compradorteste@live.com",
"Birthdate": "1991-01-02",
"Address": {
"Street": "Rua Júpter",
"Number": "174",
"Complement": "AP 201",
"ZipCode": "21241140",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
},
"DeliveryAddress": {
"Street": "Rua Júpter",
"Number": "174",
"Complement": "AP 201",
"ZipCode": "21241140",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "402400******2931",
"Holder": "Teste accept",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "492115",
"Tid": "10069930692606D31001",
"AuthorizationCode": "123456",
"SoftDescriptor":"123456789ABCD",
"FraudAnalysis": {
"Sequence": "AnalyseFirst",
"SequenceCriteria": "Always",
"FingerPrintId": "074c1ee676ed4998ab66491013c565e2",
"MerchantDefinedFields": [
{
"Id": 95,
"Value": "Eu defini isso"
}
],
"Cart": {
"IsGift": false,
"ReturnsAccepted": true,
"Items": [
{
"Type": "AdultContent",
"Name": "ItemTeste",
"Risk": "High",
"Sku": "201411170235134521346",
"UnitPrice": 123,
"Quantity": 1,
"HostHedge": "Off",
"NonSensicalHedge": "Off",
"ObscenitiesHedge": "Off",
"PhoneHedge": "Off",
"TimeHedge": "Normal",
"VelocityHedge": "High",
"GiftCategory": "Undefined",
"Passenger": {
"Name": "Comprador accept",
"Identity": "1234567890",
"Status": "Accepted",
"Rating": "Adult",
"Email": "compradorteste@live.com",
"Phone": "999994444"
}
}
]
},
"Travel": {
"Route": "MAO-RJO",
"DepartureTime": "2010-01-02T00:00:00",
"JourneyType": "Ida",
"Legs": [
{
"Destination": "GYN",
"Origin": "VCP"
}
]
},
"Browser": {
"HostName": "Teste",
"CookiesAccepted": false,
"Email": "compradorteste@live.com",
"Type": "Chrome",
"IpAddress": "200.190.150.350"
},
"Shipping": {
"Addressee": "Sr Comprador Teste",
"Phone": "21114740",
"Method": "LowCost"
},
"Id": "0e4d0a3c-e424-4fa5-a573-4eabbd44da42",
"Status": 1,
"ReplyData": {
"AddressInfoCode": "COR-BA^MM-BIN",
"FactorCode": "B^D^R^Z",
"Score": 42,
"BinCountry": "us",
"CardIssuer": "FIA CARD SERVICES, N.A.",
"CardScheme": "VisaCredit",
"HostSeverity": 1,
"InternetInfoCode": "FREE-EM^RISK-EM",
"IpRoutingMethod": "Undefined",
"ScoreModelUsed": "default_lac",
"CasePriority": 3
}
},
"PaymentId": "04096cfb-3f0a-4ece-946c-3b7dc5d38f19",
"Type": "CreditCard",
"Amount": 100,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Transação autorizada",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "201411173454307",
"Customer": {
"Name": "Comprador crédito AF",
"Email": "compradorteste@live.com",
"Birthdate": "1991-01-02",
"Address": {
"Street": "Rua Júpter",
"Number": "174",
"Complement": "AP 201",
"ZipCode": "21241140",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
},
"DeliveryAddress": {
"Street": "Rua Júpter",
"Number": "174",
"Complement": "AP 201",
"ZipCode": "21241140",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "402400******2931",
"Holder": "Teste accept",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "492115",
"Tid": "10069930692606D31001",
"AuthorizationCode": "123456",
"SoftDescriptor":"123456789ABCD",
"FraudAnalysis": {
"Sequence": "AnalyseFirst",
"SequenceCriteria": "Always",
"FingerPrintId": "074c1ee676ed4998ab66491013c565e2",
"MerchantDefinedFields": [
{
"Id": 95,
"Value": "Eu defini isso"
}
],
"Cart": {
"IsGift": false,
"ReturnsAccepted": true,
"Items": [
{
"Type": "AdultContent",
"Name": "ItemTeste",
"Risk": "High",
"Sku": "201411170235134521346",
"UnitPrice": 123,
"Quantity": 1,
"HostHedge": "Off",
"NonSensicalHedge": "Off",
"ObscenitiesHedge": "Off",
"PhoneHedge": "Off",
"TimeHedge": "Normal",
"VelocityHedge": "High",
"GiftCategory": "Undefined",
"Passenger": {
"Name": "Comprador accept",
"Identity": "1234567890",
"Status": "Accepted",
"Rating": "Adult",
"Email": "compradorteste@live.com",
"Phone": "999994444"
}
}
]
},
"Travel": {
"Route": "MAO-RJO",
"DepartureTime": "2010-01-02T00:00:00",
"JourneyType": "Ida",
"Legs": [
{
"Destination": "GYN",
"Origin": "VCP"
}
]
},
"Browser": {
"HostName": "Teste",
"CookiesAccepted": false,
"Email": "compradorteste@live.com",
"Type": "Chrome",
"IpAddress": "200.190.150.350"
},
"Shipping": {
"Addressee": "Sr Comprador Teste",
"Phone": "21114740",
"Method": "LowCost"
},
"Id": "0e4d0a3c-e424-4fa5-a573-4eabbd44da42",
"Status": 1,
"ReplyData": {
"AddressInfoCode": "COR-BA^MM-BIN",
"FactorCode": "B^D^R^Z",
"Score": 42,
"BinCountry": "us",
"CardIssuer": "FIA CARD SERVICES, N.A.",
"CardScheme": "VisaCredit",
"HostSeverity": 1,
"InternetInfoCode": "FREE-EM^RISK-EM",
"IpRoutingMethod": "Undefined",
"ScoreModelUsed": "default_lac",
"CasePriority": 3
}
},
"PaymentId": "04096cfb-3f0a-4ece-946c-3b7dc5d38f19",
"Type": "CreditCard",
"Amount": 100,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Transação autorizada",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
|`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`Id`|Identification of the Transaction in AntiFraud.|Text|300|Alphanumeric text|
|`Status`|Transaction Status.|Byte|---|2|
|`FraudAnalysisReasonCode`|Analysis result.|Byte|---|Number:<br /><ul><li>100 - Successful operation.</li><li>101 - The order is missing one or more required fields. Possible action: See the missing fields in the AntiFraudResponse list.MissingFieldCollection. Resend order with complete information.</li><li>102 - One or more of order fields contain invalid data. Possible action: View the invalid fields in the AntiFraudResponse list.InvalidFieldCollection. Resend the order with the correct information.</li><li>150 General system failure. Possible action: Wait a few minutes and try resending the order.</li><li>151 - The order was received, but time-out occurred on the server. This error does not include time-out between the customer and the server. Possible action: Wait a few minutes and try resending the order.</li><li>152 The order was received, but time-out occurred. Possible action: Wait a few minutes and resend the order.</li><li>202 – Fraud Prevention declined the order because the card has expired. You can also receive this code if the expiration date does not match the date on file of the issuing bank. If the payment processor allows you to issue credits to expired cards, CyberSource does not limit this functionality. Possible action: Request a card or other form of payment.</li><li>231 The account number is invalid. Possible action: Request a card or other form of payment.</li><li>234 - There is a problem with the merchant configuration. Possible action: Do not send the order. Contact Customer Support to correct the setup problem.</li><li>400 The fraud score goes beyond their limit. Possible action: Review customer's order.</li><li>480 The order has been marked for review by the Decision Manager.</li><li>481 - The order was rejected by the Decision Manager</li></ul>|
|`AddressInfoCode`|Combination of codes indicating error in the billing and/or delivery address. The codes are concatenated using the character ^ character.|Text|255|Ex: COR-BA^MM-BIN<br /><ul><li>COR-BA - The billing address can be normalized.</li><li>COR-SA - The delivery address can be normalized.</li><li>INTL-BA - The country of charge is outside the U.S.</li><li>INTL-SA - The country of delivery is outside the U.S.</li><li>MIL-USA - This is a military address in the U.S.</li><li>MM-A - Billing and delivery addresses use different street names.</li><li>MM-BIN - The BIN of the card (the first six digits of the number) does not match the country.</li><li>MM-C - Billing and delivery addresses use different cities.</li><li>MM-CO - Billing and delivery addresses use different countries.</li><li>MM-ST - Billing and delivery addresses use different states.</li><li>MM-Z - Billing and delivery addresses use different postal codes.</li><li>UNV-ADDR - The address is unverifiable.</li></ul>|
|`FactorCode`|Combination of codes that indicate the order's score. The codes are concatenated using the ^ character.|Text|100|Ex: B^D^R^Z<br /><ul><li>A - Excessive address change. Customer changed billing address two or more times in the last six months.</li><li>B - BIN of the card or risk authorization. Risk factors are related to credit card BIN and/or card authorization checks.</li><li>C - High number of credit cards. The customer has used more than six credit card numbers in the last six months.</li><li>D - Impact of e-mail address. The customer uses a free email provider or the email address is risky.</li><li>E - Positive list. The customer is on your positive list.</li><li>F - Negative list. The account number, address, e-mail address or IP address for this purpose appears on your negative list.</li><li>G - Geo-inconsistencies. Email client domain, phone number, billing address, shipping address or IP address is suspect.</li><li>H - Excessive name changes. The customer has changed the name two or more times in the last six months.</li><li>I - Internet inconsistencies. The IP address and e-mail domain are not consistent with the billing address.</li><li>N - Meaningless entry. Client name and address fields contain nonsense words or language.</li><li>O - Obscenities. Customer data contains obscene words.</li><li>P - Morphing identity. Multiple values of an identity element are linked to a value of a different identity element. For example, multiple phone numbers are linked to a single account number.</li><li>Q - Phone inconsistencies. Customer's telephone number is suspect.</li><li>R - Risky order. The transaction, the customer and the merchant show correlated high-risk information.</li><li>T - Time Coverage. The customer is attempting a purchase outside of the expected time.</li><li>U - Unverifiable address. The billing or delivery address can not be verified.</li><li>V - Velocity. The account number was used many times in the last 15 minutes.</li><li>W - Marked as suspect. The billing or delivery address is similar to an address previously marked as suspicious.</li><li>Y - The address, city, state or country of the billing and delivery addresses do not correlate.</li><li>Z - Invalid value. Because the request contains an unexpected value, a default value has been replaced. Although the transaction can still be processed, examine the order carefully for any anomalies.</li></ul>|
|`Score`|Total score calculated for the order.|Number|---|Number|
|`BinCountry`|Abbreviation of the purchase origin country.|Text|2|us|
|`CardIssuer`|Name of the bank or issuer of the card.|Text|128|Bradesco|
|`CardScheme`|Issuer type|Text|20|<ul><li>MaestroInternational - Maestro International</li><li>MaestroUkDomestic - Maestro UK Domestic</li><li>MastercardCredit - MasterCard Credit</li><li>MastercardDebit - MasterCard Debit</li><li>VisaCredit - Visa Credit</li><li>VisaDebit - Visa Debit</li><li>VisaElectron - Visa Electron</li></ul>|
|`HostSeverity`|Risk level of the buyer's e-mail domain, 0 to 5, where 0 is undetermined risk and 5 represents the highest risk.|Number|---|5|
|`InternetInfoCode`|Sequence of codes that indicate that there is an excessive change of identities of the buyer. The codes are concatenated using the ^ character.|Text|255|Ex: <br /><ul><li>MORPH-B - The same billing address has been used multiple times with multiple customer identities.</li><li>MORPH-C - The same account number has been used multiple times with multiple client identities.</li><li>MORPH-E - The same e-mail address has been used multiple times with multiple customer identities. MORPH-I The same IP address has been used multiple times with multiple client identities.</li><li>MORPH-P - The same phone number has been used multiple times with multiple customer identities.</li><li>MORPH-S - The same delivery address has been used multiple times with multiple customer identities.</li></ul>|
|`IpRoutingMethod`|Type of IP routing used by the computer.|Text|---|<ul><li>Anonymizer</li><li>AolBased</li><li>CacheProxy</li><li>Fixed</li><li>InternationalProxy</li><li>MobileGateway</li><li>Pop</li><li>RegionalProxy</li><li>Satellite</li><li>SuperPop</li></ul>|
|`ScoreModelUsed`|Name of the scoring model used.|Text|20|Ex: default_lac|
|`CasePriority`|If the merchant subscribes to Enhanced Case Management, it receives this value with the priority level, being 1 the highest and 5 the lowest.|Number|---|3|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric text|
# Payments with Debit Card
## Creating a simplified sale
To create a sale that will use a debit card, it is necessary to do a POST for the Payment feature as shown. This example includes the minimum number of fields required to be sent for authorization.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014121201",
"Customer":{
"Name":"Comprador Cartão de débito"
},
"Payment":{
"Type":"DebitCard",
"Amount":15700,
"ReturnUrl":"http://www.cielo.com.br",
"DebitCard":{
"CardNumber":"4551870000000183",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014121201",
"Customer":{
"Name":"Comprador Cartão de débito"
},
"Payment":{
"Type":"DebitCard",
"Amount":15700,
"ReturnUrl":"http://www.cielo.com.br",
"DebitCard":{
"CardNumber":"4551870000000183",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Customer.Status`|Buyer registration status in store (NEW / EXISTING) - Used by fraud analysis|Text|255|No|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.ReturnUrl`|Merchant's return Url.|Text|1024|Yes|
|`Payment.ReturnUrl`|URI to which the user will be redirected after payment ends|Text|1024|Yes|
|`DebitCard.CardNumber`|Buyer's Card Number.|Text|19|Yes|
|`DebitCard.Holder`|Buyer's name printed on card.|Text|25|No|
|`DebitCard.ExpirationDate`|Expiry date printed on card.|Text|7|Yes|
|`DebitCard.SecurityCode`|Security code printed on back of card.|Text|4|No|
|`DebitCard.Brand`|Card issuer.|Text|10|Yes|
### Response
```json
{
"MerchantOrderId": "2014121201",
"Customer": {
"Name": "Comprador Cartão de débito"
},
"Payment": {
"DebitCard": {
"CardNumber": "453211******3703",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"AuthenticationUrl": "https://xxxxxxxxxxxx.xxxxx.xxx.xx/xxx/xxxxx.xxxx?{PaymentId}",
"Tid": "1006993069207A31A001",
"PaymentId": "0309f44f-fe5a-4de1-ba39-984f456130bd",
"Type": "DebitCard",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 0,
"ReturnCode": "0",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014121201",
"Customer": {
"Name": "Comprador Cartão de débito"
},
"Payment": {
"DebitCard": {
"CardNumber": "453211******3703",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"AuthenticationUrl": "https://xxxxxxxxxxxx.xxxxx.xxx.xx/xxx/xxxxx.xxxx?{PaymentId}",
"Tid": "1006993069207A31A001",
"PaymentId": "0309f44f-fe5a-4de1-ba39-984f456130bd",
"Type": "DebitCard",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 0,
"ReturnCode": "0",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`AuthenticationUrl`|URL to which the Merchant must redirect the Customer to the Debit flow.|Text|56|Authentication Url|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ReturnUrl`|Merchant's return Url . URL to where the merchant will be redirected at the end of the flow.|Text|1024|http://www.urllogista.com.br|
|`Status`|Transaction Status.|Byte|---|0|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
# Payments with Electronic Transfer
## Creating a simplified sale
To create an electronic transfer sale, it is necessary to make a POST for the Payment feature as shown. This example includes the minimum number of fields required to be sent for authorization.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111706",
"Customer":
{
"Name":"Comprador Transferência Eletronica"
},
"Payment":
{
"Type":"EletronicTransfer",
"Amount":15700,
"Provider":"Bradesco",
"ReturnUrl":"http://www.cielo.com.br"
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111706",
"Customer":
{
"Name":"Comprador Transferência Eletronica"
},
"Payment":
{
"Type":"EletronicTransfer",
"Amount":15700,
"Provider":"Bradesco",
"ReturnUrl":"http://www.cielo.com.br"
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Customer.Status`|Buyer registration status in store (NEW / EXISTING) - Used by fraud analysis|Text|255|No|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Provider`|Defines behavior of the means of payment ([See Annex](https://developercielo.github.io/Webservice-3.0/#anexos))/NOT REQUIRED FOR CREDIT.|Text|15|---|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Transferência Eletronica",
},
"Payment": {
"Url": "https://xxx.xxxxxxx.xxx.xx/post/EletronicTransfer/Redirect/{PaymentId}",
"PaymentId": "765548b6-c4b8-4e2c-b9b9-6458dbd5da0a",
"Type": "EletronicTransfer",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Bradesco",
"ExtraDataCollection": [],
"Status": 0,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Transferência Eletronica",
},
"Payment": {
"Url": "https://xxx.xxxxxxx.xxx.xx/post/EletronicTransfer/Redirect/{PaymentId}",
"PaymentId": "765548b6-c4b8-4e2c-b9b9-6458dbd5da0a",
"Type": "EletronicTransfer",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Bradesco",
"ExtraDataCollection": [],
"Status": 0,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`Url`|URL to which the Merchant must redirect the Customer to the Electronic Transfer flow.|Text|256|Authentication Url|
|`Status`|Transaction Status.|Byte|---|0|
# Payments with Bank slip
## Creating a Bank slip sale
To create a sale whose form of payment is bank slip, just do a POST as the example.
**NOTE:** The API supports registered and unregistered bank slips, with the provider being the differentiator between them. We suggest that you validate with your bank what type of bank slip that is supported by your wallet. The API only accepts **Bradesco** and **Banco do Brasil** bank slips
In the **Banco do Brasil Registered Bank slip**, the digitable line will not be returned in the response of the request. This information will be available after conciliation.
For all text fields, including the instructions field and the ones related with address, these are accepted as valid characters:
* The letters from A to Z (CAPITAL LETTERS)
* Special characters of conjunction: **hyphen (-)** / **apostrophe (')** / When used it can not contain spaces between the letters: <br>
**Correct examples**: D'EL-REI, D'ALCORTIVO, SANT'ANA<br>
**Incorrect examples**: D'EL - REI<br>
* At most one blank space between words
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111706",
"Customer":
{
"Name":"Comprador Teste Boleto",
"Identity": "1234567890",
"Address":
{
"Street": "Avenida Marechal Câmara",
"Number": "160",
"Complement": "Sala 934",
"ZipCode" : "22750012",
"District": "Centro",
"City": "Rio de Janeiro",
"State" : "RJ",
"Country": "BRA"
}
},
"Payment":
{
"Type":"Boleto",
"Amount":15700,
"Provider":"INCLUIR PROVIDER",
"Address": "Rua Teste",
"BoletoNumber": "123",
"Assignor": "Empresa Teste",
"Demonstrative": "Desmonstrative Teste",
"ExpirationDate": "5/1/2015",
"Identification": "11884926754",
"Instructions": "Aceitar somente até a data de vencimento, após essa data juros de 1% dia."
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111706",
"Customer":
{
"Name":"Comprador Teste Boleto",
"Identity": "1234567890",
"Address":
{
"Street": "Avenida Marechal Câmara",
"Number": "160",
"Complement": "Sala 934",
"ZipCode" : "22750012",
"District": "Centro",
"City": "Rio de Janeiro",
"State" : "RJ",
"Country": "BRA"
}
},
"Payment":
{
"Type":"Boleto",
"Amount":15700,
"Provider":"INCLUIR PROVIDER",
"Address": "Rua Teste",
"BoletoNumber": "123",
"Assignor": "Empresa Teste",
"Demonstrative": "Desmonstrative Teste",
"ExpirationDate": "5/1/2015",
"Identification": "11884926754",
"Instructions": "Aceitar somente até a data de vencimento, após essa data juros de 1% dia."
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Customer.Status`|Buyer registration status in store(NEW / EXISTING) - Used by fraud analysis|Text|255|No|
|`Customer.Address.ZipCode`|Buyer's address zip code.|Text|9|Yes|
|`Customer.Address.Country`|Buyer's address country.|Text|35|Yes|
|`Customer.Address.State`|Buyer's address state.|Text|2|Yes|
|`Customer.Address.City`|Buyer's address city.|Text|50|Yes|
|`Customer.Address.District`|Buyer's neighborhood.|Text|50|Yes|
|`Customer.Address.Street`|Buyer's address.|Text|255|Yes|
|`Customer.Address.Number`|Buyer's address number.|Text|15|Yes|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Provider`|Defines behavior of the means of payment (see Annex)/NOT REQUIRED FOR CREDIT.|Text|15|Yes|
|`Payment.Adress`|Transferor's address.|Text|255|No|
|`Payment.BoletoNumber`|Bank slip number sent by the merchant. Used to count issued bank slips ("OurNumber").|Text|50|No|
|`Payment.Assignor`|Transferor's name.|Text|200|No|
|`Payment.Demonstrative`|Demonstration text.|Text|450|No|
|`Payment.ExpirationDate`|Bank slip expiration date.|Date|10|No|
|`Payment.Identification`|Identification document of the Transferor.|Text|14|No|
|`Payment.Instructions`|Bank slip instructions.|Text|450|No|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer":
{
"Name": "Comprador Boleto Completo",
"Address":
{
"Street": "Av Marechal Camara",
"Number": "160",
"ZipCode": "22750012",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA",
"District": "Centro"
}
},
"Payment":
{
"Instructions": "Aceitar somente até a data de vencimento, após essa data juros de 1% dia.",
"ExpirationDate": "2015-01-05",
"Url": "https://apisandbox.cieloecommerce.cielo.com.br/post/pagador/reenvia.asp/a5f3181d-c2e2-4df9-a5b4-d8f6edf6bd51",
"Number": "123-2",
"BarCodeNumber": "00096629900000157000494250000000012300656560",
"DigitableLine": "00090.49420 50000.000013 23006.565602 6 62990000015700",
"Assignor": "Empresa Teste",
"Address": "Rua Teste",
"Identification": "11884926754",
"PaymentId": "a5f3181d-c2e2-4df9-a5b4-d8f6edf6bd51",
"Type": "Boleto",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Bradesco",
"ExtraDataCollection": [],
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer":
{
"Name": "Comprador Boleto Completo",
"Address": {}
},
"Payment":
{
"Instructions": "Aceitar somente até a data de vencimento, após essa data juros de 1% dia.",
"ExpirationDate": "2015-01-05",
"Url": "https://apisandbox.cieloecommerce.cielo.com.br/post/pagador/reenvia.asp/a5f3181d-c2e2-4df9-a5b4-d8f6edf6bd51",
"Number": "123-2",
"BarCodeNumber": "00096629900000157000494250000000012300656560",
"DigitableLine": "00090.49420 50000.000013 23006.565602 6 62990000015700",
"Assignor": "Empresa Teste",
"Address": "Rua Teste",
"Identification": "11884926754",
"PaymentId": "a5f3181d-c2e2-4df9-a5b4-d8f6edf6bd51",
"Type": "Boleto",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Bradesco",
"ExtraDataCollection": [],
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`Instructions`|Bank slip instructions.|Text|450|e.g.: Accept only until the due date, after that date interest of 1% per day.|
|`ExpirationDate`|Expiration date.|Text|10|2014-12-25|
|`Url`|Generated Bank slip Url.|string|256|e.g.:https://.../pagador/reenvia.asp/8464a692-b4bd-41e7-8003-1611a2b8ef2d|
|`Number`|"OurNumber" generated.|Text|50|e.g.: 1000000012-8|
|`BarCodeNumber`|Barcode numerical representation.|Text|44|e.g.: 00091628800000157000494250100000001200656560|
|`DigitableLine`|Digitable line.|Text|256|e.g.: 00090.49420 50100.000004 12006.565605 1 62880000015700|
|`Assignor`|Transferor's name.|Text|256|e.g.: Test Store|
|`Address`|Transferor's address.|Text|256|e.g.: 160 Test Avenue|
|`Identification`|Identification document of the Transferor.|Text|14|CPF or CNPJ of the Transferor without the special characters (., /, -)|
|`Status`|Transaction Status.|Byte|---|1|
## Additional Rules
Number of characters per field and Provider:
|Property|Notes|Bradesco|Banco do Brasil|
|---|---|---|---|
|`Provider`|N/A|Bradesco2|BancoDoBrasil2|
|`MerchantOrderId`|NOTE 1|27|50|
|`Payment.BoletoNumber`|NOTE 2|11|9|
|`Customer.Name`|NOTE 3|34|60|
|`Customer.Address.Street`|NOTE 4|70|See comment|
|`Customer.Address.Number`|NOTE 4|10|See comment|
|`Customer.Address.Complement`|NOTE 4|20|See comment|
|`Customer.Address.District`|NOTE 4|50|See comment|
|`Customer.Address.City`||50 - NOTE 4|18 - NOTE 3|
|`Payment.Instructions`|N/A|450|450|
|`Payment.Demonstrative`|N/A|255|Not sent to banco do Brasil|
> **Banco Do Brasil Comment**: The fields `Customer.Address.Street`; `Customer.Address.Number`; `Customer.Address.Complement`; `Customer.Address.District` must total up to 60 characters.
|Notes|Bradesco|Banco do Brasil|
|---|---|---|
|**NOTE 1:**|Only letters, numbers and characters like "_" and "$"|Not sent to the bank|
|**NOTE 2:**|The value is persisted in the bank|When sent above 9 positions, the API Cielo truncates automatically, considering the last 9 digits|
|**NOTE 3:**|The API Cielo truncates automatically|**Valid characters:** <br> Letters from A to Z - CAPITAL LETTERS <br> **Special characters:** hyphen (-) and apostrophe (') <br> When used, it can not contain spaces between letters; <br><br> **Correct examples**: D'EL-REI, D'ALCORTIVO, SANT'ANA.<br> **Incorrect examples**: D'EL - REI; at most one blank space between words|
|**NOTE 4:**|The value is persisted in the API Cielo|N/A|
# Recurring Payments
Recurring payments are transactions that must be repeated after a certain period of time.
These are payments normally found on **signatures**, where the buyer wants to be automatically charged but does not want to re-enter the credit card details.
## Types of recurrences
The API Cielo Ecommerce works with two types of Recurrence that have different behaviors.
* **Own Recurrence** - When repetition intelligence and recurrence card data become under responsibility the of the merchant
* **Scheduled Recurrence** - When the intelligence of repetition and recurrence card data become under the responsibility of **Cielo**
### Own Recurrence
In this model, the merchant is responsible for creating the necessary intelligence to:
|Intelligence|Description|
|---|---|
|**Save transaction data**|The store will need to store the transaction and payment data|
|**Create transactional repetition**|The store must sent a new transaction whenever it needs an Authorization|
|**Behavior for denied transaction**|If one of the transactions is denied, it will be up to the store to "retry" a new authorization|
In all instances, the scheduled recurrence is a standard transaction for Cielo, its only difference being the need to send an additional parameter that defines it as **Own Recurrence**
**Parameter:** `Payment.Recurrent`= `True`
#### Use case
This is an example of how the API Cielo Ecommerce allows the use of external systems of recurrence in their transactions
The own recurrence is a configuration of the API Cielo Ecommerce that allows a merchant to use an internal recurrence system specific to their business needs.
In this model, the merchant' system is in charge of defining the period, the transactional data, and when necessary, send us the sale of recurrence.
**See an example in use:**
* Own recurrence + Tokenized Card
The CleverFit academy has a differentiated billing system, where tuition is charged every fifteen days, but never on weekends.
As a highly customized model, CleverFit has its own recurrence system, using the API Cielo Ecommerce via two mechanisms:
1. **Own Recurrence** - CleverFit sends the transaction data as a normal sale, but the API identifies it as a recurrence and applies differential authorization rules to the order.
1. **Tokenized Card** - CleverFit keeps your cards secure via tokenization, reducing the risk of securing transactional data in your system.
CleverFit sends the transaction every fifteen days to the API Cielo Ecommerce, using the Tokens saved in the API itself and opting for Own Recurrence, which changes the authorization rule to suit its charge model
### Scheduled Recurrence
In this model, Cielo is responsible for the intelligence necessary to perform a recurrence automatically.
The **Scheduled Recurrence** allows the merchant to create a base transaction, which when sent to the API Cielo Ecommerce, will be saved and executed following the rules defined by the merchant.
In this model, the API performs and allows:
|Advantages|Description|
|---|---|
|**Saves transactional data**|Saves transaction data, thus creating a model of how the next Recurrences will be|
|**Automates the recurrence**|Without store action, the API creates future transactions according to the merchant' settings|
|**Allows updating of data**|If necessary, the API allows changes of the transaction information or the recurrence cycle|
The Scheduled Recurrence is formed by a simple transactional structure. The Merchant shall inform in the transaction the following data:
```
"RecurrentPayment":
{
"AuthorizeNow":"False",
"StartDate":"2019-06-01"
"EndDate":"2019-12-01",
"Interval":"SemiAnnual"
}
```
Onde podemos definir os dados como:
|Parameters|Description|
|---|---|
|`AuthorizeNow`|Defines the time a recurrence will be created. If it is sent as `True`, it is created at the time of authorization, if `False`, the recurrence will be suspended until the date chosen to be initiated.|
|`StartDate`|Defines the date on which Scheduled Recurrence transaction will be authorized|
|`EndDate`|Defines the date the Scheduled Recurrence will end. If it is not sent, the Recurrence will be executed until it is canceled by the merchant|
|`Interval`|Recurrence interval.<br /><ul><li>Monthly - Mensal </li><li>Bimonthly - Bimestral </li><li>Quarterly - Trimestral </li><li>SemiAnnual - Semestral </li><li>Annual - Anual </li></ul>|
When a transaction is sent to the API Cielo Ecommerce with the Scheduled Recurrence node, the recurrence process becomes effective when the transaction is considered **AUTHORIZED**.
From that point on, it will occur within the interval defined by the merchant.
Important features of **Scheduled Recurrence**:
|Information|Description|
|---|---|
|**Creation**|The first transaction is called **"Scheduling Transaction"**, all subsequent transactions will be copies of the first transaction. It does not need to be captured for the recurrence to be created, just be **AUTHORIZED**|
|**Capture**|Scheduled Recurrence transactions do not need to be captured. After the first transaction, all recurrence transactions are automatically captured by the API|
|**Identification**|Scheduled Recurrence transactions generate two types of identification:<br>**PAYMENTID**: Identify 1 transaction. It is the same identifier of the other transactions in the API <br>**RECURRENTPAYMENTID**: Identifies recurrence Order. A RecurrentPaymentID has innumerable PaymentID linked to it. This is the variable used to Cancel a Scheduled Recurrence|
|**Consulting**|To consult, just use one of two types of identification:<br>**PAYMENTID**: Used to consult A TRANSACTION WITHIN THE RECURRENCE <br>**RECURRENTPAYMENTID**: Used to consult THE RECURRENCE.|
|**Cancellation**|A Scheduled Recurrence can be canceled in two ways: <br>**Merchant**: It requests the cancellation of the recurrence. Do not cancel transactions already finalized before the recurrence cancellation order. <br>**By invalid card**: If the API identifies that a saved card is invalid (e.g.: Expired) the recurrence will be canceled and will not be repeated until the merchant updates the means of payment. <br> **NOTE:** Canceling transactions within the recurrence does not end the scheduling of future transactions. Only the Cancellation using the **RecurrentPaymentID** ends future schedules.
**RecurrentPaymentID Structure**

**Scheduled Recurrence flow**

#### Use case
This is an example of how to use API Cielo Ecommerce's recurrences to increase your sales:
Recurrence is the process of saving a transaction and repeating it at a predefined time interval. Ideal for subscription model.
The Cielo' scheduled recurrence has the following characteristics:
* **Scheduled intervals:** Monthly, bimonthly, quarterly, semi-annual and annual
* **Expiry date:** Enables to define whether the recurrence will end
* **Retentative:** if a transaction is denied, we will retry the transaction up to 4x
* **Update:** Allows you to change recurrence data, such as value, interval.
See an example in use:
* **Monthly and annual recurrence**
The Musicfy company offers an online subscription service where their customers pay to be able to access a music library and listen to them via streaming.
To capture the maximum of customers, they offer 2 ways of payment:
* Monthly for R$19,90
* Annual (with discount) for R$180,00
How do they perform the monthly or annual billing of their customers?
MusicFy uses API Cielo Ecommerce Scheduled Recurrence.
When creating a transaction, Musicfy informs that the order in question must be repeated monthly or annually and that there is no end date for the charge.
What are the advantages of using scheduled recurrence for MusicFy?:
1. **Facility:** Monthly charge is automatic, so MusicFy does not have to worry about building a billing system.
2. **Usability:** The subscription value can be updated without the need to redo the transaction. A month can be canceled or the recurrence can have a delay (the 30-day free model) with only one setting.
3. **Safety:** It is not necessary to store sensitive card and buyer data at the store.
4. **Conversion:** The scheduled recurrence of Cielo has an automatic retentative system. If one of the transactions is denied, it will be retried up to 4 times, seeking to obtain the authorization.
## Creating an OWN RECURRENCE
To create a recurring sale whose recurrence and interval processes will be executed by the store itself, just do a POST as the example.
The `Payment.Recurrent` parameter must be `true`, otherwise the transaction will be denied.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador rec propria"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"Recurrent": true,
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador rec propria"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"Recurrent": true,
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|6|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Installments`|Number of Installments.|Number|2|Yes|
|`Payment.SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|No|
|`Payment.Recurrent`|marking an unscheduled recurrence transaction|boolean|5|No|
|`CreditCard.CardNumber`|Buyer's Card Number.|Text|19|Yes|
|`CreditCard.Holder`|Buyer's name printed on card.|Text|25|No|
|`CreditCard.ExpirationDate`|Expiry date printed on card.|Text|7|Yes|
|`CreditCard.SecurityCode`|Security code printed on back of card.|Text|4|No|
|`CreditCard.Brand`|Card issuer.|Text|10|Yes|
### Response
```json
{
"MerchantOrderId": "2014113245231706",
"Customer": {
"Name": "Comprador rec propria"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"Recurrent": true,
"CreditCard": {
"CardNumber": "123412******1231",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "3827556",
"Tid": "0504043827555",
"AuthorizationCode": "149867",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "737a8d9a-88fe-4f74-931f-acf81149f4a0",
"Type": "CreditCard",
"Amount": 1500,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Simulado",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Link": {
"Method": "GET",
"Rel": "recurrentPayment",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}"
},
"AuthorizeNow": true
},
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014113245231706",
"Customer": {
"Name": "Comprador rec propria"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"Recurrent": true,
"CreditCard": {
"CardNumber": "123412******1231",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "3827556",
"Tid": "0504043827555",
"AuthorizationCode": "149867",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "737a8d9a-88fe-4f74-931f-acf81149f4a0",
"Type": "CreditCard",
"Amount": 1500,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Link": {
"Method": "GET",
"Rel": "recurrentPayment",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}"
},
"AuthorizeNow": true
},
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|6|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Installments`|Number of Installments.|Number|2|Yes|
|`Payment.SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|No|
|`Payment.Recurrent`|marking an unscheduled recurrence transaction|boolean|5|No|
|`CreditCard.CardNumber`|Buyer's Card Number.|Text|19|Yes|
|`CreditCard.Holder`|Buyer's name printed on card.|Text|25|No|
|`CreditCard.ExpirationDate`|Expiry date printed on card.|Text|7|Yes|
|`CreditCard.SecurityCode`|Security code printed on back of card.|Text|4|No|
|`CreditCard.Brand`|Card issuer.|Text|10|Yes|
## Creating a SCHEDULED RECURRENCE
To create a recurring sale whose first recurrence is authorized with the form of payment as credit card, just do a POST as the example.
<aside class="notice"><strong>Warning:</strong> In this recurrence mode, the first transaction must be
of. All subsequent transactions will be automatically captured.</aside>
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador rec programada"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"RecurrentPayment":{
"AuthorizeNow":"true",
"EndDate":"2019-12-01",
"Interval":"SemiAnnual"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador rec programada"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"RecurrentPayment":{
"AuthorizeNow":"true",
"EndDate":"2019-12-01",
"Interval":"SemiAnnual"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|6|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Installments`|Number of Installments.|Number|2|Yes|
|`Payment.SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|No|
|`Payment.RecurrentPayment.EndDate`|End date for recurrence.|Text|10|No|
|`Payment.RecurrentPayment.Interval`|Recurrence interval.<br /><ul><li>Monthly (Default) </li><li>Bimonthly </li><li>Quarterly </li><li>SemiAnnual </li><li>Annual</li></ul>|Text|10|No|
|`Payment.RecurrentPayment.AuthorizeNow`|Boolean to know if the first recurrence is about to be Authorized or not.|Boolean|---|Yes|
|`CreditCard.CardNumber`|Buyer's Card Number.|Text|19|Yes|
|`CreditCard.Holder`|Buyer's name printed on card.|Text|25|No|
|`CreditCard.ExpirationDate`|Expiry date printed on card.|Text|7|Yes|
|`CreditCard.SecurityCode`|Security code printed on back of card.|Text|4|No|
|`CreditCard.Brand`|Card issuer.|Text|10|Yes|
### Response
```json
{
"MerchantOrderId": "2014113245231706",
"Customer": {
"Name": "Comprador rec programada"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "123412******1231",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "3827556",
"Tid": "0504043827555",
"AuthorizationCode": "149867",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "737a8d9a-88fe-4f74-931f-acf81149f4a0",
"Type": "CreditCard",
"Amount": 1500,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Simulado",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"RecurrentPayment": {
"RecurrentPaymentId": "61e5bd30-ec11-44b3-ba0a-56fbbc8274c5",
"NextRecurrency": "2015-11-04",
"EndDate": "2019-12-01",
"Interval": "SemiAnnual",
"Link": {
"Method": "GET",
"Rel": "recurrentPayment",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}"
},
"AuthorizeNow": true
},
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014113245231706",
"Customer": {
"Name": "Comprador rec programada"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "123412******1231",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "3827556",
"Tid": "0504043827555",
"AuthorizationCode": "149867",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "737a8d9a-88fe-4f74-931f-acf81149f4a0",
"Type": "CreditCard",
"Amount": 1500,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"RecurrentPayment": {
"RecurrentPaymentId": "61e5bd30-ec11-44b3-ba0a-56fbbc8274c5",
"NextRecurrency": "2015-11-04",
"EndDate": "2019-12-01",
"Interval": "SemiAnnual",
"Link": {
"Method": "GET",
"Rel": "recurrentPayment",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}"
},
"AuthorizeNow": true
},
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`RecurrentPaymentId`|Next recurrence Identifier field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`NextRecurrency`|Date of next recurrence.|Text|7|12/2030 (MM/YYYY)|
|`EndDate`|End date of recurrence.|Text|7|12/2030 (MM/YYYY)|
|`Interval`|Interval between recurrences.|Text|10|<ul><li>Monthly</li><li>Bimonthly </li><li>Quarterly </li><li>SemiAnnual </li><li>Annual</li></ul>|
|`AuthorizeNow`|Boolean to know if the first recurrence is about to be Authorized or not.|Boolean|---|true ou false|
## Scheduling a Scheduled Recurrence
To create a recurring sale whose first recurrence will not be authorized on the same date with the form of payment as credit card, just do a POST as the example.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador rec programada"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"RecurrentPayment":{
"AuthorizeNow":"false",
"EndDate":"2019-12-01",
"Interval":"SemiAnnual",
"StartDate":"2015-06-01"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador rec programada"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"RecurrentPayment":{
"AuthorizeNow":"false",
"EndDate":"2019-12-01",
"Interval":"SemiAnnual",
"StartDate":"2015-06-01"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Customer.Status`|Buyer registration status in store (NEW / EXISTING) - Used by fraud analysis|Text|255|No|
|`Customer.Email`|Buyer's e-mail.|Text|255|No|
|`Customer.Birthdate`|Buyer's date of birth.|Date|10|No|
|`Customer.Identity`|Customer's RG, CPF or CNPJ number.|Text|14|No|
|`Customer.Address.Street`|Buyer's address.|Text|255|No|
|`Customer.Address.Number`|Buyer's address number.|Text|15|No|
|`Customer.Address.Complement`|Buyer's address complement.|Text|50|No|
|`Customer.Address.ZipCode`|Buyer's address zip code.|Text|9|No|
|`Customer.Address.City`|Buyer's address city.|Text|50|No|
|`Customer.Address.State`|Buyer's address state.|Text|2|No|
|`Customer.Address.Country`|Buyer's address country.|Text|35|No|
|`Customer.Address.District`|Buyer's neighborhood.|Text|50|No|
|`Customer.DeliveryAddress.Street`|Buyer's address.|Text|255|No|
|`Customer.DeliveryAddress.Number`|Buyer's address number.|Text|15|No|
|`Customer.DeliveryAddress.Complement`|Buyer's address complement.|Text|50|No|
|`Customer.DeliveryAddress.ZipCode`|Buyer's address zip code.|Text|9|No|
|`Customer.DeliveryAddress.City`|Buyer's address city.|Text|50|No|
|`Customer.DeliveryAddress.State`|Buyer's address state.|Text|2|No|
|`Customer.DeliveryAddress.Country`|Buyer's address country.|Text|35|No|
|`Customer.DeliveryAddress.District`|Buyer's neighborhood.|Text|50|No|
### Response
```json
{
"MerchantOrderId": "2014113245231706",
"Customer": {
"Name": "Comprador rec programada"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "123412******1231",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"SoftDescriptor":"123456789ABCD",
"Type": "CreditCard",
"Amount": 1500,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 20,
"RecurrentPayment": {
"RecurrentPaymentId": "0d2ff85e-594c-47b9-ad27-bb645a103db4",
"NextRecurrency": "2015-06-01",
"StartDate": "2015-06-01",
"EndDate": "2019-12-01",
"Interval": "SemiAnnual",
"Link": {
"Method": "GET",
"Rel": "recurrentPayment",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{PaymentId}"
},
"AuthorizeNow": false
}
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014113245231706",
"Customer": {
"Name": "Comprador rec programada"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "123412******1231",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"SoftDescriptor":"123456789ABCD",
"Type": "CreditCard",
"Amount": 1500,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Simulado",
"ExtraDataCollection": [],
"Status": 20,
"RecurrentPayment": {
"RecurrentPaymentId": "0d2ff85e-594c-47b9-ad27-bb645a103db4",
"NextRecurrency": "2015-06-01",
"StartDate": "2015-06-01",
"EndDate": "2019-12-01",
"Interval": "SemiAnnual",
"Link": {
"Method": "GET",
"Rel": "recurrentPayment",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{PaymentId}"
},
"AuthorizeNow": false
}
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`RecurrentPaymentId`|Next recurrence Identifier field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`NextRecurrency`|Date of next recurrence.|Text|7|12/2030 (MM/YYYY)|
|`StartDate`|Start date of recurrence.|Text|7|12/2030 (MM/YYYY)|
|`EndDate`|End date of recurrence.|Text|7|12/2030 (MM/YYYY)|
|`Interval`|Interval between recurrences.|Text|10|<ul><li>Monthly</li><li>Bimonthly </li><li>Quarterly </li><li>SemiAnnual </li><li>Annual</li></ul>|
|`AuthorizeNow`|Boolean to know if the first recurrence is about to be Authorized or not.|Boolean|---|true ou false|
## Modifying buyer data
To change the Recurrence buyer's data, just do a Put as the example.
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/Customer</span></aside>
```json
{
"Name":"Customer",
"Email":"customer@teste.com",
"Birthdate":"1999-12-12",
"Identity":"22658954236",
"IdentityType":"CPF",
"Address":{
"Street":"Rua Teste",
"Number":"174",
"Complement":"AP 201",
"ZipCode":"21241140",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
},
"DeliveryAddress":{
"Street":"Outra Rua Teste",
"Number":"123",
"Complement":"AP 111",
"ZipCode":"21241111",
"City":"Qualquer Lugar",
"State":"QL",
"Country":"BRA",
"District":"Teste"
}
}
```
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}/Customer"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Name":"Customer",
"Email":"customer@teste.com",
"Birthdate":"1999-12-12",
"Identity":"22658954236",
"IdentityType":"CPF",
"Address":{
"Street":"Rua Teste",
"Number":"174",
"Complement":"AP 201",
"ZipCode":"21241140",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
},
"DeliveryAddress":{
"Street":"Outra Rua Teste",
"Number":"123",
"Complement":"AP 111",
"ZipCode":"21241111",
"City":"Qualquer Lugar",
"State":"QL",
"Country":"BRA",
"District":"Teste"
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Customer.Status`|Buyer registration status in store (NEW / EXISTING) - Used by fraud analysis|Text|255|No|
|`Customer.Email`|Buyer's e-mail.|Text|255|No|
|`Customer.Birthdate`|Buyer's date of birth.|Date|10|No|
|`Customer.Identity`|Customer's RG, CPF or CNPJ number.|Text|14|No|
|`Customer.IdentityType`|Text|255|No|Type of buyer ID document (CFP/CNPJ).|
|`Customer.Address.Street`|Buyer's address.|Text|255|No|
|`Customer.Address.Number`|Buyer's address number.|Text|15|No|
|`Customer.Address.Complement`|Buyer's address complement.|Text|50|No|
|`Customer.Address.ZipCode`|Buyer's address zip code.|Text|9|No|
|`Customer.Address.City`|Buyer's address city.|Text|50|No|
|`Customer.Address.State`|Buyer's address state.|Text|2|No|
|`Customer.Address.Country`|Buyer's address country.|Text|35|No|
|`Customer.Address.District`|Buyer's neighborhood.|Text|50|No|
|`Customer.DeliveryAddress.Street`|Buyer's address.|Text|255|No|
|`Customer.DeliveryAddress.Number`|Buyer's address number.|Text|15|No|
|`Customer.DeliveryAddress.Complement`|Buyer's address complement.|Text|50|No|
|`Customer.DeliveryAddress.ZipCode`|Buyer's address zip code.|Text|9|No|
|`Customer.DeliveryAddress.City`|Buyer's address city.|Text|50|No|
|`Customer.DeliveryAddress.State`|Buyer's address state.|Text|2|No|
|`Customer.DeliveryAddress.Country`|Buyer's address country.|Text|35|No|
|`Customer.DeliveryAddress.District`|Buyer's neighborhood.|Text|50|No|
### Response
```shell
HTTP Status 200
```
See the annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Modifying end date of Recurrence
To change the end date of the Recurrence, just do a Put as the example.
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/EndDate</span></aside>
```json
"2021-01-09"
```
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}/EndDate"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
"2021-01-09"
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
|`EndDate`|End date for recurrence.|Text|10|Yes|
### Response
```shell
HTTP Status 200
```
See the annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Modifying Recurrence interval
To change the Recurrence Interval, just do a Put according to the example.
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/Interval</span></aside>
```json
6
```
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}/Interval"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
6
--verbose
```
|Property|Description|Type|Size|Request|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
|`Interval`|Recurrence interval. <ul><li>Monthly</li><li>Bimonthly </li><li>Quarterly </li><li>SemiAnnual </li><li>Annual</li></ul>|Number|2|Yes|
### Response
```shell
HTTP Status 200
```
See the annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Modify day of Recurrence
To modify the day of recurrence, just do a Put as the example.
<aside class="notice"><strong>Rule:</strong> If the new day informed is after the current day, we will update the recurrence day with effect on the next recurrence. E.g.: Today is day 5, and the next recurrence is day 05/25. When I upgrade to day 10, the date of the next recurrence will be day 05/10. If the new day reported is before the current day, we will update the recurrence day, but this will only take effect after the next recurrence is successfully performed. E.g.: Today is day 5, and the next recurrence is day 05/25. When I upgrade to day 3, the date of the next recurrence will remain on 05/25, and after it performs, the next one will be scheduled for day 06/03. If the new informed day is before the current day, but the next recurrence is in another month, we will update the recurrence day with effect on the next recurrence. E.g.: Today is day 5, and the next recurrence is day 09/25. When I upgrade to day 3, the next recurrence date will be 09/03</aside>
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/RecurrencyDay</span></aside>
```json
16
```
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}/RecurrencyDay"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
16
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
|`RecurrencyDay`|Recurrence day.|Number|2|Yes|
### Response
```shell
HTTP Status 200
```
See the Annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Modifying the Recurrence value
To modify the value of the recurrence, just do a Put as example.
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/Amount</span></aside>
```json
156
```
```shell
curl
--request POST "https://apisandbox.braspag.com.br/1/RecurrentPayment/{RecurrentPaymentId}/Amount"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
156
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
|`Payment.Amount`|Order Value in cents: 156 equals R$ 1,56|Number|15|Yes|
<aside class="warning">This change only affects the payment date of the next recurrence.</aside>
### Response
```shell
HTTP Status 200
```
See the Annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Modifying date of next Payment
To change the date of the next Payment, just do a Put as the example.
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/NextPaymentDate</span></aside>
```json
"2016-06-15"
```
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}/NextPaymentDate"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
"2016-06-15"
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
|`NextPaymentDate`|Payment date of the next recurrence.|Text|10|Yes|
### Response
```shell
HTTP Status 200
```
See the Annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Modifying Recurrence Payment data
To change the payment data of the Recurrence, just do a Put as the example.
<aside class="notice"><strong>Warning:</strong> This change affects all data in the Payment node. So to keep the previous data you must inform the fields that will not change with the same values that were already saved.</aside>
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/Payment</span></aside>
```json
{
"Type":"CreditCard",
"Amount":"123",
"Installments":3,
"Country":"USA",
"Currency":"BRL",
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"Brand":"Master",
"Holder":"Teset card",
"CardNumber":"1234123412341232",
"ExpirationDate":"12/2030"
}
}
```
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}/Payment"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Type":"CreditCard",
"Amount":"123",
"Installments":3,
"Country":"USA",
"Currency":"BRL",
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"Brand":"Master",
"Holder":"Teset card",
"CardNumber":"1234123412341232",
"ExpirationDate":"12/2030"
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Installments`|Number of Installments.|Number|2|Yes|
|`Payment.SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|No|
|`CreditCard.CardNumber`|Buyer's Card Number.|Text|16|Yes|
|`CreditCard.Holder`|Buyer's name printed on card.|Text|25|No|
|`CreditCard.ExpirationDate`|Expiry date printed on card.|Text|7|Yes|
|`CreditCard.SecurityCode`|Security code printed on back of card|Text|4|No|
|`CreditCard.Brand`|Card issuer.|Text|10|Yes|
### Response
```shell
HTTP Status 200
```
See the Annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Disabling a Recurrent Order
To disable a recurrent order, just do a Put as the example.
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/Deactivate</span></aside>
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}/Deactivate"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
### Response
```shell
HTTP Status 200
```
See the Annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Rehabilitating a Recurrent Order
To Rehabilitate a recurring order, just do a Put as the example.
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}/Reactivate</span></aside>
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}/Reactivate"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence identification number.|Text|50|Yes|
### Response
```shell
HTTP Status 200
```
See the Annex [HTTP Status Code](#http-status-code) to the list with all HTTP status codes possibly returned by the API.
## Renew easy
The use of this feature allows the automatic replacement of an expired card .
That way, when a transaction with recurrent markup is submitted to the API and Cielo identifies that the used card has been replaced, its authorization will be denied and the new card data will be returned as the example.
<aside class="notice"><strong>Warning:</strong> It is necessary to request enabling this feature in the register </aside>
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador Renova facil"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"RecurrentPayment":{
"AuthorizeNow":"true",
"EndDate":"2019-12-01",
"Interval":"SemiAnnual"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador Renova facil"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"RecurrentPayment":{
"AuthorizeNow":"true",
"EndDate":"2019-12-01",
"Interval":"SemiAnnual"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|6|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Customer.Status`|Buyer registration status in store (NEW / EXISTING) - Used by fraud analysis|Text|255|No|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Installments`|Number of Installments.|Number|2|Yes|
|`Payment.SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|No|
|`Payment.RecurrentPayment.EndDate`|End date for recurrence.|Text|10|No|
|`Payment.RecurrentPayment.Interval`|Recurrence interval.<br /><ul><li>Monthly (Default) </li><li>Bimonthly </li><li>Quarterly </li><li>SemiAnnual </li><li>Annual</li></ul>|Text|10|No|
|`Payment.RecurrentPayment.AuthorizeNow`|Boolean to know if the first recurrence is about to be Authorized or not.|Boolean|---|Yes|
|`CreditCard.CardNumber`|Buyer's Card Number.|Text|19|Yes|
|`CreditCard.Holder`|Buyer's name printed on card.|Text|25|No|
|`CreditCard.ExpirationDate`|Expiry date printed on card.|Text|7|Yes|
|`CreditCard.SecurityCode`|Security code printed on back of card.|Text|4|No|
|`CreditCard.Brand`|Card issuer.|Text|10|Yes|
### Response
```json
{
"MerchantOrderId": "2014113245231706",
"Customer": {
"Name": "Comprador Renova facil"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": 0,
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "123412******1231",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"Tid": "10447480685P4611AQ9B",
"ProofOfSale": "087001",
"SoftDescriptor": "123456789ABCD",
"Provider": "Cielo",
"Eci": "0",
"NewCard": {
"CardNumber": "40000000000000000",
"ExpirationDate": "10/2020",
"SaveCard": false,
"Brand": "Visa"
},
"VelocityAnalysis": {
"Id": "94f06657-c715-45d2-a563-63f7dbb19e08",
"ResultMessage": "Accept",
"Score": 0
},
"PaymentId": "94f06657-c715-45d2-a563-63f7dbb19e08",
"Type": "CreditCard",
"Amount": 1500,
"ReceivedDate": "2016-12-26 14:14:21",
"Currency": "BRL",
"Country": "BRA",
"ReturnCode": "KA",
"ReturnMessage": "Autorizacao negada",
"Status": 3,
"RecurrentPayment": {
"ReasonCode": 7,
"ReasonMessage": "Denied",
"EndDate": "2019-12-01",
"Interval": 6,
"AuthorizeNow": true
},
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquery.cieloecommerce.cielo.com.br/1/sales/94f06657-c715-45d2-a563-63f7dbb19e08"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014113245231706",
"Customer": {
"Name": "Comprador Renova facil"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": 0,
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "123412******1231",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"Tid": "10447480685P4611AQ9B",
"ProofOfSale": "087001",
"SoftDescriptor": "123456789ABCD",
"Provider": "Cielo",
"Eci": "0",
"NewCard": {
"CardNumber": "40000000000000000",
"ExpirationDate": "10/2020",
"SaveCard": false,
"Brand": "Visa"
},
"VelocityAnalysis": {
"Id": "94f06657-c715-45d2-a563-63f7dbb19e08",
"ResultMessage": "Accept",
"Score": 0
},
"PaymentId": "94f06657-c715-45d2-a563-63f7dbb19e08",
"Type": "CreditCard",
"Amount": 1500,
"ReceivedDate": "2016-12-26 14:14:21",
"Currency": "BRL",
"Country": "BRA",
"ReturnCode": "KA",
"ReturnMessage": "Autorizacao negada",
"Status": 3,
"RecurrentPayment": {
"ReasonCode": 7,
"ReasonMessage": "Denied",
"EndDate": "2019-12-01",
"Interval": 6,
"AuthorizeNow": true
},
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquery.cieloecommerce.cielo.com.br/1/sales/94f06657-c715-45d2-a563-63f7dbb19e08"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`RecurrentPaymentId`|Next recurrence Identifier field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`NextRecurrency`|Date of next recurrence.|Text|7|12/2030 (MM/YYYY)|
|`EndDate`|End date of recurrence.|Text|7|12/2030 (MM/YYYY)|
|`Interval`|Interval between recurrences.|Text|10|<ul><li>Monthly</li><li>Bimonthly </li><li>Quarterly </li><li>SemiAnnual </li><li>Annual</li></ul>|
|`AuthorizeNow`|Boolean to know if the first recurrence is about to be Authorized or not.|Boolean|---|true ou false|
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`NewCard.CardNumber`|New Buyer Card number.|Text|16|Yes|
|`NewCard.ExpirationDate`|new expiry date of the card.|Text|7|Yes|
|`NewCard.Brand`|Card issuer.|Text|10|Yes|
|`NewCard.SaveCard`|Identifies whether the card generated Cardtoken during the transaction|Boolean|---|Yes|
# Consulting Sales
## Consulting a sale
To consult a credit card sale, it is necessary to do a GET for the Payment feature as the example.
### Request
<aside class="request"><span class="method get">GET</span> <span class="endpoint">/1/sales/{PaymentId}</span></aside>
```shell
curl
--request GET "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`PaymentId`|Payment identification number.|Text|36|Yes|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Teste",
"Address": {}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "674532",
"AuthorizationCode": "123456",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Teste",
"Address": {}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "674532",
"AuthorizationCode": "123456",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`Status`|Transaction Status.|Byte|---|2|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Customer.Status`|Text|255|No|Buyer registration status in store (NEW / EXISTING)|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Provider`|Text|15|---|Defines behavior of the means of payment (see Annex)/NOT REQUIRED FOR CREDIT.|
|`Payment.Installments`|Number|2|Yes|Number of Installments.|
|`CreditCard.CardNumber`|Text|19|Yes|Buyer's Card Number.|
|`CreditCard.Holder`|Text|25|No|Buyer's name printed on card.|
|`CreditCard.ExpirationDate`|Text|7|Yes|Expiry date printed on card.|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`CreditCard.Brand`|Text|10|Yes|Card issuer (Visa / Master / Amex / Elo / Aura / JCB / Diners / Discover / Hipercard).|
## Consulting a sale by store identifier
It is not possible to directly query a payment by the identifier sent by the store (MerchantOrderId), but it is possible to get all PaymentIds associated with the identifier.
To check a sale by store identifier, you need to make a GET for the sales feature as the example.
### Request
<aside class="request"><span class="method get">GET</span> <span class="endpoint">/1/sales?merchantOrderId={merchantOrderId}</span></aside>
```shell
curls
--request GET " https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales?merchantOrderId={merchantOrderId}"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order Identifier Field at the Store.|Text|36|Yes|
### Response
```json
{
"Payment": [
{
"PaymentId": "5fb4d606-bb63-4423-a683-c966e15399e8",
"ReceveidDate": "2015-04-06T10:13:39.42"
},
{
"PaymentId": "6c1d45c3-a95f-49c1-a626-1e9373feecc2",
"ReceveidDate": "2014-12-19T20:23:28.847"
}
]
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Payment": [
{
"PaymentId": "5fb4d606-bb63-4423-a683-c966e15399e8",
"ReceveidDate": "2015-04-06T10:13:39.42"
},
{
"PaymentId": "6c1d45c3-a95f-49c1-a626-1e9373feecc2",
"ReceveidDate": "2014-12-19T20:23:28.847"
}
]
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
## Consulting a sale with Fraud Analysis
To consult a credit card sale with antifraud, it is necessary to do a GET for the Payment feature as the example.
### Request
<aside class="request"><span class="method get">GET</span> <span class="endpoint">/1/sales/{PaymentId}</span></aside>
```shell
curl
--request GET "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`PaymentId`|Payment identification number.|Text|36|Yes|
### Response
```json
{
"OrderId": "f381c0c4-2bf9-4de1-91e1-e9e1f11d0854",
"MerchantOrderId": "201411173454307",
"Customer": {
"Name": "Comprador Teste",
"Email": "compradorteste@live.com",
"Birthdate": "1991-01-02",
"Address": {
"Street": "Rua Júpter",
"Number": "174",
"Complement": "AP 201",
"ZipCode": "21241140",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "402400******2931",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "500000",
"Tid": "10069930692625A01001",
"AuthorizationCode": "123456",
"FraudAnalysis": {
"ReasonCode": 100,
"Score": 42,
"Status": "Accept",
"FactorCode": "B^D^R"
},
"PaymentId": "77df250a-93ce-46a3-a224-a894b78ecd80",
"Type": "CreditCard",
"Amount": 100,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Cielo",
"Credentials": {},
"ExtraDataCollection": [],
"ReasonCode": 0,
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"OrderId": "f381c0c4-2bf9-4de1-91e1-e9e1f11d0854",
"MerchantOrderId": "201411173454307",
"Customer": {
"Name": "Comprador Teste",
"Email": "compradorteste@live.com",
"Birthdate": "1991-01-02",
"Address": {
"Street": "Rua Júpter",
"Number": "174",
"Complement": "AP 201",
"ZipCode": "21241140",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "402400******2931",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "500000",
"Tid": "10069930692625A01001",
"AuthorizationCode": "123456",
"FraudAnalysis": {
"ReasonCode": 100,
"Score": 42,
"Status": "Accept",
"FactorCode": "B^D^R"
},
"PaymentId": "77df250a-93ce-46a3-a224-a894b78ecd80",
"Type": "CreditCard",
"Amount": 100,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Cielo",
"Credentials": {},
"ExtraDataCollection": [],
"ReasonCode": 0,
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`Id`|Identification of the Transaction in AntiFraud.|Text|300|Alphanumeric text|
|`Status`|Transaction Status.|Byte|---|See annexes|
|`FraudAnalysis.ReasonCode`|Analysis result.|Byte|---|Number:<br /><ul><li>100 - Successful operation.</li><li>101 - The order is missing one or more required fields. Possible action: See the fields that are missing on the AntiFraudResponse.MissingFieldCollection list. Resend the order with complete information.</li><li>102 - One or more order fields contain invalid data. Possible action: See the invalid fields on the AntiFraudResponse.InvalidFieldCollection list. Resend the order with the correct information.</li><li>150 General system failure. Possible action: Wait a few minutes and try resending the order.</li><li>151 - The order was received, but time-out occurred on the server. This error does not include time-out between the customer and the server. Possible action: Wait a few minutes and try resending the order.</li><li>152 The order was received, but time-out occurred. Possible action: Wait a few minutes and resend the order.</li><li>202 – Fraud Prevention declined the order because the card has expired. You can also receive this code if the expiry date does not match the date on file of the issuing bank. If the payment processor allows to issue credits to expired cards, CyberSource does not limit this functionality. Possible action: Request a card or other form of payment.</li><li>231 The account number is invalid. Possible action: Request a card or other form of payment.</li><li>234 - There is a problem with the merchant configuration. Possible action: Do not send the order. Contact Customer Support to correct the setup problem.</li><li>400 The fraud score goes beyond its limit. Possible action: Review customer's order.</li><li>480 The order has been marked for review by the Decision Manager.</li><li>481 - The order was rejected by the Decision Manager</li></ul>|
|`FraudAnalysis.FactorCode`|Combination of codes that indicate the order's score. The codes are concatenated using the ^ character.|Text|100|E.g.: B^D^R^Z<br /><ul><li>A - Excessive address change. Customer changed billing address two or more times in the last six months.</li><li>B - Card BIN or risk authorization. Risk factors are related to credit card BIN and/or card authorization checks.</li><li>C - High number of credit cards. The customer has used more than six credit card numbers in the last six months.</li><li>D - Impact of e-mail address. The customer uses a free email provider or the e-mail address is risky.</li><li>E - Positive list. The customer is on your positive list.</li><li>F - Negative list. The account number, address, e-mail address or IP address for this purpose appears on your negative list.</li><li>G - Inconsistencies of geolocation. The client e-mail domain, phone number, billing address, shipping address or IP address is suspect.</li><li>H - Excessive name changes. The customer has changed the name two or more times in the last six months.</li><li>I - Inconsistencies of internet. The IP address and e-mail domain are not consistent with the billing address.</li><li>N - Meaningless entry. Client name and address fields contain nonsense words or language.</li><li>O - Obscenities. Customer data contains obscene words.</li><li>P - Morphing identity. Multiple values of an identity element are linked to a value of a different identity element. For example, multiple phone numbers are linked to a single account number.</li><li>Q - Phone inconsistencies. Customer's telephone number is suspect.</li><li>R - Risky order. The transaction, the customer and the merchant show correlated high-risk information.</li><li>T - Time coverage. The customer is attempting a purchase outside of the expected time.</li><li>U - Unverifiable address. The billing or delivery address can not be verified.</li><li>V - Velocity. The account number was used many times in the last 15 minutes.</li><li>W - Marked as suspect. The billing or delivery address is similar to an address previously marked as suspicious.</li><li>Y - The address, city, state or country of the billing and delivery addresses do not correlate.</li><li>Z - Invalid value. Because the request contains an unexpected value, a default value has been replaced. Although the transaction can still be processed, do examine the order carefully for any anomalies.</li></ul>|
|`FraudAnalysis.Score`|Total score calculated for the order.|Number|---|Number|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric text|
## Consulting a Recurrence
To consult a credit card Recurrence, it is necessary to do a `GET` as shown in the example.
**The Recurrence Query brings data about the scheduling and transaction process that are repeated. They do not return data about transactions itself. To do this, a `GET` must be performed in the transaction (Available in" Consulting sales
### Request
<aside class="request"><span class="method get">GET</span> <span class="endpoint">/1/RecurrentPayment/{RecurrentPaymentId}</span></aside>
```shell
curl
--request GET "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/{RecurrentPaymentId}"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`RecurrentPaymentId`|Recurrence Identifier Field.|Text|36|Yes|
### Response
```json
{
"Customer": {
"Name": "Fulano da Silva"
},
"RecurrentPayment": {
"RecurrentPaymentId": "c30f5c78-fca2-459c-9f3c-9c4b41b09048",
"NextRecurrency": "2017-06-07",
"StartDate": "2017-04-07",
"EndDate": "2017-02-27",
"Interval": "Bimonthly",
"Amount": 15000,
"Country": "BRA",
"CreateDate": "2017-04-07T00:00:00",
"Currency": "BRL",
"CurrentRecurrencyTry": 1,
"Provider": "Simulado",
"RecurrencyDay": 7,
"SuccessfulRecurrences": 0,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/c30f5c78-fca2-459c-9f3c-9c4b41b09048"
}
],
"RecurrentTransactions": [
{
"PaymentId": "f70948a8-f1dd-4b93-a4ad-90428bcbdb84",
"PaymentNumber": 0,
"TryNumber": 1
}
],
"Status": 1
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Customer": {
"Name": "Fulano da Silva"
},
"RecurrentPayment": {
"RecurrentPaymentId": "c30f5c78-fca2-459c-9f3c-9c4b41b09048",
"NextRecurrency": "2017-06-07",
"StartDate": "2017-04-07",
"EndDate": "2017-02-27",
"Interval": "Bimonthly",
"Amount": 15000,
"Country": "BRA",
"CreateDate": "2017-04-07T00:00:00",
"Currency": "BRL",
"CurrentRecurrencyTry": 1,
"Provider": "Simulado",
"RecurrencyDay": 7,
"SuccessfulRecurrences": 0,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/c30f5c78-fca2-459c-9f3c-9c4b41b09048"
}
],
"RecurrentTransactions": [
{
"PaymentId": "f70948a8-f1dd-4b93-a4ad-90428bcbdb84",
"PaymentNumber": 0,
"TryNumber": 1
}
],
"Status": 1
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`RecurrentPaymentId`|Next recurrence Identifier field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`NextRecurrency`|Date of next recurrence.|Text|7|12/2030 (MM/YYYY)|
|`StartDate`|Start date of recurrence.|Text|7|12/2030 (MM/YYYY)|
|`EndDate`|End date of recurrence.|Text|7|12/2030 (MM/YYYY)|
|`Interval`|Interval between recurrences.|Text|10|<ul><li>Monthly</li><li>Bimonthly </li><li>Quarterly </li><li>SemiAnnual </li><li>Annual</li></ul>|
|`CurrentRecurrencyTry `|Indicates the number of attempts of the current recurrence|Number|1|1|
|`OrderNumber`|Order identification at the store|Text|50|2017051101|
|`Status`|Recurrent order status|Number|1|<br>*1* - Active <br>*2* - Finished <br>*3*- Deactivated by the Merchant <br> *4* - Disabled by number of retries <br> *5* - Disabled by expired credit card|
|`RecurrencyDay`|Recurrence day|Number|2|22|
|`SuccessfulRecurrences`|Successful amount of recurrence|Number|2|5|
|`RecurrentTransactions.RecurrentPaymentId`|Recurrence Id|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`RecurrentTransactions.TransactionId`|Payment ID of the transaction generated on recurrence|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`RecurrentTransactions.PaymentNumber`|Number of Recurrence. The first one is zero|Number|2|3|
|`RecurrentTransactions.TryNumber`|Number of current attempt at the specific recurrence|Number|2|1|
# Capturing a sale
The **Capture** is an exclusive step for Credit Card transactions.
When making a capture, the merchant confirms that the authorized value on the card may be charged by the financial institution issuing the card.
What the capture generates:
* It performs the card charge
* It includes the value of the sale on the buyer's invoice
* Only captured transactions are paid by Cielo to the merchant
<aside class="notice"><strong>Warning:</strong> Capture is a deadline process. Check in without Cielo registering what is the enabled limit for your affiliation. After this period, it is not possible to perform the transaction Capture</aside>
## Total capture
To capture a sale that uses a credit card, it is necessary to do a PUT for the Payment feature as the example.
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/sales/{PaymentId}/capture</span></aside>
```json
https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture
```
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`PaymentId`|Order Identifier Field.|Guid|36|Yes|
|`Amount`|Order Amount (to be sent in cents).|Number|15|No|
|`ServiceTaxAmount`|[See Annex](https://developercielo.github.io/Webservice-3.0/#anexos)|Number|15|No|
### Response
```json
{
"Status": 2,
"ReturnCode": "6",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Status": 2,
"ReturnCode": "6",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of acquirer.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of acquirer.|Text|512|Alphanumeric text|
## Partial Capture
The **partial Capture** is the act of capturing a value less than the authorized value. This capture model can occur only once per transaction.
**After capture, it is not possible to make additional captures in the same order.**
Just do a `POST` sending the value to be captured.
<aside class="notice"><strong>Warning:</strong> Partial capture available for credit transactions only</aside>
### Request - Partial Capture
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/sales/{paymentId}/capture?amount={Valor}</span></aside>
```json
https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{paymentId}/capture?amount={Valor}
```
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{paymentId}/capture?amount={Valor}"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`PaymentId`|Order Identifier Field.|Guid|36|Yes|
|`Amount`|Order Amount (to be sent in cents).|Number|15|No|
|`ServiceTaxAmount`|[See Annex](https://developercielo.github.io/Webservice-3.0/#anexos)|Number|15|No|
### Response
```json
{
"Status": 2,
"ReasonCode": 0,
"ReasonMessage": "Successful",
"ProviderReturnCode": "6",
"ProviderReturnMessage": "Operation Successful",
"ReturnCode": "6",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/8b1d43ee-a918-40d2-ba62-e5665e7ccbd3"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/8b1d43ee-a918-40d2-ba62-e5665e7ccbd3/void"
}
]
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Status": 2,
"ReasonCode": 0,
"ReasonMessage": "Successful",
"ProviderReturnCode": "6",
"ProviderReturnMessage": "Operation Successful",
"ReturnCode": "6",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/8b1d43ee-a918-40d2-ba62-e5665e7ccbd3"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/8b1d43ee-a918-40d2-ba62-e5665e7ccbd3/void"
}
]
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of acquirer.|Text|32|Alphanumeric texto|
|`ReturnMessage`|Return message of acquirer.|Text|512|Alphanumeric texto|
|`ProviderReturnCode`|Provider return code.|Text|32|Alphanumeric text|
|`ProviderReturnMessage`|Provider return message.|Text|512|Alphanumeric text|
<aside class="notice"><strong>Capture of Boarding fee</strong> To carry out the capture of *boarding fee*, just add the ServiveTaxAmount value to be captured</aside>
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/sales/{paymentId}/capture?amount={Valor}&serviceTaxAmount=xxx</span></aside>
### Response
```json
{
"Status": 2,
"ReasonCode": 0,
"ReasonMessage": "Successful",
"ProviderReturnCode": "0",
"ProviderReturnMessage": "Operation Successful",
"ReturnCode": "0",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/4d7be764-0e81-4446-b31e-7eb56bf2c9a8"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/4d7be764-0e81-4446-b31e-7eb56bf2c9a8/void"
}
]
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Status": 2,
"ReasonCode": 0,
"ReasonMessage": "Successful",
"ProviderReturnCode": "0",
"ProviderReturnMessage": "Operation Successful",
"ReturnCode": "0",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/4d7be764-0e81-4446-b31e-7eb56bf2c9a8"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/4d7be764-0e81-4446-b31e-7eb56bf2c9a8/void"
}
]
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of acquirer.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of acquirer.|Text|512|Alphanumeric text|
|`ProviderReturnCode`|Provider return code.|Text|32|Alphanumeric text|
|`ProviderReturnMessage`|Provider return message.|Text|512|Alphanumeric text|
## Capture Via Backoffice
It is possible to carry out both the total capture and the partial capture via The Backoffice Cielo.
Access our [**Tutorial**](https://developercielo.github.io/Tutorial//Backoffice-3.0) for more informations
# Canceling a sale
## Canceling a sale via API
Cancellation process via API is available only for credit and debit card.
Each means of payment suffer different impacts when a cancellation order (VOID) is executed.
|Means of payment|Description|Deadline|Cielo participation|
|---|---|---|---|
|Credit card|Cielo returns the value via bank credit|300 days after authorization|Yes|
|Debit card|Cancellation only in API. The return of the value is made by the merchant himself|300 days after authorization|No|
NOTE: Partial cancellations are only available for Credit Card.
## Total cancellation
To cancel a sale that uses a credit card, it is necessary to do a PUT for the Payment feature. Cancellation can be made via PaymentID or MerchantOrderId (order number).
<aside class="notice"><strong>Warning:</strong> Cancellation by MerchantOrderId always affects the newest transaction, i.e. if there are orders with duplicate order number, only the most current one will be canceled. The previous order can not be canceled by this method</aside>
### Request
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/sales/{PaymentId}/void?amount=xxx</span></aside>
or
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/sales/OrderId/{MerchantOrderId}/void?amount=xxx</span></aside>
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`PaymentId`|Order Identifier Field.|Guid|36|Yes|
|`Amount`|Order Amount (to be sent in cents).|Number|15|No|
### Response
```json
{
"Status": 10,
"ReturnCode": "9",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
]
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Status": 10,
"ReturnCode": "9",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
]
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of acquirer.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of acquirer.|Text|512|Alphanumeric text|
## Partial cancellation
The **partial cancellation** is the act of canceling a value less than the total authorized/captured value. This cancellation model can occur countless times, until the total value of the transaction is canceled.
Just do a `POST` sending the value to be canceled.
<aside class="notice"><strong>Warning:</strong> Partial cancellation available only for *CAPTURED* credit transactions</aside>
<aside class="notice"><strong>Warning:</strong> The return of the API adds up to the total of partial cancellations, that is, if 3 cancellations of $10.00 are made, the API will present in its return a total of $30.00 canceled</aside>
### Request - partial cancellation
<aside class="request"><span class="method put">PUT</span> <span class="endpoint">/1/sales/{PaymentId}/void?amount=XXX </span></aside>
```shell
curl
--request PUT "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void?amount=XXX"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`PaymentId`|Order Identifier Field.|Guid|36|Yes|
|`Amount`|Order Amount (to be sent in cents).|Number|15|No|
### Response
```json
{
"Status": 2,
"ReasonCode": 0,
"ReasonMessage": "Successful",
"ProviderReturnCode": "0",
"ProviderReturnMessage": "Operation Successful",
"ReturnCode": "0",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/4d7be764-0e81-4446-b31e-7eb56bf2c9a8"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/4d7be764-0e81-4446-b31e-7eb56bf2c9a8/void"
}
]
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"Status": 2,
"ReasonCode": 0,
"ReasonMessage": "Successful",
"ProviderReturnCode": "0",
"ProviderReturnMessage": "Operation Successful",
"ReturnCode": "0",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/4d7be764-0e81-4446-b31e-7eb56bf2c9a8"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/4d7be764-0e81-4446-b31e-7eb56bf2c9a8/void"
}
]
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of acquirer.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of acquirer.|Text|512|Alphanumeric text|
|`ProviderReturnCode`|Provider return code.|Text|32|Alphanumeric text|
|`ProviderReturnMessage`|Provider return message.|Text|512|Alphanumeric text|
<aside class="notice"><strong>Cancellation of Boarding Fee</strong> To cancel the *boarding fee*, just add the value of ServiveTaxAmount to be canceled</aside>
```
https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{paymentId}/void?amount={Valor}&serviceTaxAmount=xxx
```
## Cancellation via Backoffice
Cancellation via Backoffice is the only option to perform cancellation of bank slip and Online Debit transactions.
It is possible to carry out both the total cancellation and the partial cancellation via The Backoffice Cielo.
Effects on the means of payment
|Means of payment|Description|Deadline|Cielo participation|
|---|---|---|---|
|Bank slip|Cancellation only in API. The return of the value is made by the merchant himself|Defined by the merchant|No|
|Electronic Transfer|Cancellation only in API. The return of the value is made by the merchant himself|Defined by the merchant|No|
Access our [**Tutorial**](https://developercielo.github.io/Tutorial//Backoffice-3.0) for more informations
# Tokenization of cards
## What is Tokenization of Cards:
It is a platform that allows secure storage of sensitive credit card data. This data is transformed into an encrypted code called a “token”, which can be stored in a database. With the platform, the store will be able to offer features like "1-click buy" and "Retry transaction sending", always preserving the integrity and the confidentiality of the information.
## Creating a Tokenized Card
To save a card without authorizing it, just perform a post with the card data.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/card/</span></aside>
```json
{
"CustomerName": "Comprador Teste Cielo",
"CardNumber":"4532117080573700",
"Holder":"Comprador T Cielo",
"ExpirationDate":"12/2030",
"Brand":"Visa"
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/card/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"CustomerName": "Comprador Teste Cielo",
"CardNumber":"4532117080573700",
"Holder":"Comprador T Cielo",
"ExpirationDate":"12/2030",
"Brand":"Visa"
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`Name`|Text|255|Yes|Buyer's name.|
|`CardNumber`|Text|16|Yes|Buyer's Card Number.|
|`Holder`|Text|25|Yes|Buyer's name printed on card.|
|`ExpirationDate`|Text|7|Yes|Expiry date printed on card.|
|`Brand`|Text|10|Yes|Card issuer (Visa / Master / Amex / Elo / Aura / JCB / Diners / Discover).|
### Response
```json
{
"CardToken": "db62dc71-d07b-4745-9969-42697b988ccb",
"Links": {
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerydev.cieloecommerce.cielo.com.br/1/card/db62dc71-d07b-4745-9969-42697b988ccb"}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"CardToken": "db62dc71-d07b-4745-9969-42697b988ccb",
"Links": {
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerydev.cieloecommerce.cielo.com.br/1/card/db62dc71-d07b-4745-9969-42697b988ccb"}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`Cardtoken`|Card identification token.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
## Creating a Tokenized Card during an authorization
To save a card by creating its token, just send a sales creation standard request by sending SaveCard as "true". The response will return the card Token.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111701",
"Customer":{
"Name":"Comprador Teste",
"Email":"compradorteste@teste.com",
"Birthdate":"1991-01-02",
"Address":{
"Street":"Rua Teste",
"Number":"123",
"Complement":"AP 123",
"ZipCode":"12345987",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
},
"DeliveryAddress": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Currency":"BRL",
"Country":"BRA",
"ServiceTaxAmount":0,
"Installments":1,
"Interest":"ByMerchant",
"Capture":true,
"Authenticate":false,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"SaveCard":"true",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111701",
"Customer":{
"Name":"Comprador Teste",
"Identity":"11225468954",
"IdentityType":"CPF",
"Email":"compradorteste@teste.com",
"Birthdate":"1991-01-02",
"Address":{
"Street":"Rua Teste",
"Number":"123",
"Complement":"AP 123",
"ZipCode":"12345987",
"City":"Rio de Janeiro",
"State":"RJ",
"Country":"BRA"
},
"DeliveryAddress": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"ServiceTaxAmount":0,
"Installments":1,
"Interest":"ByMerchant",
"Capture":true,
"Authenticate":false,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardNumber":"4551870000000183",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"SaveCard":"true",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`MerchantId`|Guid|36|Yes|Store identifier in Cielo.|
|`MerchantKey`|Text|40|Yes|Public Key for Double Authentication in Cielo.|
|`RequestId`|Guid|36|No|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT.|
|`MerchantOrderId`|Text|50|Yes|Order ID number.|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Customer.Status`|Text|255|No|Buyer registration status in store (NEW / EXISTING)|
|`Customer.Identity`|Text|14|No|Customer's RG, CPF or CNPJ number.|
|`Customer.IdentityType`|Text|255|No|Type of buyer ID document (CFP/CNPJ).|
|`Customer.Email`|Text|255|No|Buyer's e-mail.|
|`Customer.Birthdate`|Date|10|No|Buyer's date of birth.|
|`Customer.Address.Street`|Text|255|No|Buyer's address.|
|`Customer.Address.Number`|Text|15|No|Buyer's address number.|
|`Customer.Address.Complement`|Text|50|No|Buyer's address complement.br|
|`Customer.Address.ZipCode`|Text|9|No|Buyer's address zip code.|
|`Customer.Address.City`|Text|50|No|Buyer's address city.|
|`Customer.Address.State`|Text|2|No|Buyer's address state.|
|`Customer.Address.Country`|Text|35|No|Buyer's address country.|
|`Customer.DeliveryAddress.Street`|Text|255|No|Buyer's address.|
|`Customer.Address.Number`|Text|15|No|Buyer's address number.|
|`Customer.DeliveryAddress.Complement`|Text|50|No|Buyer's address complement.|
|`Customer.DeliveryAddress.ZipCode`|Text|9|No|Buyer's address zip code.|
|`Customer.DeliveryAddress.City`|Text|50|No|Buyer's address city.|
|`Customer.DeliveryAddress.State`|Text|2|No|Buyer's address state.|
|`Customer.DeliveryAddress.Country`|Text|35|No|Buyer's address country.|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Currency`|Text|3|No|Currency in which payment will be made (BRL).|
|`Payment.Country`|Text|3|No|Country where payment will be made.|
|`Payment.Provider`|Text|15|---|Defines behavior of the means of payment (see Annex)/NOT REQUIRED FOR CREDIT.|
|`Payment.Installments`|Number|2|Yes|Number of Installments.|
|`Payment.Interest`|Text|10|No|Type of installment - Store (ByMerchant) or Card (ByIssuer).|
|`Payment.Capture`|Boolean|---|No (Default false)|Boolean that identifies that the authorization should be with automatic capture.|
|`Payment.Authenticate`|Boolean|---|No (Default false)|Defines whether the buyer will be directed to the Issuing bank for card authentication|
|`Payment.ServiceTaxAmount`|Number|15|No|[See Annex](https://developercielo.github.io/Webservice-3.0/#anexos)|
|`CreditCard.CardNumber`|Text|19|Yes|Buyer's Card Number.|
|`CreditCard.Holder`|Text|25|No|Buyer's name printed on card.|
|`CreditCard.ExpirationDate`|Text|7|Yes|Expiry date printed on card.|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`CreditCard.SaveCard`|Boolean|---|No (Default false)|Boolean that identifies whether the card will be saved to generate the CardToken.|
|`CreditCard.Brand`|Text|10|Yes|Card issuer (Visa / Master / Amex / Elo / Aura / JCB / Diners / Discover / Hipercard).|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Teste",
"Identity":"11225468954",
"IdentityType":"CPF",
"Email": "compradorteste@teste.com",
"Birthdate": "1991-01-02",
"Address": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
},
"DeliveryAddress": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": true,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": true,
"CardToken": "d37bf475-307d-47be-b50a-8dcc38c5056c",
"Brand": "Visa"
},
"ProofOfSale": "674532",
"Tid": "0305020554239",
"AuthorizationCode": "123456",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"CapturedAmount": 15700,
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 2,
"ReturnCode": "6",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Teste",
"Identity":"11225468954",
"IdentityType":"CPF",
"Email": "compradorteste@teste.com",
"Birthdate": "1991-01-02",
"Address": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
},
"DeliveryAddress": {
"Street": "Rua Teste",
"Number": "123",
"Complement": "AP 123",
"ZipCode": "12345987",
"City": "Rio de Janeiro",
"State": "RJ",
"Country": "BRA"
}
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": true,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": true,
"CardToken": "d37bf475-307d-47be-b50a-8dcc38c5056c"
"Brand": "Visa"
},
"ProofOfSale": "674532",
"Tid": "0305020554239",
"AuthorizationCode": "123456",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"CapturedAmount": 15700,
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 2,
"ReturnCode": "6",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
}
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Campo Identificador do Pedido.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric text|
|`Cardtoken`|Card identification token.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
## Creating a sale with Tokenized Card
To create a credit card sale with protected card token, it is necessary to do a POST for the Payment feature as the example.
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111706",
"Customer":{
"Name":"Comprador Teste"
},
"Payment":{
"Type":"CreditCard",
"Amount":100,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardToken":"6e1bf77a-b28b-4660-b14f-455e2a1c95e9",
"SecurityCode":"262",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111706",
"Customer":{
"Name":"Comprador Teste"
},
"Payment":{
"Type":"CreditCard",
"Amount":100,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"CardToken":"6e1bf77a-b28b-4660-b14f-455e2a1c95e9",
"SecurityCode":"262",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Customer.Status`|Buyer registration status in store (NEW / EXISTING) - Used by fraud analysis|Text|255|No|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Installments`|Number of Installments.|Number|2|Yes|
|`Payment.SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|No|
|`Payment.ReturnUrl`|URI to which the user will be redirected after payment ends|Text|1024|Yes when Authenticate = true|
|`CreditCard.CardToken`|Card identification token.|Guid|36|Yes|
|`CreditCard.SecurityCode`|Security code printed on back of card.|Text|4|No|
|`CreditCard.Brand`|Card issuer.|Text|10|Yes|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Teste"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"SaveCard": false,
"CardToken": "6e1bf77a-b28b-4660-b14f-455e2a1c95e9",
"Brand": "Visa"
},
"ProofOfSale": "5036294",
"Tid": "0310025036294",
"AuthorizationCode": "319285",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "c3ec8ec4-1ed5-4f8d-afc3-19b18e5962a8",
"Type": "CreditCard",
"Amount": 100,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Teste"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"SaveCard": false,
"CardToken": "6e1bf77a-b28b-4660-b14f-455e2a1c95e9",
"Brand": "Visa"
},
"ProofOfSale": "5036294",
"Tid": "0310025036294",
"AuthorizationCode": "319285",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "c3ec8ec4-1ed5-4f8d-afc3-19b18e5962a8",
"Type": "CreditCard",
"Amount": 100,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric texto|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric texto|
## Creating a sale with Tokenized Card in 1.5
To create a credit card sale with webservice 1.5 token, it is necessary to do a POST for the Payment feature as the example.
For use in Sandbox, it is possible to simulate authorized or denied transactions via test tokens:
|Status|Token|
|---|---|
|Authorized|6fb7a669aca457a9e43009b3d66baef8bdefb49aa85434a5adb906d3f920bfeA|
|Denied|6fb7a669aca457a9e43009b3d66baef8bdefb49aa85434a5adb906d3f920bfeB|
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111706",
"Customer":{
"Name":"Comprador token 1.5"
},
"Payment":{
"Type":"CreditCard",
"Amount":100,
"Installments":1,
"CreditCard":{
"CardToken":"6fb7a669aca457a9e43009b3d66baef8bdefb49aa85434a5adb906d3f920bfeA",
"Brand":"Visa"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111706",
"Customer":{
"Name":"Comprador token 1.5"
},
"Payment":{
"Type":"CreditCard",
"Amount":100,
"Installments":1,
"CreditCard":{
"CardToken":"6fb7a669aca457a9e43009b3d66baef8bdefb49aa85434a5adb906d3f920bfeA",
"Brand":"Visa"
}
}
}
--verbose
```
|Property|Description|Type|Size|Required|
|---|---|---|---|---|
|`MerchantId`|Store identifier in API Cielo eCommerce.|Guid|36|Yes|
|`MerchantKey`|Public Key for Double Authentication in API Cielo eCommerce.|Text|40|Yes|
|`RequestId`|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT|Guid|36|No|
|`MerchantOrderId`|Order ID number.|Text|50|Yes|
|`Customer.Name`|Buyer's name.|Text|255|No|
|`Customer.Status`|Buyer registration status in store (NEW / EXISTING) - Used by fraud analysis|Text|255|No|
|`Payment.Type`|Means of Payment Type.|Text|100|Yes|
|`Payment.Amount`|Order Amount (to be sent in cents).|Number|15|Yes|
|`Payment.Installments`|Number of Installments.|Number|2|Yes|
|`CreditCard.CardToken`|Card identification token.|Guid|300|Yes|
|`CreditCard.Brand`|Card issuer.|Text|10|Yes|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador token 1.5"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": 0,
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"SaveCard": false,
"CardToken": "6fb7a669aca457a9e43009b3d66baef8bdefb49aa85434a5adb906d3f920bfeA",
"Brand": "Visa"
},
"Tid": "0307050140148",
"ProofOfSale": "140148",
"AuthorizationCode": "045189",
"Provider": "Simulado",
"PaymentId": "8c14cdcf-d5a9-46b0-b040-c0d054cd8f76",
"Type": "CreditCard",
"Amount": 100,
"ReceivedDate": "2017-03-07 17:01:40",
"Currency": "BRL",
"Country": "BRA",
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/8c14cdcf-d5a9-46b0-b040-c0d054cd8f76"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/8c14cdcf-d5a9-46b0-b040-c0d054cd8f76/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/8c14cdcf-d5a9-46b0-b040-c0d054cd8f76/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador token 1.5"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": 0,
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"SaveCard": false,
"CardToken": "6fb7a669aca457a9e43009b3d66baef8bdefb49aa85434a5adb906d3f920bfeA",
"Brand": "Visa"
},
"Tid": "0307050140148",
"ProofOfSale": "140148",
"AuthorizationCode": "045189",
"Provider": "Simulado",
"PaymentId": "8c14cdcf-d5a9-46b0-b040-c0d054cd8f76",
"Type": "CreditCard",
"Amount": 100,
"ReceivedDate": "2017-03-07 17:01:40",
"Currency": "BRL",
"Country": "BRA",
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Status": 1,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/8c14cdcf-d5a9-46b0-b040-c0d054cd8f76"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/8c14cdcf-d5a9-46b0-b040-c0d054cd8f76/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/8c14cdcf-d5a9-46b0-b040-c0d054cd8f76/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric text|
# Wallet
## What are Wallets
They are repositories of cards and payment data for online consumers. The digital wallets allow a consumer to register their payment data, thus streamlining the purchase process in authorized stores in their purchases for having only one registration.
To use wallets in the API Cielo eCommerce, the merchant must have the wallets integrated in their checkout. For more information, we suggest that you contact the technical department of the wallet that you wish to implement.
API Cielo eCommerce supports two payment wallets: VisaCheckout and Masterpass.
<aside class="notice"><strong>Warning:</strong> When the “Wallet” node is sent in the request, the “CreditCard” node becomes optional.</aside>
<aside class="notice"><strong>Warning:</strong> For debit card, when the “Wallet” node is sent in the request, the “DebitCard” node will be needed containing the “ReturnUrl”.</aside>
<aside class="notice"><strong>Warning:</strong> For Visa Chekcout, the Wallet node can be sent only with the "Type", thus marking the transaction as being from wallet. In this context, the credit card must be sent. </aside>
## How to perform transaction with VisaCheckout
It is possible to carry out a transaction with VisaCheckout in two ways:
1. Without sending card data
2. Sending card data
### Request - Without Card data
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111703",
"Customer":{
"Name":"Comprador Teste"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"SecurityCode":"123"
},
"Wallet":{
"Type":"VisaCheckout",
"WalletKey":"1140814777695873901"
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111703",
"Customer":{
"Name":"Comprador Teste"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"CreditCard":{
"SecurityCode":"123",
},
"Wallet":{
"Type":"VisaCheckout",
"WalletKey":"1140814777695873901"
}
}
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`MerchantId`|Guid|36|Yes|Store identifier in Cielo.|
|`MerchantKey`|Text|40|Yes|Public Key for Double Authentication in Cielo.|
|`RequestId`|Guid|36|No|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT.|
|`MerchantOrderId`|Text|50|Yes|Order ID number.|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Customer.Status`|Text|255|No|Buyer registration status in store (NEW / EXISTING)|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Installments`|Number|2|Yes|Number of Installments.|
|`Payment.ReturnUrl`|Text|1024|---|Required for debit card|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`Wallet.Type`|Text|255|Yes|indicates the wallet type: "VisaCheckout" or "Masterpass"|
|`Wallet.Walletkey`|Text|255|---|Cryptographic key sent by VisaCheckout. Required if TYPE = "Visa Checkout"|
### Response
```json
{
"MerchantOrderId": "2014111708",
"Customer": {
"Name": "comprador VisaCheckout"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": 0,
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"SaveCard": false,
"Brand": "Undefined"
},
"Tid": "0915052340115",
"Provider": "Simulado",
"Wallet": {
"Type": "VisaCheckout",
"WalletKey": "1140814777695873901",
"Eci": 0
},
"PaymentId": "efdb3338-9c8f-445a-8836-2cc93d8beacf",
"Type": "CreditCard",
"Amount": 15700,
"ReceivedDate": "2016-09-15 17:23:39",
"Currency": "BRL",
"Country": "BRA",
"ReturnCode": "77",
"ReturnMessage": "Card Canceled",
"Status": 3,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/efdb3338-9c8f-445a-8836-2cc93d8beacf"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111708",
"Customer": {
"Name": "comprador VisaCheckout"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": 0,
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"SaveCard": false,
"Brand": "Undefined"
},
"Tid": "0915052340115",
"Provider": "Simulado",
"Wallet": {
"Type": "VisaCheckout",
"WalletKey": "1140814777695873901",
"Eci": 0
},
"PaymentId": "efdb3338-9c8f-445a-8836-2cc93d8beacf",
"Type": "CreditCard",
"Amount": 15700,
"ReceivedDate": "2016-09-15 17:23:39",
"Currency": "BRL",
"Country": "BRA",
"ReturnCode": "77",
"ReturnMessage": "Card Canceled",
"Status": 3,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/efdb3338-9c8f-445a-8836-2cc93d8beacf"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
|`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric text|
|`Type`|indicates the wallet type: "VisaCheckout" or "Masterpass"|Text|255|Yes|
|`Walletkey`|Cryptographic key sent by VisaCheckout|Text|255|---|
### Request - With Card data
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111703",
"Customer":{
"Name":"Comprador Teste"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"Wallet":{
"Type":"VisaCheckout"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"Brand":"Visa"
},
},
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111703",
"Customer":{
"Name":"Comprador Teste"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"Wallet":{
"Type":"VisaCheckout"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"Brand":"Visa"
},
},
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`MerchantId`|Guid|36|Yes|Store identifier in Cielo.|
|`MerchantKey`|Text|40|Yes|Public Key for Double Authentication in Cielo.|
|`RequestId`|Guid|36|No|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT.|
|`MerchantOrderId`|Text|50|Yes|Order ID number.|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Customer.Status`|Text|255|No|Buyer registration status in store (NEW / EXISTING)|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Installments`|Number|2|Yes|Number of Installments.|
|`Payment.ReturnUrl`|Text|1024|---|Required for debit card|
|`CreditCard.CardNumber`|Text|19|Yes|Buyer's Card Number.|
|`CreditCard.Holder`|Text|25|No|Buyer's name printed on card.|
|`CreditCard.ExpirationDate`|Text|7|Yes|Expiry date printed on card.|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`CreditCard.Brand`|Text|10|Yes|Card issuer (Visa / Master / Amex / Elo / Aura / JCB / Diners / Discover / Hipercard).|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`Wallet.Type`|Text|255|Yes|indicates the wallet type: "VisaCheckout" or "Masterpass"|
### Response
```json
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Visa Checkout"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "674532",
"Tid": "0305023644309",
"AuthorizationCode": "123456",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111706",
"Customer": {
"Name": "Comprador Visa Checkout"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"CreditCard": {
"CardNumber": "455187******0183",
"Holder": "Teste Holder",
"ExpirationDate": "12/2030",
"SaveCard": false,
"Brand": "Visa"
},
"ProofOfSale": "674532",
"Tid": "0305023644309",
"AuthorizationCode": "123456",
"PaymentId": "24bc8366-fc31-4d6c-8555-17049a836a07",
"Type": "CreditCard",
"Amount": 15700,
"Currency": "BRL",
"Country": "BRA",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/{PaymentId}/void"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
|`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric text|
|`Type`|indicates the wallet type: "VisaCheckout" or "Masterpass"|Text|255|Yes|
## How to perform transaction with MasterPass
To use Masterpass it is necessary to contact directly with the Mastercard site: https://masterpass.com/pt-br/ e solicitar as credenciais.
More information and complete integration, you can find in the link: https://developer.mastercard.com/product/masterpass “
### Request
<aside class="request"><span class="method post">POST</span> <span class="endpoint">/1/sales/</span></aside>
```json
{
"MerchantOrderId":"2014111708",
"Customer":{
"Name":"Comprador MasterPass"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"CreditCard":{
"CardNumber": "4532117080573703",
"Brand": "Visa",
"SecurityCode":"023"
},
"Wallet":{
"Type":"MasterPass",
"AdditionalData":{
"CaptureCode": "103"
}
}
}
}
```
```shell
curl
--request POST "https://apisandbox.cieloecommerce.cielo.com.br/1/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId":"2014111708",
"Customer":{
"Name":"Comprador MasterPass"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"CreditCard":{
"CardNumber": "4532117080573703",
"Brand": "Visa",
"SecurityCode":"023"
},
"Wallet":{
"Type":"MasterPass",
"AdditionalData":{
"CaptureCode": "103"
}
}
}
}
--verbose
```
|Property|Type|Size|Required|Description|
|---|---|---|---|---|
|`MerchantId`|Guid|36|Yes|Store identifier in Cielo.|
|`MerchantKey`|Text|40|Yes|Public Key for Double Authentication in Cielo.|
|`RequestId`|Guid|36|No|Request Identifier, used when the merchant uses different servers for each GET/POST/PUT.|
|`MerchantOrderId`|Text|50|Yes|Order ID number.|
|`Customer.Name`|Text|255|No|Buyer's name.|
|`Customer.Status`|Text|255|No|Buyer registration status in store (NEW / EXISTING)|
|`Payment.Type`|Text|100|Yes|Means of Payment Type.|
|`Payment.Amount`|Number|15|Yes|Order Amount (to be sent in cents).|
|`Payment.Installments`|Number|2|Yes|Number of Installments.|
|`CreditCard.CardNumber.`|Text|19|Yes|Buyer's Card Number|
|`CreditCard.SecurityCode`|Text|4|No|Security code printed on back of card - See Annex.|
|`Wallet.Type`|Text|255|Yes|indicates the wallet type: "VisaCheckout" or "Masterpass"|
|`Wallet.AdditionalData`|---|---|---|Instance for extra data reported by MasterPass. Required only if TYPE = "MasterPass"|
|`Wallet.capturecode`|Text|255|Yes|Code reported by MasterPass to the merchant|
### Response
```json
{
"MerchantOrderId": "2014111708",
"Customer": {
"Name": "comprador Masterpass"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": 0,
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "453211******3703",
"Holder": "Teste Holder",
"ExpirationDate": "12/2016",
"SaveCard": false,
"Brand": "Visa"
},
"Tid": "0915052536103",
"Provider": "Simulado",
"Wallet": {
"Type": "Masterpass",
"Eci": 0,
"AdditionalData": {
"CaptureCode": "103"
}
},
"PaymentId": "689da793-fc99-4900-89f1-9e7fdaa06ef8",
"Type": "CreditCard",
"Amount": 15700,
"ReceivedDate": "2016-09-15 17:25:35",
"Currency": "BRL",
"Country": "BRA",
"ReturnCode": "57",
"ReturnMessage": "Card Expired",
"Status": 3,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/689da793-fc99-4900-89f1-9e7fdaa06ef8"
}
]
}
}
```
```shell
--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
"MerchantOrderId": "2014111708",
"Customer": {
"Name": "comprador Masterpass"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": 0,
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "453211******3703",
"Holder": "Teste Holder",
"ExpirationDate": "12/2016",
"SaveCard": false,
"Brand": "Visa"
},
"Tid": "0915052536103",
"Provider": "Simulado",
"Wallet": {
"Type": "Masterpass",
"Eci": 0,
"AdditionalData": {
"CaptureCode": "103"
}
},
"PaymentId": "689da793-fc99-4900-89f1-9e7fdaa06ef8",
"Type": "CreditCard",
"Amount": 15700,
"ReceivedDate": "2016-09-15 17:25:35",
"Currency": "BRL",
"Country": "BRA",
"ReturnCode": "57",
"ReturnMessage": "Card Expired",
"Status": 3,
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/689da793-fc99-4900-89f1-9e7fdaa06ef8"
}
]
}
}
```
|Property|Description|Type|Size|Format|
|---|---|---|---|---|
|`ProofOfSale`|Authorization number, identical to NSU.|Text|6|Alphanumeric text|
|`Tid`|Transaction Id on the acquirer.|Text|20|Alphanumeric text|
|`AuthorizationCode`|Authorization code.|Text|6|Alphanumeric text|
|`SoftDescriptor`|Text that will be printed on the carrier's bank invoice - Available only for VISA/MASTER - does not allow special characters|Text|13|Alphanumeric text|
|`PaymentId`|Order Identifier Field.|Guid|36|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|
|`ECI`|Eletronic Commerce Indicator. Represents how secure a transaction is.|Text|2|Examples: 7|
|`Status`|Transaction Status.|Byte|---|2|
|`ReturnCode`|Return code of Acquiring.|Text|32|Alphanumeric text|
|`ReturnMessage`|Return message of Acquiring.|Text|512|Alphanumeric text|
|`Type`|indicates the wallet type: "VisaCheckout" or "Masterpass"|Text|255|Yes|
|`Capturecode`|Code reported by MasterPass to the merchant|Text|255|Yes|
# API codes
## About codes
API Cielo e-commerce has 4 types of returned codes that represent different moments of the transaction.
Below we explain them in the order in which they can occur:
|Code|Description|
|---|---|
|**HTTP Status Code**|They are standard HTTP codes. It report if the information sent to the API is **actually being successful in reaching our ENDPOINTs**. If values other than 200 or 201 are appearing, there is some impediment with the comunication with the API<br> *Returned at time of API request*|
|**API Errors**|These codes are responses to **content validation of sent data**. If they are appearing, our API calls have been identified and are being validated. If this code is appearing, the request contains errors (e.g. size/conditions/registration errors) that prevent the creation of the transaction<br>*Returned at time of API request*|
|**Status**|After the transaction is created, these codes will be returned, informing the transaction status at that moment (e.g. `Authorized` >` Captured` > `Canceled`)<br>*Returned in the `Status` field *|
|**Sales Return**|Formed by a **Return code** and a **message**, these codes indicate the **reason** of a given `Status` within a transaction. They indicate, for example, whether a transaction with denied `status` was not authorized because of a negative balance at the issuing bank. <br>*Returned in the `ReturnCode` and` ReturnMessage` fields*<br> *They occur only in Credit and Debit cards*|
**NOTE**: In the old **Webservice 1.5 Cielo**, the `ReturnCode` was considered as *Transaction Status*. In the **API CIELO ECOMMERCE**, the `Status` field has its own codes, thus, the **field to be considered as the basis for identifying the status of a transaction**
## HTTP Status Code
|HTTP Status Code|Description|
|---|---|
|200|OK|
|400|Bad Request|
|404|Resource Not Found|
|500|Internal Server Error|
## Status
|Code|Status|Means of payment|Description|
|---|---|---|---|
|0|NotFinished|ALL|Waiting for status update|
|1|Authorized|ALL|Payment apt to be captured or defined as paid|
|2|PaymentConfirmed|ALL|Confirmed and finalized payment|
|3|Denied|CC + CD + TF|Payment denied by Authorizer|
|10|Voided|ALL|Canceled payment|
|11|Refunded|CC + CD|Payment canceled after 11:59 pm on the authorization day|
|12|Pending|ALL|Waiting for financial institution status|
|13|Aborted|ALL|Payment canceled due to processing failure|
|20|Scheduled|CC|Scheduled recurrence|
-
|Means of payment|Description|
|---|---|
|**ALL**|All|
|**CC**|Credit Card|
|**CD**|Debit Card|
|**TF**|Electronic Transfer|
|**BOL**|Bank slip|
## API Error Codes
Codes returned in case of error, identifying the reason for the error and its respective messages.
|Code|Message|Description|
|---|---|---|
|0|Internal error|Sent data exceeds field size|
|100|RequestId is required|Sent field is empty or invalid|
|101|MerchantId is required|Sent field is empty or invalid|
|102|Payment Type is required|Sent field is empty or invalid|
|103|Payment Type can only contain letters|Special characters not allowed|
|104|Customer Identity is required|Sent field is empty or invalid|
|105|Customer Name is required|Sent field is empty or invalid|
|106|Transaction ID is required|Sent field is empty or invalid|
|107|OrderId is invalid or does not exists|Sent field exceeds size or contains special characters|
|108|Amount must be greater or equal to zero|Transaction value must be greater than "0"|
|109|Payment Currency is required|Sent field is empty or invalid|
|110|Invalid Payment Currency|Sent field is empty or invalid|
|111|Payment Country is required|Sent field is empty or invalid|
|112|Invalid Payment Country|Sent field is empty or invalid|
|113|Invalid Payment Code|Sent field is empty or invalid|
|114|The provided MerchantId is not in correct format|The sent MerchantId is not a GUID|
|115|The provided MerchantId was not found|MerchantID does not exist or belongs to another environment (e.g. Sandbox)|
|116|The provided MerchantId is blocked|Locked store, contact Cielo support|
|117|Credit Card Holder is required|Sent field is empty or invalid|
|118|Credit Card Number is required|Sent field is empty or invalid|
|119|At least one Payment is required|"Payment" node not sent|
|120|Request IP not allowed. Check your IP White List|IP blocked for security reasons|
|121|Customer is required|"Customer" node not sent|
|122|MerchantOrderId is required|Sent field is empty or invalid|
|123|Installments must be greater or equal to one|Number of installments must be greater than 1|
|124|Credit Card is Required|Sent field is empty or invalid|
|125|Credit Card Expiration Date is required|Sent field is empty or invalid|
|126|Credit Card Expiration Date is invalid|Sent field is empty or invalid|
|127|You must provide CreditCard Number|Credit card number is required|
|128|Card Number length exceeded|Card number greater than 16 digits|
|129|Affiliation not found|Payment means not linked to store or invalid Provider|
|130|Could not get Credit Card|---|
|131|MerchantKey is required|Sent field is empty or invalid|
|132|MerchantKey is invalid|Sent Merchantkey is not a valid one|
|133|Provider is not supported for this Payment Type|Sent Provider does not exist|
|134|FingerPrint length exceeded|Sent data exceeds field size|
|135|MerchantDefinedFieldValue length exceeded|Sent data exceeds field size|
|136|ItemDataName length exceeded|Sent data exceeds field size|
|137|ItemDataSKU length exceeded|Sent data exceeds field size|
|138|PassengerDataName length exceeded|Sent data exceeds field size|
|139|PassengerDataStatus length exceeded|Sent data exceeds field size|
|140|PassengerDataEmail length exceeded|Sent data exceeds field size|
|141|PassengerDataPhone length exceeded|Sent data exceeds field size|
|142|TravelDataRoute length exceeded|Sent data exceeds field size|
|143|TravelDataJourneyType length exceeded|Sent data exceeds field size|
|144|TravelLegDataDestination length exceeded|Sent data exceeds field size|
|145|TravelLegDataOrigin length exceeded|Sent data exceeds field size|
|146|SecurityCode length exceeded|Sent data exceeds field size|
|147|Address Street length exceeded|Sent data exceeds field size|
|148|Address Number length exceeded|Sent data exceeds field size|
|149|Address Complement length exceeded|Sent data exceeds field size|
|150|Address ZipCode length exceeded|Sent data exceeds field size|
|151|Address City length exceeded|Sent data exceeds field size|
|152|Address State length exceeded|Sent data exceeds field size|
|153|Address Country length exceeded|Sent data exceeds field size|
|154|Address District length exceeded|Sent data exceeds field size|
|155|Customer Name length exceeded|Sent data exceeds field size|
|156|Customer Identity length exceeded|Sent data exceeds field size|
|157|Customer IdentityType length exceeded|Sent data exceeds field size|
|158|Customer Email length exceeded|Sent data exceeds field size|
|159|ExtraData Name length exceeded|Sent data exceeds field size|
|160|ExtraData Value length exceeded|Sent data exceeds field size|
|161|Boleto Instructions length exceeded|Sent data exceeds field size|
|162|Boleto Demostrative length exceeded|Sent data exceeds field size|
|163|Return Url is required|Return URL is not valid - No pagination or extensions are accepted (e.g. .PHP) in the return URL|
|166|AuthorizeNow is required|---|
|167|Antifraud not configured|Antifraud not linked to the merchant's registry|
|168|Recurrent Payment not found|Recurrence not found|
|169|Recurrent Payment is not active|Recurrence is not active. Paralyzed execution|
|170|Protected Card not configured|Protected card not linked to merchant's registry|
|171|Affiliation data not sent|Order processing failed - Contact Cielo support|
|172|Credential Code is required|Failed to validate the sent credentials|
|173|Payment method is not enabled|Means of payment not linked to the merchant's registry|
|174|Card Number is required|Sent field is empty or invalid|
|175|EAN is required|Sent field is empty or invalid|
|176|Payment Currency is not supported|Sent field is empty or invalid|
|177|Card Number is invalid|Sent field is empty or invalid|
|178|EAN is invalid|Sent field is empty or invalid|
|179|The max number of installments allowed for recurring payment is 1|Sent field is empty or invalid|
|180|The provided Card PaymentToken was not found|Protected Card Token not found|
|181|The MerchantIdJustClick is not configured|Protected Card Token locked|
|182|Brand is required|Card issuer not sent|
|183|Invalid customer bithdate|Invalid or future date of birth|
|184|Request could not be empty|Failure of the request format. Check the sent code|
|185|Brand is not supported by selected provider|Card issuer not supported by API Cielo|
|186|The selected provider does not support the options provided (Capture, Authenticate, Recurrent or Installments)|Payment means does not support the sent command|
|187|ExtraData Collection contains one or more duplicated names|---|
|188|Avs with CPF invalid|---|
|189|Avs with length of street exceeded|Sent data exceeds field size|
|190|Avs with length of number exceeded|Sent data exceeds field size|
|190|Avs with length of complement exceeded|Sent data exceeds field size|
|191|Avs with length of district exceeded|Sent data exceeds field size|
|192|Avs with zip code invalid|Sent postal code is invalid|
|193|Split Amount must be greater than zero|Value for SPLIT realization must be greater than 0|
|194|Split Establishment is Required|SPLIT not enabled for store registration|
|195|The PlataformId is required|Platforms validated not sent|
|196|DeliveryAddress is required|Required field not sent|
|197|Street is required|Required field not sent|
|198|Number is required|Required field not sent|
|199|ZipCode is required|Required field not sent|
|200|City is required|Required field not sent|
|201|State is required|Required field not sent|
|202|District is required|Required field not sent|
|203|Cart item Name is required|Required field not sent|
|204|Cart item Quantity is required|Required field not sent|
|205|Cart item type is required|Required field not sent|
|206|Cart item name length exceeded|Sent data exceeds field size|
|207|Cart item description length exceeded|Sent data exceeds field size|
|208|Cart item sku length exceeded|Sent data exceeds field size|
|209|Shipping addressee sku length exceeded|Sent data exceeds field size|
|210|Shipping data cannot be null|Required field not sent|
|211|WalletKey is invalid|Invalid Visa Checkout data|
|212|Merchant Wallet Configuration not found|Sent Wallet data is not valid|
|213|Credit Card Number is invalid|Sent credit card is invalid|
|214|Credit Card Holder Must Have Only Letters|Card carrier must not contain special characters|
|215|Agency is required in Boleto Credential|Required field not sent|
|216|Customer IP address is invalid|IP blocked for security reasons|
|300|MerchantId was not found|---|
|301|Request IP is not allowed|---|
|302|Sent MerchantOrderId is duplicated|---|
|303|Sent OrderId does not exist|---|
|304|Customer Identity is required|---|
|306|Merchant is blocked|---|
|307|Transaction not found|Transaction not found or does not exist in the environment.|
|308|Transaction not available to capture|Transaction can not be captured - Contact Cielo support|
|309|Transaction not available to void|Transaction can not be canceled - Contact Cielo support|
|310|Payment method doest not support this operation|Sent command not supported by payment means|
|311|Refund is not enabled for this merchant|Cancellation after 24 hours not released to the merchant|
|312|Transaction not available to refund|Transaction does not allow cancellation after 24 hours|
|313|Recurrent Payment not found|Recurrent transaction not found or not available in the environment|
|314|Invalid Integration|---|
|315|Cannot change NextRecurrency with pending payment|---|
|316|Cannot set NextRecurrency to past date|It is not allowed to change the recurrence date to a past date|
|317|Invalid Recurrency Day|---|
|318|No transaction found|---|
|319|Smart recurrency is not enabled|Recurrence not linked to the merchant's registration|
|320|Can not Update Affiliation Because this Recurrency not Affiliation saved|---|
|321|Can not set EndDate to before next recurrency.|---|
|322|Zero Dollar Auth is not enabled|Zero Dollar not linked to the merchant's registration|
|323|Bin Query is not enabled|Bins query not linked to the merchant's registration|
## Sales Return Codes
|Response Code|Definition|Meaning|Action|Allows Retry|
|---|---|---|---|---|
|00|Successfully authorized transaction.|Successfully authorized transaction.|Successfully authorized transaction.|No|
|000|Successfully authorized transaction.|Successfully authorized transaction.|Successfully authorized transaction.|No|
|01|Unauthorized transaction. Referred transaction.|Unauthorized transaction. Referred (suspected fraud) by the issuing bank.|Unauthorized transaction. Contact your issuing bank.|No|
|02|Unauthorized transaction. Referred transaction.|Unauthorized transaction. Referred (suspected fraud) by the issuing bank.|Unauthorized transaction. Contact your issuing bank.|No|
|03|Transaction not allowed. Error in registering the establishment code in the TEF configuration file|Transaction not allowed. Invalid establishment. Contact Cielo.|Could not process transaction. Contact the Virtual Store.|No|
|04|Unauthorized transaction. Card blocked by issuing bank.|Unauthorized transaction. Card blocked by issuing bank.|Unauthorized transaction. Contact your issuing bank.|No|
|05|Unauthorized transaction. Defaulting card (Do not honor).|Unauthorized transaction. Could not process transaction. Issue related to security, defaults or carrier limit.|Unauthorized transaction. Contact your issuing bank.|Only 4 times in 16 days.|
|06|Unauthorized transaction. Card canceled.|Unauthorized transaction. Could not process transaction. Card permanently canceled by issuing bank.|Could not process transaction. Contact your issuing bank.|No|
|07|Transaction denied. Hold special condition card|Transaction not authorized by issuing bank rules.|Unauthorized transaction. Contact your issuing bank|No|
|08|Unauthorized transaction. Invalid security code.|Unauthorized transaction. Invalid security code. Orient the carrier to correct the data and try again.|Unauthorized transaction. Incorrect data. Review the data and enter again.|No|
|11|Successfully authorized transaction for card issued abroad|Successfully authorized transaction.|Successfully authorized transaction.|No|
|12|Invalid transaction, card error.|Could not process transaction. Ask the carrier to check the card data and try again.|Could not process transaction. Review the reported data and try again. If the error persists, contact your issuing bank.|No|
|13|Transaction not allowed. Invalid transaction value.|Transaction not allowed. Invalid value. Ask the carrier to review the data and try again. If the error persists, contact Cielo.|Unauthorized transaction. Invalid value. Redo the transaction confirming the reported data. If the error persists, contact the virtual store.|No|
|14|Unauthorized transaction. Invalid Card|Unauthorized transaction. Invalid Card. It may be card locking at the issuing bank, incorrect data or card testing attempts. Use the Lhum Algorithm (Mod 10) to avoid unauthorized transactions for this reason. See www.cielo.com.br/desenvolvedores to deploy the Lhum Algorithm.|Could not process transaction. Review the reported data and try again. If the error persists, contact your issuing bank.|No|
|15|Issuing bank unavailable or non-existent.|Unauthorized transaction. Issuing bank unavailable.|Could not process transaction. Contact your issuing bank.|No|
|19|Redo the transaction or try again later.|Could not process transaction. Redo the transaction or try again later. If the error persists, contact Cielo.|Could not process transaction. Redo the transaction or try again later. If the error persists, contact the virtual store.|Only 4 times in 16 days.|
|21|Cancellation not done. Non-localized transaction.|Cancellation was not processed. If the error persists, contact Cielo.|Cancellation was not processed. Try again later. If the error persists, contact the virtual store.|No|
|22|Invalid installment. Invalid number of installments.|Could not process transaction. Invalid number of installments. If the error persists, contact Cielo.|Could not process transaction. Invalid value. Redo the transaction confirming the reported data. If the error persists, contact the virtual store.|No|
|23|Unauthorized transaction. Invalid installment value.|Could not process transaction. Invalid installment value. If the error persists, contact Cielo.|Could not process transaction. Invalid installment value. Redo the transaction confirming the reported data. If the error persists, contact the virtual store.|No|
|24|Invalid number of installments.|Could not process transaction. Invalid number of installments. If the error persists, contact Cielo.|Could not process transaction. Invalid number of installments. Redo the transaction confirming the reported data. If the error persists, contact the virtual store.|No|
|25|Request for authorization did not send card number|Could not process transaction. Request for authorization did not send the card number. If the error persists, check the communication between virtual store and Cielo.|Could not process transaction. Review the reported data and try again. If the error persists, contact the virtual store.|Only 4 times in 16 days.|
|28|File temporarily unavailable.|Could not process transaction. File temporarily unavailable. Review the communication between Virtual Store and Cielo. If the error persists, contact Cielo.|Could not process transaction. Contact the Virtual Store.|Only 4 times in 16 days.|
|30|Unauthorized transaction. Decline Message|Could not process transaction. Ask the carrier to review the data and try again. If the error persists, check that communication with Cielo is being made correctly.|Could not process transaction. Review the data and try again. If the error persists, contact the store.|No|
|39|Unauthorized transaction. Error at the issuing bank.|Unauthorized transaction. Error at the issuing bank.|Unauthorized transaction. Contact your issuing bank.|No|
|41|Unauthorized transaction. Card locked for loss.|Unauthorized transaction. Card locked for loss.|Unauthorized transaction. Contact your issuing bank.|No|
|43|Unauthorized transaction. Card locked for theft.|Unauthorized transaction. Card locked for theft.|Unauthorized transaction. Contact your issuing bank.|No|
|51|Unauthorized transaction. Limit exceeded/no balance.|Unauthorized transaction. Limit exceeded/no balance.|Unauthorized transaction. Contact your issuing bank.|From the following day, only 4 times in 16 days.|
|52|Card with invalid control digit.|Could not process transaction. Card with invalid control digit.|Unauthorized transaction. Review the reported data and try again.|No|
|53|Transaction not allowed. Invalid Savings card|Transaction not allowed. Invalid Savings card.|Could not process transaction. Contact your issuing bank.|No|
|54|Unauthorized transaction. Expired card|Unauthorized transaction. Expired card.|Unauthorized transaction. Redo the transaction confirming data.|No|
|55|Unauthorized transaction. Invalid password|Unauthorized transaction. Invalid password.|Unauthorized transaction. Contact your issuing bank.|No|
|57|Transaction not allowed for the card|Unauthorized transaction. Transaction not allowed for the card.|Unauthorized transaction. Contact your issuing bank.|Only 4 times in 16 days.|
|58|Transaction not allowed. Invalid payment option.|Transaction not allowed. Invalid payment option. Review if the chosen payment option is enabled in the register|Unauthorized transaction. Contact your virtual store.|No|
|59|Unauthorized transaction. Suspected fraud.|Unauthorized transaction. Suspected fraud.|Unauthorized transaction. Contact your issuing bank.|No|
|60|Unauthorized transaction.|Unauthorized transaction. Try again. If the error persists the carrier should contact the issuing bank.|Could not process transaction. Try again later. If the error persists, contact your issuing bank.|Only 4 times in 16 days.|
|61|Issuing bank unavailable.|Unauthorized transaction. Issuing bank unavailable.|Unauthorized transaction. Try again. If the error persists, contact your issuing bank.|Only 4 times in 16 days.|
|62|Unauthorized transaction. Card restricted for home use|Unauthorized transaction. Card restricted for home use.|Unauthorized transaction. Contact your issuing bank.|From the following day, only 4 times in 16 days.|
|63|Unauthorized transaction. Security breach|Unauthorized transaction. Security breach.|Unauthorized transaction. Contact your issuing bank.|No|
|64|Unauthorized transaction. Value below the minimum required by the issuing bank.|Unauthorized transaction. Contact your issuing bank.|Unauthorized transaction. Value below the minimum required by the issuing bank.|No|
|65|Unauthorized transaction. Exceeded the number of transactions for the card.|Unauthorized transaction. Exceeded the number of transactions for the card.|Unauthorized transaction. Contact your issuing bank.|Only 4 times in 16 days.|
|67|Unauthorized transaction. Card locked for shopping today.|Unauthorized transaction. Card locked for shopping today. Blocking may be due to excessive invalid attempts. Card will be automatically unlocked at midnight.|Unauthorized transaction. Card locked temporarily. Contact your issuing bank.|From the following day, only 4 times in 16 days.|
|70|Unauthorized transaction. Limit exceeded/no balance.|Unauthorized transaction. Limit exceeded/no balance.|Unauthorized transaction. Contact your issuing bank.|From the following day, only 4 times in 16 days.|
|72|Cancellation not done. Not enough available balance for cancellation.|Cancellation not done. Not enough available balance for cancellation. If the error persists, contact Cielo.|Cancellation not done. Try again later. If the error persists, contact the virtual store..|No|
|74|Unauthorized transaction. The password is expired.|Unauthorized transaction. The password is expired.|Unauthorized transaction. Contact your issuing bank.|No|
|75|Password locked. Exceeded card attempts.|Unauthorized transaction.|Your Transaction can not be processed. Contact your card issuer.|No|
|76|Cancellation not done. Issuer bank did not locate the original transaction|Cancellation not done. Issuer bank did not locate the original transaction|Cancellation not done. Contact the virtual store.|No|
|77|Cancellation not done. The original transaction was not found|Cancellation not done. The original transaction was not found|Cancellation not done. Contact the virtual store.|No|
|78|Unauthorized transaction. Locked card first use.|Unauthorized transaction. Locked card first use. Ask the carrier to unblock the card directly from their issuing bank.|Unauthorized transaction. Contact your issuing bank and request that the card to be unlocked.|No|
|80|Unauthorized transaction. Divergence on transaction/payment date.|Unauthorized transaction. Invalid transaction date or first payment date.|Unauthorized transaction. Redo the transaction confirming data.|No|
|82|Unauthorized transaction. Invalid card.|Unauthorized transaction. Invalid card. Ask the carrier to review the data and try again.|Unauthorized transaction. Redo the transaction confirming data. If the error persists, contact your issuing bank.|No|
|83|Unauthorized transaction. Error in password control|Unauthorized transaction. Error in password control|Unauthorized transaction. Redo the transaction confirming data. If the error persists, contact your issuing bank.|No|
|85|Transaction not allowed. Operation failed.|Transaction not allowed. There was a processing error. Ask the carrier to re-enter the card data, if there is a persistent error there may be a problem at the merchant's terminal, in which case the merchant should contact Cielo.|Transaction not allowed. Re-enter the card data. If the error persists, contact the virtual store.|No|
|86|Transaction not allowed. Operation failed.|Transaction not allowed. There was a processing error. Ask the carrier to re-enter the card data, if there is a persistent error there may be a problem at the merchant's terminal, in which case the merchant should contact Cielo.|Transaction not allowed. Re-enter the card data. If the error persists, contact the virtual store.|No|
|89|Transaction error.|Unauthorized transaction. Transaction error. The carrier must try again and if the error persists, contact the issuing bank.|Unauthorized transaction. Transaction error. Try again and if the error persists, contact your issuing bank.|Only 4 times in 16 days.|
|90|Transaction not allowed. Operation failed.|Transaction not allowed. There was a processing error. Ask the carrier to re-enter the card data, if there is a persistent error there may be a problem at the merchant's terminal, in which case the merchant should contact Cielo.|Transaction not allowed. Re-enter the card data. If the error persists, contact the virtual store.|No|
|91|Unauthorized transaction. Issuing bank temporarily unavailable.|Unauthorized transaction. Issuing bank temporarily unavailable.|Unauthorized transaction. Issuing bank temporarily unavailable. Contact your issuing bank.|Only 4 times in 16 days.|
|92|Unauthorized transaction. Communication time exceeded.|Unauthorized transaction. Communication time exceeded.|Unauthorized transaction. Temporarily unavailable communication. Contact the virtual store.|Only 4 times in 16 days.|
|93|Unauthorized transaction. Rule violation - Possible error in register.|Unauthorized transaction. Rule violation - Possible error in register.|Your transaction can not be processed. Contact the virtual store.|No|
|96|Processing failed.|Could not process transaction. Failure in Cielo's system. If the error persists, contact Cielo.|Your Transaction can not be processed, try again later. If the error persists, contact the virtual store.|Only 4 times in 16 days.|
|97|Value not allowed for this transaction.|Unauthorized transaction. Value not allowed for this transaction.|Unauthorized transaction. Value not allowed for this transaction.|No|
|98|System/communication unavailable.|There was no request response within the set time.|The transaction may have been processed. To confirm, check the transaction by the store order number and evaluate whether it was actually processed.|Retry only after reviewing the original transaction by the order number and confirm that it was not processed.|
|99|System/communication unavailable.|Unauthorized transaction. Issuer system without communication. Try later. Can be error in SITEF, please check!|Your Transaction can not be processed, try again later. If the error persists, contact the virtual store.|From the following day, only 4 times in 16 days.|
|999|System/communication unavailable.|Unauthorized transaction. Issuer system without communication. Try later. Can be error in SITEF, please check!|Your Transaction can not be processed, try again later. If the error persists, contact the virtual store.|From the following day, only 4 times in 16 days.|
|AA|Time Exceeded|Time exceeded in communication with the issuing bank. Orient the carrier to try again, if the error persists it will be necessary for the carrier to contact their issuing bank.|Time exceeded in their communication with the issuing bank, try again later. If the error persists, contact your bank.|Only 4 times in 16 days.|
|AC|Transaction not allowed. Debit card being used as credit. Use the debit function.|Transaction not allowed. Debit card being used as credit. Ask the carrier to select the Debit Card payment option.|Unauthorized transaction. Try again by selecting the debit card payment option.|No|
|AE|Try later|Time exceeded in communication with the issuing bank. Orient the carrier to try again, if the error persists it will be necessary for the carrier to contact their issuing bank.|Time exceeded in their communication with the issuing bank, try again later. If the error persists, contact your bank.|Only 4 times in 16 days.|
|AF|Transaction not allowed. Operation failed.|Transaction not allowed. There was a processing error. Ask the carrier to re-enter the card data, if there is a persistent error there may be a problem at the merchant's terminal, in which case the merchant should contact Cielo.|Transaction not allowed. Re-enter the card data. If the error persists, contact the virtual store.|No|
|AG|Transaction not allowed. Operation failed.|Transaction not allowed. There was a processing error. Ask the carrier to re-enter the card data, if there is a persistent error there may be a problem at the merchant's terminal, in which case the merchant should contact Cielo.|Transaction not allowed. Re-enter the card data. If the error persists, contact the virtual store.|No|
|AH|Transaction not allowed. Credit card being used as debit. Use the credit function.|Transaction not allowed. Credit card being used as debit. Ask the carrier to select the Credit Card payment option.|Unauthorized transaction. Try again by selecting the credit card payment option.|No|
|AI|Unauthorized transaction. Authentication was not performed.|Unauthorized transaction. Authentication was not performed. The carrier did not complete the authentication. Ask the carrier to review the data and try again. If the error persists, contact Cielo informing the BIN (6 first digits of the card)|Unauthorized transaction. Authentication failed. Try again and correctly enter the requested data. If the error persists, contact the merchant.|No|
|AJ|Transaction not allowed. Credit or debit transaction in an operation that allows only Private Label. Try again by selecting the Private Label option.|Transaction not allowed. Credit or debit transaction in an operation that allows only Private Label. Ask the carrier to try again by selecting the Private Label option. If not available the Private Label option check in Cielo if your establishment allows this operation.|Transaction not allowed. Credit or debit transaction in an operation that allows only Private Label. Try again and select the Private Label option. In case of a new error, contact the virtual store.|No|
|AV|Unauthorized transaction. Invalid data|Validation of transaction data failed. Guide the carrier to review the data and try again.|Data validation failed. Review the reported data and try again.|Only 4 times in 16 days.|
|BD|Transaction not allowed. Operation failed.|Transaction not allowed. There was a processing error. Ask the carrier to re-enter the card data, if there is a persistent error there may be a problem at the merchant's terminal, in which case the merchant should contact Cielo.|Transaction not allowed. Re-enter the card data. If the error persists, contact the virtual store.|No|
|BL|Unauthorized transaction. Daily limit exceeded.|Unauthorized transaction. Daily limit exceeded. Ask the carrier to contact their issuing bank.|Unauthorized transaction. Daily limit exceeded. Contact your issuing bank.|From the following day, only 4 times in 16 days.|
|BM|Unauthorized transaction. Invalid card|Unauthorized transaction. Invalid card. It may be card locking at the issuing bank or incorrect data. Try to use the Lhum Algorithm (Mod 10) to avoid unauthorized transactions for this reason.|Unauthorized transaction. Invalid card. Redo the transaction confirming the reported data.|No|
|BN|Unauthorized transaction. Card or account locked.|Unauthorized transaction. Carrier's card or account is locked. Ask the carrier to contact their issuing bank.|Unauthorized transaction. Carrier's card or account is locked. Contact your issuing bank.|No|
|BO|Transaction not allowed. Operation failed.|Transaction not allowed. There was a processing error. Ask the carrier to re-enter the card data, if the error persists, contact the issuing bank.|Transaction not allowed. There was a processing error. Re-enter card data, if error persists, contact issuing bank.|Only 4 times in 16 days.|
|BP|Unauthorized transaction. Non-existent checking account.|Unauthorized transaction. The transaction could not be processed due to an error related to the carrier's card or account. Ask the carrier to contact the issuing bank.|Unauthorized transaction. Could not process the transaction due to an error related to the carrier's card or account. Contact the issuing bank.|No|
|BV|Unauthorized transaction. Expired card|Unauthorized transaction. Expired card.|Unauthorized transaction. Redo the transaction confirming data.|No|
|CF|Unauthorized transaction.C79:J79 Data validation failed.|Unauthorized transaction. Data validation failed. Ask the carrier to contact the issuing bank.|Unauthorized transaction. Data validation failed. Contact the issuing bank.|No|
|CG|Unauthorized transaction. Data validation failed.|Unauthorized transaction. Data validation faileds. Ask the carrier to contact the issuing bank.|Unauthorized transaction. Data validation failed. Contact the issuing bank.|No|
|DA|Unauthorized transaction. Data validation failed.|Unauthorized transaction. Data validation failed. Ask the carrier to contact the issuing bank.|Unauthorized transaction. Data validation failed. Contact the issuing bank.|No|
|DF|Transaction not allowed. Invalid card or card failure.|Transaction not allowed. Invalid card or card failure. Ask the carrier to re-enter the card data, if the error persists, contact the bank|Transaction not allowed. Invalid card or card failure. Re-enter card data, if error persists, contact bank|Only 4 times in 16 days.|
|DM|Unauthorized transaction. Limit exceeded/no balance.|Unauthorized transaction. Limit exceeded/no balance.|Unauthorized transaction. Contact your issuing bank.|From the following day, only 4 times in 16 days.|
|DQ|Unauthorized transaction. Data validation failed.|Unauthorized transaction. Data validation failed. Ask the carrier to contact the issuing bank.|Unauthorized transaction. Data validation failed. Contact the issuing bank.|No|
|DS|Transaction not allowed for the card|Unauthorized transaction. Transaction not allowed for the card.|Unauthorized transaction. Contact your issuing bank.|Only 4 times in 16 days.|
|EB|Unauthorized transaction. Daily limit exceeded.|Unauthorized transaction. Daily limit exceeded. Ask the carrier to contact their issuing bank.|Unauthorized transaction. Daily limit exceeded. Contact your issuing bank.|A partir do dia seguinte, only 4 times in 16 days.|
|EE|Transaction not allowed. Installment value below the minimum allowed.|Transaction not allowed. Installment value below the minimum allowed. It is not permitted installments lower than R$5,00. It is necessary to revise the calculation for installments.|Transaction not allowed. Installment value is below the minimum allowed. Contact the virtual store.|No|
|EK|Transaction not allowed for the card|Unauthorized transaction. Transaction not allowed for the card.|Unauthorized transaction. Contact your issuing bank.|Only 4 times in 16 days.|
|FA|Unauthorized transaction.|AmEx unauthorized transaction.|Unauthorized transaction. Contact your issuing bank.|No|
|FC|Unauthorized transaction. Call the Issuer|Unauthorized transaction. Guide the carrier to contact the issuing bank.|Unauthorized transaction. Contact your issuing bank.|No|
|FD|Transaction denied. Hold special condition card|Transaction not authorized by issuing bank rules.|Unauthorized transaction. Contact your issuing bank|No|
|FE|Unauthorized transaction. Divergence on transaction/payment date.|Unauthorized transaction. Invalid transaction date or first payment date.|Unauthorized transaction. Redo the transaction confirming data.|No|
|FF|Cancellation OK|Cancellation transaction authorized successfully. WARNING: This return is for cases of cancellations and not for cases of authorizations.|Transação de cancelamento autorizada com sucesso|No|
|FG|Unauthorized transaction. Call AmEx.|Unauthorized transaction. Guide the carrier to contact AmEx Call Center.|Unauthorized transaction. Contact the AmEx Call Center at the phone number 08007285090|No|
|FG|Call 08007285090|Unauthorized transaction. Guide the carrier to contact AmEx Call Center.|Unauthorized transaction. Contact the AmEx Call Center at the phone number 08007285090|No|
|GA|Wait for contact|Unauthorized transaction. Referred by Lynx Online in a preventive way. Cielo will contact the merchant about this case.|Unauthorized transaction. Contact the merchant.|No|
|HJ|Transaction not allowed. Invalid operation code.|Transaction not allowed. Invalid Coban operation code.|Transaction not allowed. Invalid Coban operation code. Contact the merchant.|No|
|IA|Transaction not allowed. Invalid operation indicator.|Transaction not allowed. Invalid Coban operation indicator.|Transaction not allowed. Invalid Coban operation indicator. Contact the merchant.|No|
|JB|Transaction not allowed. Invalid operation value.|Transaction not allowed. Invalid Coban operation value.|Transaction not allowed. Invalid Coban operation value. Contact the merchant.|No|
|KA|Transaction not allowed. Data validation failed.|Transaction not allowed. There was a failure in data validation. Ask the carrier to review the data and try again. If the error persists, check the communication between virtual store and Cielo.|Transaction not allowed. There was a failure in data validation. Review the reported data and try again. If the error persists, contact the Virtual Store.|No|
|KB|Transaction not allowed. Incurred option selected.|Transaction not allowed. Wrong option selected. Ask the carrier to review the data and try again. If the error persists, the communication between virtual store and Cielo must be checked.|Transaction not allowed. Wrong option selected. Try again. If the error persists, contact the Virtual Store.|No|
|KE|Unauthorized transaction. Data validation failed.|Unauthorized transaction. Data validation failed. Selected option is not enabled. Check the options available to the carrier.|Unauthorized transaction. Data validation failed. Selected option is not enabled. Contact the virtual store.|No|
|N7|Unauthorized transaction. Invalid security code.|Unauthorized transaction. Invalid security code. Guide the carrier to correct the data and try again.|Unauthorized transaction. Review the data and enter again.|No|
|R1|Unauthorized transaction. Default card (Do not honor).|Unauthorized transaction. Could not process transaction. Issue related to security, default or carrier limit.|Unauthorized transaction. Contact your issuing bank.|Only 4 times in 16 days.|
|U3|Transaction not allowed. Data validation failed.|Transaction not allowed. There was a failure in data validation. Ask the carrier to review the data and try again. If the error persists, check the communication between virtual store and Cielo.|Transaction not allowed. There was a failure in data validation. Review the reported data and try again. If the error persists, contact the Virtual Store.|No|
|GD|Transaction not allowed|Transaction not allowed|Transaction can not be processed in the establishment. Contact Cielo for more details..|Transaction not allowed. Contact the virtual store|No|
**Warning**: There are similar return codes, but with different meanings such as "**6** - Captured" and the "**06** - Canceled Card". These codes are only informative of the processing system. **Only the field `STATUS` should be considered as the current transaction situation**
# Annexes
## Affiliate Settings.
Some transaction types require that their Affiliation is properly set up with Cielo. We suggest that, by default, you validate with our call center if your affiliation is able to transact in any of the scenarios below:
|Scenario|
|---|
|Recurrence|
|Transaction without CVV|
|Customizing the validity of a transaction|
## List of Providers
|Means of payment|Provider|
|---|---|
|Credit card|`Cielo`|
|Debit card|`Cielo`|
|Bank slip - Not registered|`Bradesco` / `BancodoBrasil`|
|Bank slip - Registered|`Bradesco2` / `BancodoBrasil2`|
|Electronic Transfer|`Bradesco` / `BancodoBrasil`|
## Types of means of payment
|MEANS OF PAYMENT|PAYMENT.TYPE|
|---|---|
|Credit card|CreditCard|
|Debit cardo|DebitCard|
|Bank slip|Bank slip|
|Electronic Transfer|EletronicTransfer|
## Merchant Defined Data
The table below lists all possible codes to be sent in the MerchantDefinedData parameter and respective type of information that must be filled in.
|ID|Data|Description|Type|
|---|---|---|---|
|1|Customer logged in|If the final customer logged in on the site to buy, send: their login. If the customer made a purchase as a visitor, send: "Guest". If the sale was made direct by a third party, an agent for example, do not send the field|String|
|2|Customer of the establishment since: #days|Number of days|Number|
|3|Purchase Made in (installments)|Number of installments|Number|
|4|Sales Channel|Values: "Call Center" = purchase by phone <br> "Web" = purchase by web <br> "Portal" = an agent making the purchase for the customer <br> "Kiosk" = Purchases in kiosks <br> "Mobile" = Purchases made on smartphones or tablets|String|
|5|Coupon Code/Discount|If the buyer is to use coupon, send the coupon code|String|
|6|Last purchase made|MM DD YYYY|Date|
|7|Affiliation|Name or code of dealer or broker|String|
|8|Attempts to Purchase|Number of times tried to make the order payment. Different attempted credit cards and/or other means of payments attempted. For the same order.|Number|
|9|Customer will withdraw the product in a Store|Values: "YES", "NO" In the case of an agency, if you are going to withdraw any voucher and/or ticket physically|String|
|10|Payment made by third party|Values: "YES", "NO" Whether or not the payer is present on the trip or package|String|
|11|Hotel Category|Values: 1, 2, 3, 4, 5 How many stars has the hotel|Number|
|12|Hotel Check-in date|MM DD YYYY|Date|
|13|Hotel Check-out date|MM DD YYYY|Date|
|14|Travel/Package|Values: "National", "International", "National/International"|String|
|15|Name of Airline/Car Rental/Hotel|Send the name of each company, separated by "/"|String|
|16|PNR|Send the reservation PNR number. When there is a change in the reservation for this PNR with anticipation of the flight date, it is important to do a new analysis of fraud by sending this PNR again.|String|
|17|There was anticipation of reservation?|Values: "YES", "NO" Indicate whether the flight was remarked to a date earlier than the original. It is also important to send the PNR field|String|
|18|(reserved)|||
|19|(reserved)|||
|20|(reserved)|||
|21|(reserved)|||
|22|(reserved)|||
|23|(reserved)|||
|24|(reserved)|||
|25|(reserved)|||
|26|Credit Card Bin|Send the bin - 6 first digits of the card|String|
|27|(reserved)|||
|28|(reserved)|||
|29|(reserved)|||
|30|(reserved)|||
|31|Number of Credit Cards exchanges|Number of times the buyer has exchanged the credit card to make the payment of the order|Number|
|32|E-mail pasted or typed|Values: "Typed", "Pasted" Report whether the e-mail address was typed or pasted into the field|String|
|33|Card Number pasted or typed|Values: "Typed", "Pasted" Report whether the credit card number was typed or pasted into the field|String|
|34|E-mail confirmed|If there is an e-mail confirmation routine for account activation. Values: "YES". In case of negative, do not send the MDD|String|
|35|Customer type (local or tourist)|Values: "Local", "Tourist". Do not send the MDD in the case of not having this information|String|
|36|Use gift card at purchase ($)|Report if Gift Card was used (Gift Card) at purchase. Values: "YES". In case of negative, do not send the MDD|String|
|37|Shipping method|Values: "Sedex", "Sedex 10", "1 Day", "2 Days", "Motoboy", "Same Day", etc. If there is no shipping, do not send the MDD|String|
|38|Caller ID number|Inform the identified phone number, with DDD|String|
|39|(reserved)|||
|40|(reserved)|||
|41 a 95|Free Field|The fields are reserved for sending merchant data, according to the business rule.|String|
|96|(reserved)|||
|97|(reserved)|||
|98|(reserved)|||
|99|(reserved)|||
|100|Document|Document (CPF, RG, etc.)|String|
## Fraud Analysis Values
### FraudAnalysis.status
|Field|Description|
|---|---|
|Started|Transaction received by Cielo.|
|Accept|Transaction accepted after fraud analysis.|
|Review|Transaction under review after fraud analysis.|
|Reject|Transaction rejected after fraud analysis.|
|Unfinished|Transaction not finalized due to some internal error in the system.|
|Pendent|Transaction waiting for analysis|
|ProviderError|Transaction with error in antifraud provider.|
### FraudAnalysis.Items.GiftCategory
|Field|Description|
|---|---|
|Yes|In case of divergence between billing and delivery addresses, mark as small risk.|
|No|In case of divergence between billing and delivery addresses, mark as high risk.|
|Off|Ignores risk analysis for divergent addresses.|
### FraudAnalysis.Items.HostHedge
|Field|Description|
|---|---|
|Low|Low importance of e-mail and IP address in risk analysis.|
|Normal|Average importance of e-mail and IP address in risk analysis.|
|High|High importance of e-mail and IP address in risk analysis.|
|Off|E-mail and IP address do not affect the risk analysis.|
### FraudAnalysis.Items.NonSensicalHedge
|Field|Description|
|---|---|
|Low|Low importance of the verification made on the buyer's order, in the risk analysis.|
|Normal|Average importance of the verification made on the buyer's order, in the risk analysis.|
|High|High importance of the verification made on the buyer's order, in the risk analysis.|
|Off|Verification of buyer's order does not affect risk analysis.|
### FraudAnalysis.Items.ObscenitiesHedge
|Field|Description|
|---|---|
|Low|Low importance of obscenities verification of buyer's order, in the risk analysis.|
|Normal|Average importance of obscenities verification of buyer's order, in the risk analysis.|
|High|High importance of obscenities verification of buyer's order, in the risk analysis.|
|Off|Obscenity verification of buyer's order does not affect risk analysis.|
### FraudAnalysis.Items.PhoneHedge
|Field|Description|
|---|---|
|Low|Low importance on tests performed with telephone numbers.|
|Normal|Average importance on tests performed with telephone numbers.|
|High|High importance on tests performed with telephone numbers.|
|Off|Phone number tests do not affect risk analysis.|
### FraudAnalysis.Items.Risk
|Field|Description|
|---|---|
|Low|The product has a history of few chargebacks.|
|Normal|The product has a history of chargebacks considered normal.|
|High|Product has an above average chargeback history.|
### FraudAnalysis.Items.TimeHedge
|Field|Description|
|---|---|
|Low|Low importance of the time of day when the purchase was made, for the risk analysis.|
|Normal|Average importance of the time of day when the purchase was made, for the risk analysis.|
|High|High importance of the time of day when the purchase was made, for the risk analysis.|
|Off|Purchase time does not affect risk analysis.|
### FraudAnalysis.Items.Type
|Field|Description|
|---|---|
|CN|Private buyer|
|CP|Business buyer|
### FraudAnalysis.Items.VelocityHedge
|Field|Description|
|---|---|
|Low|Low importance on the number of purchases made by the customer in the last 15 minutes.|
|Normal|Average importance on the number of purchases made by the customer in the last 15 minutes.|
|High|High importance on the number of purchases made by the customer in the last 15 minutes.|
|Off|The frequency of purchases made by the customer does not affect the fraud analysis.|
### FraudAnalysis.Items.Passenger.Rating
|Field|Description|
|---|---|
|Adult|Adult passenger.|
|Child|Child passenger.|
|Infant|Infant passenger.|
|Youth|Teenage passenger.|
|Student|Student passenger.|
|SeniorCitizen|Elderly passenger.|
|Military|Military passenger.|
### FraudAnalysis.Shipping.Method
|Field|
|---|
|None|
|SameDay|
|OneDay|
|TwoDay|
|ThreeDay|
|LowCost|
|Pickup|
|Other|
## Service Tax Amount - BOARDING FEE
**The boarding fee** (servicetaxamount) is an information field that defines the total amount of the transaction that should be used to pay the fee to Infraero. The value of the boarding fee is not accumulated at the value of the authorization.
* *e.g.*: In an airline ticket sale of R$200,00 with boarding fee of R$25,00, the field `Payment.ServiceTaxAmount` must be sent as 2500
**Rules**
* Available only for Visa, Mastercard and Amex issuers.
* The value of the boarding fee is not added to the value of the authorization, i.e. it is only informative.
There are specific rules for the requisition of capture with boarding fee, available in the item Total and Partial Capture.
## Soft Descriptor
It allows the merchant to send a supplementary text that will be printed on the buyer's invoice along with the identification of the store name that appears in Cielo register.
**Rules**
* Maximum field size: 13 characters.
* Available only for Visa and MasterCard issuers.
* Can not contain special characters.
To know and/or change the name of the store that is registered, contact the Cielo relationship center.
# Questions and Support
If you have any questions or any other technical information, contact Cielo e-Commerce Web Support at the following channels:
* **E-mail:** [cieloeCommerce@cielo.com.br](mailto:cieloeCommerce@cielo.com.br)
* **Capitals:** 4002-9700
* **Other Cities:** 0800 570 1700
Opening hours: 24 hours a day, 7 days a week.
|
Java
|
UTF-8
| 1,234
| 2.734375
| 3
|
[] |
no_license
|
package com.leverx.learn.blogme.service;
/**
* @author Viktar on 06.06.2020
*
* Provides methods for work with activation codes
*/
public interface ActivationCodeService {
/**
* Allows to activate an user {@link com.leverx.learn.blogme.entity.User} using activation code.
*
* @param code Code which will be checked for validity.
* @return Message with a result of user activation.
*/
String activateUserByCode(String code);
/**
* Generates an activation code which is necessary for user {@link com.leverx.learn.blogme.entity.User} activation.
*
* @param email User's {@link com.leverx.learn.blogme.entity.User} email on which one will be sent an activation code.
* @return Activation code
*/
String generateActivationCode(String email);
/**
* Checks a status of an activation code.
*
* @param code Code which will be checked.
* @return code validity.
*/
boolean isCodeExists(String code);
/**
* Allows to reset of password
*
* @param confirmationCode Code for validity.
* @param newPassword New password which will be set.
*/
void resetPassword(String confirmationCode, String newPassword);
}
|
Java
|
UTF-8
| 5,447
| 2.9375
| 3
|
[] |
no_license
|
package kata.supermarket;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertEquals;
class DiscountedBasketTest {
@DisplayName("basket provides discounted value when containing...")
@MethodSource
@ParameterizedTest(name = "{0}")
void basketProvidesDiscountedValue(String description, String expectedTotal, Iterable<Item> items, Iterable<Discount> discounts) {
final Basket basket = new Basket();
items.forEach(basket::add);
discounts.forEach(basket::add);
assertEquals(new BigDecimal(expectedTotal), basket.total());
}
static Stream<Arguments> basketProvidesDiscountedValue() {
return Stream.of(
noItemsNoDiscounts(),
aSingleItemWithTwoForOneDiscount(),
twoItemsWithTwoForOneDiscount(),
threeItemsWithTwoForOneDiscount(),
fourItemsWithTwoForOneDiscount(),
multipleItemsWithTwoForOneDiscount(),
twoItemsWithThreeForTwoDiscount(),
threeItemsWithThreeForTwoDiscount(),
fourItemsWithThreeForTwoDiscount(),
multipleItemsWithThreeForTwoDiscount(),
multipleItemsWithMultipleDiscounts()
);
}
private static Arguments aSingleItemWithTwoForOneDiscount() {
return Arguments.of("a single item, 2-4-1 discount", "0.49",
Collections.singleton(aPintOfMilk()),
Collections.singletonList(twoForOne("milk")));
}
private static Arguments twoItemsWithTwoForOneDiscount() {
return Arguments.of("two items, 2-4-1 discount", "0.49",
Arrays.asList(aPintOfMilk(), aPintOfMilk()),
Collections.singletonList(twoForOne("milk")));
}
private static Arguments threeItemsWithTwoForOneDiscount() {
return Arguments.of("three items, 2-4-1 discount", "0.98",
Arrays.asList(aPintOfMilk(), aPintOfMilk(), aPintOfMilk()),
Collections.singletonList(twoForOne("milk")));
}
private static Arguments fourItemsWithTwoForOneDiscount() {
return Arguments.of("four items, 2-4-1 discount", "0.98",
Arrays.asList(aPintOfMilk(), aPintOfMilk(), aPintOfMilk(), aPintOfMilk()),
Collections.singletonList(twoForOne("milk")));
}
private static Arguments multipleItemsWithTwoForOneDiscount() {
return Arguments.of("multiple items, 2-4-1 discount", "3.59",
Arrays.asList(aPintOfMilk(), aPackOfDigestives(), aPackOfDigestives(), aPintOfMilk()),
Collections.singletonList(twoForOne("milk")));
}
private static Arguments twoItemsWithThreeForTwoDiscount() {
return Arguments.of("two items, 3-4-2 discount", "0.98",
Arrays.asList(aPintOfMilk(), aPintOfMilk()),
Collections.singletonList(threeForTwo("milk")));
}
private static Arguments threeItemsWithThreeForTwoDiscount() {
return Arguments.of("three items, 3-4-2 discount", "0.98",
Arrays.asList(aPintOfMilk(), aPintOfMilk(), aPintOfMilk()),
Collections.singletonList(threeForTwo("milk")));
}
private static Arguments fourItemsWithThreeForTwoDiscount() {
return Arguments.of("four items, 3-4-2 discount", "1.47",
Arrays.asList(aPintOfMilk(), aPintOfMilk(), aPintOfMilk(), aPintOfMilk()),
Collections.singletonList(threeForTwo("milk")));
}
private static Arguments multipleItemsWithThreeForTwoDiscount() {
return Arguments.of("multiple items, 3-4-2 discount", "3.02",
Arrays.asList(aPintOfMilk(), aPackOfDigestives(), aPintOfMilk(), aPintOfMilk(), aPintOfMilk()),
Collections.singletonList(threeForTwo("milk")));
}
private static Arguments multipleItemsWithMultipleDiscounts() {
return Arguments.of("multiple items, multiple discounts", "4.27",
Arrays.asList(aPintOfMilk(), aPackOfDigestives(), aPintOfMilk(), twoFiftyGramsOfAmericanSweets(), aPintOfMilk(), aPackOfDigestives(), aPintOfMilk()),
Arrays.asList(twoForOne("digestives"), threeForTwo("milk")));
}
private static Arguments noItemsNoDiscounts() {
return Arguments.of("no items", "0.00", Collections.emptyList(), Collections.emptyList());
}
private static Item aPintOfMilk() {
return new Product("milk", new BigDecimal("0.49")).oneOf();
}
private static Item aPackOfDigestives() {
return new Product("digestives", new BigDecimal("1.55")).oneOf();
}
private static WeighedProduct aKiloOfAmericanSweets() {
return new WeighedProduct("americanSweets", new BigDecimal("4.99"));
}
private static Item twoFiftyGramsOfAmericanSweets() {
return aKiloOfAmericanSweets().weighing(new BigDecimal(".25"));
}
private static Discount twoForOne(String productCode) { return new Discount(productCode, 2, new BigDecimal("0.5")); }
private static Discount threeForTwo(String productCode) { return new Discount(productCode, 3, new BigDecimal("0.33")); }
}
|
TypeScript
|
UTF-8
| 640
| 2.84375
| 3
|
[] |
no_license
|
class GameObject {
public div: HTMLElement;
public x: number = 0;
public y: number = 0;
public xspeed: number = 0;
public yspeed: number = 0;
public speedmultiplier: number = 1;
public width: number;
public height: number;
public direction: number = 1;
constructor(tag: string, parent: HTMLElement) {
this.div = document.createElement(tag);
parent.appendChild(this.div);
}
public update(): void {
this.direction = (this.xspeed < 0) ? 1 : -1;
this.div.style.transform = "translate(" + this.x + "px, " + this.y + "px) scale(" + this.direction + ",1)";
}
}
|
JavaScript
|
UTF-8
| 1,408
| 2.671875
| 3
|
[] |
no_license
|
var COMMERCIAL = {
imgArray:[],
currIndex:0,
path:'img/',
numImages:0,
interv:null,
timeout:6000,
active:true
}
COMMERCIAL.init = function(){
COMMERCIAL.imgArray = ["commercial/1.jpg", "commercial/2.jpg"];
COMMERCIAL.currIndex=0;
COMMERCIAL.numImages=COMMERCIAL.imgArray.length;
COMMERCIAL.addActions();
}
COMMERCIAL.addActions = function(){
}
COMMERCIAL.startGallery = function(){
COMMERCIAL.active = true;
COMMERCIAL.loadImage();
}
COMMERCIAL.stopGallery = function(){
COMMERCIAL.active = false;
window.clearTimeout(COMMERCIAL.interv);
}
COMMERCIAL.loadImage = function(){
if(!COMMERCIAL.active){
return;
}
var img = new Image();
var imgWrapper = $('<div class="img-wrapper"></div>');
var src = COMMERCIAL.path + COMMERCIAL.imgArray[COMMERCIAL.currIndex];
$(img).load(function(){
$(imgWrapper)
.hide()
.css({'background-image':'url(' + src + ')'})
.appendTo($('#commercial-gallery'))
.fadeTo(1500, 1, function(){
//$('#img_wrapper').find('.img-wrapper').not(':last').remove();
$(this).siblings().remove();
});
COMMERCIAL.currIndex < COMMERCIAL.numImages-1?COMMERCIAL.currIndex++:COMMERCIAL.currIndex=0;
COMMERCIAL.interv = window.setTimeout("COMMERCIAL.loadImage()", COMMERCIAL.timeout);
})
.attr('src', src);
}
|
Python
|
UTF-8
| 1,507
| 2.875
| 3
|
[
"Apache-2.0"
] |
permissive
|
import os.path
__author__ = 'Sina Solaimanpour'
responses = {
'MajorTests Tricky Words': 'http://www.vocabulary.com/lists/682592#view=notes',
'Official GRE Verbal': 'http://www.vocabulary.com/lists/700826#view=notes',
'Magoosh Tricky Words': 'http://www.vocabulary.com/lists/687078#view=notes'
}
def read_file(list):
dictionary = {}
f = open(list+'.txt', 'r')
for line in f:
splitted = line.split("\t")
dictionary[splitted[0]] = (splitted[1], splitted[2])
f.close()
if os.path.isfile(list+'_index.txt'):
f = open(list+'_index.txt', 'r')
index = int(f.readline())
f.close()
else:
index = 0
return dictionary, index
def main():
responses_key = responses.keys()
list = responses_key[0]
(dictionary, index) = read_file(list)
keys = dictionary.keys()
print('1. Press enter to see the definition\n2. Press c for exit\n3. Press r to reset the file and exit\n')
i = 0
for i in range(index, len(keys)):
print(keys[i] + ":")
input = raw_input('').lower()
print('definition: ' + dictionary[keys[i]][0] + " ||| description: " + dictionary[keys[i]][1] + "\n")
if input == 'c':
f = open(list+'_index.txt', 'w')
f.write('%d' % (i))
f.close()
break
if input == 'r':
f = open(list+'_index.txt', 'w')
f.write('%d' % 0)
f.close()
break
if __name__ == "__main__": main()
|
JavaScript
|
UTF-8
| 5,346
| 2.859375
| 3
|
[] |
no_license
|
test('Card.init', function() {
var C = Card();
var card = new C.Card(C.CardKind.Club, C.CardNum.Ace);
QUnit.equal(card.name(), 'club1', 'card Club Ace has name club1');
var card = new C.Card(C.CardKind.Special, C.CardNum.Joker);
QUnit.equal(card.name(), 'special15', 'card Special Joker has name special15');
});
test('Card.isComparable', function() {
var C = Card();
var card1 = new C.Card(C.CardKind.Club, C.CardNum.Ace);
var card2 = new C.Card(C.CardKind.Club, C.CardNum.Two);
QUnit.equal(card1.isComparable(card2), true, 'Club Ace is comparable with Club Two');
var C = Card();
var card1 = new C.Card(C.CardKind.Club, C.CardNum.Ace);
var card2 = new C.Card(C.CardKind.Heart, C.CardNum.Two);
QUnit.equal(card1.isComparable(card2), false, 'Club Ace is not comparable with Heart Two');
});
test('Card.compareTo', function() {
var C = Card();
var card1 = new C.Card(C.CardKind.Club, C.CardNum.Ace);
var card2 = new C.Card(C.CardKind.Heart, C.CardNum.Two);
QUnit.equal(card1.compareTo(card2) == undefined, true, 'Club Ace compares to Heart Two gets undefined');
var C = Card();
var card1 = new C.Card(C.CardKind.Club, C.CardNum.Ace);
var card2 = new C.Card(C.CardKind.Club, C.CardNum.Two);
QUnit.equal(card1.compareTo(card2) < 0, true, 'Club Ace is smaller to Club Two');
var C = Card();
var card1 = new C.Card(C.CardKind.Club, C.CardNum.Ace);
var card2 = new C.Card(C.CardKind.Club, C.CardNum.Ace);
QUnit.equal(card1.compareTo(card2) == 0, true, 'Club Ace equals to Club Ace');
});
test('Deck.init(numOfDecks : 1)', function() {
var C = Card();
var deck = new C.Deck();
QUnit.equal(deck.totalNumOfCards(), 52, '1 deck contains 52 cards');
QUnit.equal(_.all(deck.cards, function(card) {
return card.kind != C.CardKind.Special && card.num <= C.CardNum.King;
}), true, 'There is no jokers');
var counts = _.countBy(deck.cards, function(card) {
return card.kind;
});
QUnit.equal(counts[C.CardKind.Club], 13, '13 club cards');
QUnit.equal(counts[C.CardKind.Diamond], 13, '13 diamond cards');
QUnit.equal(counts[C.CardKind.Heart], 13, '13 heart cards');
QUnit.equal(counts[C.CardKind.Spade], 13, '13 spade cards');
var counts2 = _.countBy(deck.cards, function(card) {
return card.num;
});
QUnit.equal(counts2[C.CardNum.Ace], 4, '4 Ace cards');
QUnit.equal(counts2[C.CardNum.Two], 4, '4 Two cards');
QUnit.equal(counts2[C.CardNum.Three], 4, '4 Three cards');
QUnit.equal(counts2[C.CardNum.Four], 4, '4 Four cards');
QUnit.equal(counts2[C.CardNum.Five], 4, '4 Five cards');
QUnit.equal(counts2[C.CardNum.Six], 4, '4 Six cards');
QUnit.equal(counts2[C.CardNum.Seven], 4, '4 Seven cards');
QUnit.equal(counts2[C.CardNum.Eight], 4, '4 Eight cards');
QUnit.equal(counts2[C.CardNum.Nine], 4, '4 Nine cards');
QUnit.equal(counts2[C.CardNum.Ten], 4, '4 Ten cards');
QUnit.equal(counts2[C.CardNum.Jack], 4, '4 Jack cards');
QUnit.equal(counts2[C.CardNum.Queen], 4, '4 Queen cards');
QUnit.equal(counts2[C.CardNum.King], 4, '4 King cards');
});
test('Deck.init with Jokers', function() {
var C = Card();
var deck = new C.Deck(1, true, true);
QUnit.equal(deck.totalNumOfCards(), 54, '1 deck contains 52 cards and 2 jokers');
var counts = _.countBy(deck.cards, function(card) {
return card.kind;
});
QUnit.equal(counts[C.CardKind.Special], 2, '2 jokers');
var counts2 = _.countBy(deck.cards, function(card) {
return card.num;
});
QUnit.equal(counts2[C.CardNum.JokerS], 1, '1 small joker');
QUnit.equal(counts2[C.CardNum.Joker], 1, '1 big joker');
var C = Card();
var deck = new C.Deck(1, true, false);
QUnit.equal(deck.totalNumOfCards(), 54, '1 deck contains 52 cards and 2 jokers');
var counts = _.countBy(deck.cards, function(card) {
return card.kind;
});
QUnit.equal(counts[C.CardKind.Special], 2, '2 jokers');
var counts2 = _.countBy(deck.cards, function(card) {
return card.num;
});
QUnit.equal(counts2[C.CardNum.JokerS], undefined, 'there is no small joker');
QUnit.equal(counts2[C.CardNum.Joker], 2, '2 big jokers');
});
test('Deck.utilities', function() {
var C = Card();
var deck = new C.Deck();
QUnit.equal(deck.currentCard() == undefined,
true, "call current card without getting the first card gets no card");
QUnit.equal(deck.availableNumOfCards(), deck.totalNumOfCards(), "all cards are available");
QUnit.equal(deck.getCard() == deck.cards[0], true, "getCard gets the first card without shuffle");
QUnit.equal(deck.getCard().compareTo(deck.cards[1]), 0, "getCard call again gets the second card without shuffle using compareTo");
QUnit.equal(deck.shuffle() instanceof C.Deck, true, "shuffle function returns the deck back");
QUnit.equal(deck.availableNumOfCards(), deck.totalNumOfCards(), "after shuffle, the deck is reset");
QUnit.equal(deck.skip(deck.totalNumOfCards()).availableNumOfCards(), 0, "skipping all cards gets no card left");
QUnit.equal(deck.getCard() == undefined, true, "call getCard with no card available gets no card");
});
|
Java
|
UTF-8
| 910
| 2.828125
| 3
|
[] |
no_license
|
/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
public class Main
{
public static int[] productExceptSelf(int[] nums) {
int products[] = new int[nums.length];
for(int i=0;i<nums.length;i++) {
products[i] = 1;
for(int j=0;j<nums.length;j++) {
if(i != j) {
products[i] = products[i]*nums[j];
}
}
System.out.println(products[i]);
}
return products;
}
public static void main(String[] args) {
int array[] = new int[] {1,2,3,4};
productExceptSelf(array);
}
}
|
Java
|
UTF-8
| 1,354
| 1.75
| 2
|
[] |
no_license
|
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.sf.ictalive.coordination.wfvv;
import org.eclipse.emf.ecore.EFactory;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @see net.sf.ictalive.coordination.wfvv.WfvvPackage
* @generated
*/
public interface WfvvFactory extends EFactory {
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
WfvvFactory eINSTANCE = net.sf.ictalive.coordination.wfvv.impl.WfvvFactoryImpl.init();
/**
* Returns a new object of class '<em>Event Model Container</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Event Model Container</em>'.
* @generated
*/
EventModelContainer createEventModelContainer();
/**
* Returns a new object of class '<em>Event Group</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Event Group</em>'.
* @generated
*/
EventGroup createEventGroup();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the package supported by this factory.
* @generated
*/
WfvvPackage getWfvvPackage();
} //WfvvFactory
|
Markdown
|
UTF-8
| 1,563
| 2.65625
| 3
|
[] |
no_license
|
---
id: 324
title: Div centralizada vertical/horizontal, e fixa com rolagem da janela
date: 2011-03-23T09:01:07+00:00
author: William Bruno
layout: post
guid: http://www.wbruno.com.br/blog/?p=324
permalink: /javascript-puro/div-centralizada-verticalhorizontal-fixa-rolagem-da-janela/
dsq_thread_id:
- "2102136911"
categories:
- Javascript
---
Hehe, salve salve!!
Acabei de fazer um post: [Div centralizada vertical/horizontal, e fixa com resize da janela](http://www.wbruno.com.br/2011/03/23/div-centralizada-verticalhorizontal-fixa-resize-janela/), mas ai vi que faltava uma coisa nele:
A div se movimentar junto com a rolagem da janela(tecnicamente), ou seja, a DIV ficar fixa(aparentemente pro usuario).
Aquela coisa chata de propagandas, em que vc vai rolando o site, e tem um treco na frente.. que não sai do meio da tela.
<!--more-->
Apesar de chato pro usuário, ajuda bastante os desenvolvedores a divulgar informações.
Pequena alteração no outro script:
Onde era somente:
``` js
window.onload = function(){
calcMarginTop();
}
```
Agora deve ficar assim:
``` js
var marginTopoInicial;//criando variavel de escopo global
window.onload = function(){
calcMarginTop();
marginTopoInicial = parseInt( getMarginTop( id('main') ) );//recuperando o marginTop inicial
}
window.onscroll = function(){
id('main').style.marginTop = marginTopoInicial+window.pageYOffset+'px';//levando em conta o scroll
}
```
=) por enqnto é isso.
<a href="http://www.wbruno.com.br/scripts/div-centralizada-fixed.html" target="_blank">Demonstração</a>
|
Markdown
|
UTF-8
| 1,847
| 3
| 3
|
[] |
no_license
|
# GitPitch Enterprise Prerequisites
GitPitch Enterprise is delivered as a [Docker container](https://docs.docker.com) running in a Linux server environment. At runtime the enterprise container depends on a [Docker volume](https://docs.docker.com/storage/volumes) at runtime. This volume is used:
1. To pass custom GitPitch server configuration to the live container.
1. To cache GitPitch server log data outside of the live container.
1. To cache GitPitch server runtime data outside of the live container.
For on-premises deployment, the _Docker volume_ is typically a dedicated directory on your host Linux server. The volume could be a drive on an external disk, such as a storage area network (SAN) disk. In all cases, we recommend a high-performance SSD.
!> For trial purposes any modern laptop or desktop should be adequate to install and launch the GitPitch Enterprise server. The recommendations that follow are for production environments.
Based on your expected user load, we recommend the following production hardware configurations:
Users | CPUs | Heap Memory | Docker Memory | Docker Volume |
--------|------|--------|---------|----------|
10-500| 2 | 2GB | 4GB | 20GB |
500-2000| 4 | 4GB | 8GB | 50GB |
2000-10000+| 4+ | 4GB | 8GB | 50GB+ |
These recommendations are estimates. Your specific patterns of usage and peak load will determine optimal configuration.
##### Note 1.
Heap Memory refers to the size of the Java Virtual Machine (JVM) heap. The default is 2GB. This setting is configurable on launch using the following syntax on the _docker run_ command:
```
-e JXMX=4g
```
##### Note 2.
Docker Memory refers to the memory resource limits for the Docker container.
##### Note 3.
Docker Volume refers to the storage drive shared between the host Linux server and the Docker container.
|
Markdown
|
UTF-8
| 5,811
| 3.078125
| 3
|
[] |
no_license
|
# webpack是什么?
Webpack是一款模块打包工具,你可以用它来帮助你打包。但是随着社区的发展,很多开发插件的涌现,这种定义越发模糊起来。一些插件所做的功能任务已经远远超出了打包的范畴,举例来说,有些插件可以帮助我们清理打包目录,还有的插件可以帮助我们处理打包后文件的线上部署。
Webpack在React中非常的受青睐,因为它支持热模块替换(Hot Module Replacement),这也使得webpack迅速变的家喻户晓,甚至扩展到了其他语言的开发中,比如Ruby On Rails。看到webpack中的web这个单词,你可能觉得webpack只能应用于网页开发之中,可不是这样的!webpack可以打包其他的资源,这部分的内容我们将会在 “构建目标文件” 小节中详述。
读到这,如果你恰好对React有所了解,却又不知道Hot Module Replacement(HMR) 为何物,我建议大家先看一下HMR的基本介绍,之后看下这篇文章:[点击阅读](https://segmentfault.com/a/1190000006178770),记录好如何配置HMR即可,接下来的教程中,我们可能继续给大家扩展HMR的相关知识。
## Webpack的打包建立在模块基础上
当你的项目中配置了webpack的**入口(input)**和**出口(output)**后,就可以使用webpack打包了。打包的过程从你的入口文件开始,入口文件就是一个模块(modules),通过imports可以引入其他模块。
当使用webpack打包项目时,它首先会便利模块引用(imports),建立一个项目的依赖关系图(dependency graph),然后根据这个关系图和你的配置文件内容,生成你所需要的输出文件。你可以在代码中设置切分点(split point),webpack可以根据设置,把工程的代码切分成多个。注意,webpack分析依赖关系图的时候,会通过一些静态的方式生成,而不是靠动态的运行文件来分析,这样性能上的消耗很小。
Webpack 支持ES6,CommonJS, AMD 的模块化方案.内部加载器(loader)机制使得它也可以处理css文件间的依赖关系,你只要安装css-loader后使用@import和url()即可完成css间的相互引用。你还可以使用很多Webpack的插件来帮助你完成指定的任务,比如说压缩代码,代码国际化,热模块加载等等。
# Webpack执行流程

Webpack从入口开始,这些入口一般会引入很多其他的模块,webpack遍历这些模块,开始打包流程。过程中,webpack会根据文件的类型,和对应的loader进行匹配,然后根据匹配结果执行对应的转换操作。
## 解析过程
入口本身就是一个模块,webpack遇到一个模块时,他会根据文件中的依赖去找寻这个模块所需的所有内容。
如果解析失败,webpack会给出运行时错误。如果解析成功,webpack就可以根据loader和其他配置项的定义运行打包流程了。每一个loader在模块内容打包时都负责处理指定部分内容的转换。
对于一个loader来说,它到底要负责哪部分内容的转化呢?定义loader职责的方法有多种,你可以根据文件的类型来决定使用哪个loader,也可以根据文件所在的路径来执行对应的loader。webpack还提供了更加灵活的方式,你甚至可以根据文件在哪里被引用来决定使用什么loader进行解析,怎么样,很酷吧!
解析的过程中,loader模块中的内容也会被解析。loader也可以被其他loader所解析,他们也有自己的配置文件,总之,一旦loader解析没通过,你的webpack一样会报错。
## webpack几乎可以处理任何文件类型
Webpack 会处理构建过程中依赖图谱中的所有模块。如果入口包含任何依赖,每个依赖的模块都会被处理到。无论什么文件类型,webpack都不会放过,这一点不像Babel或者Sass的编译器,他们只负责处理固定的文件类型。
你可以控制webpack遇到不同文件时作出的不同相应。你可以让webpack把某些静态资源打包到js里,这样可以避免额外的网络请求。webpack还提供了一些使用技巧,你可以通过webpack实现css的模块化,避免像以前一样的非模块化css编码。这些webpack带来的灵活性,使得webpack具有非常大的使用价值。
尽管webpack主要被用做打包js,它也可以捕获图片或者字体这样的静态资源并对它们进行单独处理。入口只是webpack构建过程中的开始执行点,具体打包过程时如何的,完全依赖于你怎么做的打包配置。
## 执行流程
webpack会先加载解析模块的所有loader,然后按照从下至上,从右到左的顺序执行(这点非常重要),如果你希望实现这样的效果:styleLoader(cssLoader('./main.css')),先解析css再挂载到页面,那么顺序一定要放对。加载其定义的章节会详细阐述这部分的内容。
如果执行过程中没有出现任何的错误,webpack会把资源打包到最后生成的文件中。插件的作用在于,可以在构建流程中的某些具体时刻去做一些运行时插入的操作。
尽管加载器(loader)可以做很多操作,在高级任务中,他们能做的事情也有限。webpack内部提供了插件机制,可以在运行时执行一些插入事件,比较好的一个例子是:ExtractTextPlugin这个插件可以帮助我们在打包过程中抽离出独立的css文件,这个插件和loader是一个串联的运行关系。如果不使用这个插件,css和js会被打包在一起,关于抽取这个概念,在css分离一章中我们会具体讲解。
|
Shell
|
UTF-8
| 741
| 3.234375
| 3
|
[
"ISC"
] |
permissive
|
#!/usr/bin/env bash
source ./scripts/_init
set -x
# setup workspace
o="$BASE_DIR"
rm -rf "${o}"
mkdir -p "${o}/node_modules"
mkdir -p "${o}/bin"
cp "$ROOT_DIR/README.md" "${o}"
cp "$ROOT_DIR/LICENSE" "${o}"
cp "$ROOT_DIR/package.json" "${o}"
cp "$ROOT_DIR/yarn.lock" "${o}"
cp -rv "$ROOT_DIR/lib" "${o}/lib"
(
cd "${o}"
# install packages
yarn install --no-progress --production --non-interactive
)
# build cli-engine if needed
if [ ! -f "${o}/node_modules/cli-engine/lib/cli.js" ]; then
cd "${o}/node_modules/cli-engine"
yarn
yarn run prepare
fi
cat << EOF > "${o}/bin/heroku.js"
#!/usr/bin/env node
const {run} = require('cli-engine')
const config = {
channel: '${CHANNEL}',
version: '${VERSION}'
}
run({config})
EOF
|
Markdown
|
UTF-8
| 1,731
| 2.8125
| 3
|
[] |
no_license
|
# 简介
本项目会持续更新收录以下内容:
1、Chrome玩法技巧
2、Chrome好用的插件推荐
3、Chrome使用问题解答
4、待补充
因为Chrome真的很强大,有很多值得挖掘的地方,用的好,真的是一大利器,因此想不断学习挖掘Google Chrome,这是个长久之事,所以希望大家可以一起来。
大家有任何关于Chrome的使用技巧以及插件推荐,或者在使用中遇到问题,都可以联系我

另外,PDF文档会不断地更新,这是为了方便大家下载下来本地学习,请持续关注,为避免失联,请关注公众号,以免错过更新消息!

------
# 第三方扩展插件网站
对于插件的安装,权威在线的就是chrome网上商店,但是嘞,由于不可抗拒因素,很多人不一定打开,如果能打开可以直接在线搜索下载安装,很方便,在上面我们介绍了离线安装包安装的方式,其实正确的是可以直接下载安装包,然后直接拖拽安装,上面那样属于开发者模式安装,正如上面我们看到的那样,出现了各种错误。
所以你记住了,安装chrome插件,要么chrome商店在线安装,要么下载安装包安装,但是chrome商店你又打不开怎么办?
没事,这种事能难到我们,在国内有很多第三方网站,支持下载离线安装包,用着也很爽,接下来我就推荐我私藏。
[第三方插件网站推荐.md](第三方插件网站推荐.md)
|
Java
|
UTF-8
| 1,291
| 3.078125
| 3
|
[] |
no_license
|
package com.zeulb.textbuddy;
import static org.junit.Assert.*;
import java.io.PrintWriter;
import org.junit.Before;
import org.junit.Test;
public class TextContainerTest {
private static final String fileName = "testFile.txt";
public boolean insertToFile(String string) {
try {
PrintWriter out = new PrintWriter(fileName);
out.print(string);
out.close();
} catch(Exception e) {
return false;
}
return true;
}
@Before
public void setUp() throws Exception {
insertToFile("");
}
@Test
public void testToString() {
TextContainer tc = new TextContainer(fileName);
tc.add("Makan");
tc.add("Minum");
tc.add("Tidur");
assertEquals( "1. Makan\n"
+ "2. Minum\n"
+ "3. Tidur", tc.toString());
}
@Test
public void testCanImportFromFile() throws Exception {
String list = "1. Eat\n" +
"2. Sleep\n" +
"3. Watch TV";
insertToFile(list);
TextContainer tc = new TextContainer(fileName);
assertEquals(tc.toString(), list);
}
}
|
Markdown
|
UTF-8
| 1,120
| 2.96875
| 3
|
[] |
no_license
|
Chocolate Cake is one of my favorite desserts. If I were to choose any dessert to eat, I would choose chocolate cake. Today, I am showing a simple recipie for kids to make chocolate cake at home.
2 cups white sugar
1 ¾ cups all-purpose flour
¾ cup unsweetened cocoa powder
1 ½ teaspoons baking powder
1 ½ teaspoons baking soda
1 teaspoon salt
2 large eggs eggs
1 cup milk
½ cup vegetable oil
2 teaspoons vanilla extract
1 cup boiling water
Nutrition: 156.6 calories; protein 2.3g 5% DV; carbohydrates 25.7g 8% DV; fat 5.7g 9% DV; cholesterol 16.3mg 5% DV; sodium 217.1mg 9% DV.
1. Preheat oven to 350 degrees F (175 degrees C). Grease and flour two nine inch round pans.
In a large bowl, stir together the sugar, flour, cocoa, baking powder, baking soda and salt. Add the eggs, milk, oil and vanilla, mix for 2 minutes on medium speed of mixer. Stir in the boiling water last. Batter will be thin. Pour evenly into the prepared pans.
2. Bake 30 to 35 minutes in the preheated oven, until the cake tests done with a toothpick. Cool in the pans for 10 minutes, then remove to a wire rack to cool completely.
|
PHP
|
UTF-8
| 959
| 2.515625
| 3
|
[] |
no_license
|
<?php
/**
* This file is part of the QualityPress package.
*
* (c) QualityPress
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace QualityPress\QCommerce\Component\Association\Factory;
/**
* Factory
*
* @author QualityPress
*/
class Factory implements FactoryInterface
{
protected $class;
/**
* Factory constructor.
*
* @param string $class
*/
public function __construct($class)
{
$this->class = $class;
}
/**
* {@inheritdoc}
*/
public function createNew()
{
$class = $this->class;
return new $class();
}
/**
* {@inheritdoc}
*/
public function getClass()
{
return $this->class;
}
/**
* {@inheritdoc}
*/
public function setClass($class)
{
$this->class = $class;
return $this;
}
}
|
Java
|
UTF-8
| 597
| 3.03125
| 3
|
[
"Unlicense"
] |
permissive
|
package github.com.helbertrios.demo.javase.passagemparametro;
public class PassagemParametroValor {
public static void main(String[] args) {
int i = 1;
changePrimitivo(i);
System.out.println(i); // 1
Integer I = 1;
changePrimitivo(I);
System.out.println(I); // 2
int j = 1;
changePrimitivo(j);
System.out.println(j); // 3
Integer J = 1;
changePrimitivo(J);
System.out.println(J); // 4
int a = j + new Integer(j);
System.out.println(a);
}
static void changePrimitivo(int a) {
a = 2;
}
static void changeWrapper(Integer a) {
a = 2;
}
}
|
TypeScript
|
UTF-8
| 6,514
| 2.5625
| 3
|
[
"Apache-2.0"
] |
permissive
|
import {
generateTypeDef,
dataTreeTypeDefCreator,
flattenDef,
getFunctionsArgsType,
} from "utils/autocomplete/dataTreeTypeDefCreator";
import {
DataTreeWidget,
ENTITY_TYPE,
EvaluationSubstitutionType,
} from "entities/DataTree/dataTreeFactory";
import { entityDefinitions } from "utils/autocomplete/EntityDefinitions";
describe("dataTreeTypeDefCreator", () => {
it("creates the right def for a widget", () => {
// @ts-expect-error: meta property not provided
const dataTreeEntity: DataTreeWidget = {
widgetId: "yolo",
widgetName: "Input1",
parentId: "123",
renderMode: "CANVAS",
text: "yo",
type: "INPUT_WIDGET_V2",
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
parentColumnSpace: 1,
parentRowSpace: 2,
leftColumn: 2,
rightColumn: 3,
topRow: 1,
bottomRow: 2,
isLoading: false,
version: 1,
bindingPaths: {
defaultText: EvaluationSubstitutionType.TEMPLATE,
},
reactivePaths: {
defaultText: EvaluationSubstitutionType.TEMPLATE,
},
triggerPaths: {
onTextChange: true,
},
validationPaths: {},
logBlackList: {},
propertyOverrideDependency: {},
overridingPropertyPaths: {},
privateWidgets: {},
};
const { def, entityInfo } = dataTreeTypeDefCreator(
{
Input1: dataTreeEntity,
},
false,
);
// TODO hetu: needs better general testing
// instead of testing each widget maybe we can test to ensure
// that defs are in a correct format
expect(def.Input1).toBe(entityDefinitions.INPUT_WIDGET_V2);
expect(def).toHaveProperty("Input1.isDisabled");
expect(entityInfo.get("Input1")).toStrictEqual({
type: ENTITY_TYPE.WIDGET,
subType: "INPUT_WIDGET_V2",
});
});
it("creates a correct def for an object", () => {
const obj = {
yo: "lo",
someNumber: 12,
someString: "123",
someBool: false,
unknownProp: undefined,
nested: {
someExtraNested: "yolo",
},
};
const expected = {
yo: "string",
someNumber: "number",
someString: "string",
someBool: "bool",
unknownProp: "?",
nested: {
someExtraNested: "string",
},
};
const objType = generateTypeDef(obj);
expect(objType).toStrictEqual(expected);
});
it("creates a correct def for a complex array of object", () => {
const data = [
{
nested: [
{
nested: [
{
nested: [
{
nested: [
{
nested: [
{
nested: [
{
name: "",
email: "",
},
],
},
],
},
],
},
],
},
],
},
],
},
];
const expected = "[def_6]";
const extraDef = {};
const expectedExtraDef = {
def_1: { nested: "[?]" },
def_2: { nested: "[def_1]" },
def_3: { nested: "[def_2]" },
def_4: { nested: "[def_3]" },
def_5: { nested: "[def_4]" },
def_6: { nested: "[def_5]" },
};
const dataType = generateTypeDef(data, extraDef);
expect(dataType).toStrictEqual(expected);
expect(extraDef).toStrictEqual(expectedExtraDef);
const extraDef2 = {};
const expected2 = "[def_10]";
const dataType2 = generateTypeDef(
data[0].nested[0].nested[0].nested,
extraDef2,
);
const expectedExtraDef2 = {
def_7: { name: "string", email: "string" },
def_8: { nested: "[def_7]" },
def_9: { nested: "[def_8]" },
def_10: { nested: "[def_9]" },
};
expect(dataType2).toStrictEqual(expected2);
expect(extraDef2).toStrictEqual(expectedExtraDef2);
});
it("creates a correct def for an array of array of object", () => {
const array = [[{ name: "", email: "" }]];
const expected = "[[def_11]]";
const extraDefsToDefine = {};
const expectedExtraDef = {
def_11: { name: "string", email: "string" },
};
const objType = generateTypeDef(array, extraDefsToDefine);
expect(objType).toStrictEqual(expected);
expect(extraDefsToDefine).toStrictEqual(expectedExtraDef);
});
it("flatten def", () => {
const def = {
entity1: {
someNumber: "number",
someString: "string",
someBool: "bool",
nested: {
someExtraNested: "string",
},
},
};
const expected = {
entity1: {
someNumber: "number",
someString: "string",
someBool: "bool",
nested: {
someExtraNested: "string",
},
},
"entity1.someNumber": "number",
"entity1.someString": "string",
"entity1.someBool": "bool",
"entity1.nested": {
someExtraNested: "string",
},
"entity1.nested.someExtraNested": "string",
};
const value = flattenDef(def, "entity1");
expect(value).toStrictEqual(expected);
});
});
describe("getFunctionsArgsType", () => {
const testCases = {
testCase1: {
arguments: [
{ name: "a", value: undefined },
{ name: "b", value: undefined },
{ name: "c", value: undefined },
{ name: "d", value: undefined },
{ name: "", value: undefined },
],
expectedOutput: "fn(a: ?, b: ?, c: ?, d: ?)",
},
testCase2: {
arguments: [],
expectedOutput: "fn()",
},
testCase3: {
arguments: [
{ name: "a", value: undefined },
{ name: "b", value: undefined },
{ name: "", value: undefined },
{ name: "", value: undefined },
],
expectedOutput: "fn(a: ?, b: ?)",
},
};
it("function with 4 args", () => {
expect(getFunctionsArgsType(testCases.testCase1.arguments)).toEqual(
testCases.testCase1.expectedOutput,
);
});
it("function with no args", () => {
expect(getFunctionsArgsType(testCases.testCase2.arguments)).toEqual(
testCases.testCase2.expectedOutput,
);
});
it("function with 2 args", () => {
expect(getFunctionsArgsType(testCases.testCase3.arguments)).toEqual(
testCases.testCase3.expectedOutput,
);
});
});
|
C#
|
UTF-8
| 1,589
| 2.53125
| 3
|
[] |
no_license
|
using System.Collections.Generic;
using System.Linq;
using HtmlAgilityPack;
using Domain.Calendar.Parser.Columns.Exceptions;
using Domain.Calendar.Parser.Dto;
using Domain.Calendar.Parser.Interfaces;
namespace Domain.Calendar.Parser.Services
{
public class EarningsCalendarParser : IParseEarningsCalendar
{
private readonly IColumnsParser columnsParser;
public EarningsCalendarParser(IColumnsParser columnsParser)
{
this.columnsParser = columnsParser;
}
public IEnumerable<EarningsCalendarDto> ParseEarningsCalendar(string rawHtml)
{
var htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(rawHtml);
var rows = htmlDocument.DocumentNode
.SelectNodes("//table[@id='ECCompaniesTable']//tr");
if (rows.Count == 0)
{
return Enumerable.Empty<EarningsCalendarDto>();
}
var rowsWithoutTableHeader = rows.Skip(1);
var results = new List<EarningsCalendarDto>();
foreach (var row in rowsWithoutTableHeader)
{
var cols = htmlDocument.DocumentNode.SelectNodes($"{row.XPath}//td");
try
{
var result = this.columnsParser.ParseColumns(cols);
results.Add(result);
}
catch (ColumnParsingException)
{
// TODO: Add logging of failed rows
}
}
return results;
}
}
}
|
Markdown
|
UTF-8
| 2,545
| 3.203125
| 3
|
[
"MIT"
] |
permissive
|
# **Cheat Sheet**
## Table of Contents
* [Command Line](#Command-Line-/-Terminal)
* [Git](#Git)
## **Command Line / Terminal**
### Keyboard Shortcuts
* <kbd>TAB</kbd> - Attempts to autocomplete the directory or file name you are typing. If there are >1 files that fit the letters you have typed, will display all matching files / folders
* <kbd>⇧</kbd> - Cycles through your most recent commands. Useful when running scripts repeatedly during testing or debugging.
* <kbd>CTRL</kbd>+<kbd>C</kbd> - Aborts any running command.
### Moving Around
When working in the command line, you are always somewhere in the file system of your computer. Accessing files means ***moving*** to their location in your file system.
* `pwd` - Shows your current directory
* `ls` - Lists the files in the current directory
* `ls -la` - Lists files ***and*** hidden files in the current directory
* `cd` - Return to home directory
* `cd <subfolder name>` - Navigate to a child directory ** deeper in the file tree
* `cd <subfolder name>/<subsubfolder name>` - Navigate to a child of a child's directory
* `cd ..` - Move to the parent directory -- one level higher in the file tree
* `cd ../..` - Move to the parent of the parent directory ** two levels higher in the file tree
### Changing Files and Folders
* `touch <filename.ext>` - Creates a file with the chosen name and extenstion
* `open <filename.ext>` - Opens a file
* `mkdir <folder name>` - Creates a new folder
* `rmdir <folder name>` - Removes and ***empty*** folder
* `rm -R <folder name>` - Removes folder ***AND*** contents
## **Git**
* `git init` - Initialize git in current directory
* `git clone <repo>` - Get a copy of git repo from server (often github) and place it on your computer
* `git add <file / directory>` - Stages changes for a commit
* `git commit -m "message decribing changes"`
## Visual Studio Code
### Formatting
* <kbd>⌘ Command</kbd> + <kbd>K</kbd> then <kbd>S</kbd> - Save without auto-formatting
### Line Actions
* <kbd>⇧ Shift</kbd> + <kbd>⌥ Option</kbd> + <kbd>Up / Down</kbd> - Copy current line above or below
* <kbd>⌥ Option</kbd> + <kbd>Up / Down</kbd> - Move current line up or down
* <kbd>⇧ Shift</kbd> + <kbd>⌘ Command</kbd> + <kbd>K</kbd> - Delete the current line
### Multiple Cursors
* <kbd>⌥ Option</kbd> + <kbd>click</kbd> - Keep clicking to add multiple cursors. Exit with <kbd>esc</kbd>
* <kbd>⇧</kbd> + <kbd>⌘ Command</kbd> + <kbd>L</kbd> - Use shortcut with a string selected. Will replace all instances of that string.
|
Ruby
|
UTF-8
| 203
| 2.875
| 3
|
[] |
no_license
|
module Utilities
class UniqueKeyGenerator
ALPHANUMERIC = [*'a'..'z', *'A'..'Z', *0..9].freeze
def self.generate length = 8
(0...length).map{ ALPHANUMERIC.sample }.join
end
end
end
|
Python
|
UTF-8
| 62
| 2.953125
| 3
|
[] |
no_license
|
#Dictionary
n = {"chicken":'4',"mutton":5}
print n.values()
|
Markdown
|
UTF-8
| 3,335
| 3.34375
| 3
|
[
"MIT"
] |
permissive
|
---
layout: essay
type: essay
title: Scratch, Python, Java, Javascript - My Programming Progression
# All dates must be YYYY-MM-DD format!
date: 2018-08-30
labels:
- Javascript
- Learning
- Software Engineering
---
<img class="ui small center circular floated image" src="../images/scratch.png">
When I decided to pursue the field of computer science and later cyber security, I started learning how to code with a very basic language used to teach people the basics of programming: Scratch. From my experience with Scratch, I started to look at programming in a global scope. I realized that there are far more applications that simple logic-based blocks have then I initially imagined. After creating very simple programs, I started to learn Python.
<img class="ui small center circular floated image" src="../images/python.png">
My first exposure to Python left me confused and later, intrigued. Since I started coding with simple blocks, the exposure to text based code was intimidating at first. After taking a class in high school from a very inspirational teacher, I quickly caught on to the simplicity and ease of use that Python provided users. From that experience, I started to write simple Python programs that made my high school experience easier such as homework planners and advanced calculators.
<img class="ui small center circular floated image" src="../images/jsworld.png">
The first required ICS class at UH Manoa, ICS 111, was my first exposure to the Java programming language. Since I already knew how to code in python, learning the basics of Java was a simple task. With a few changes in syntax and the introduction of curly braces and semicolons, I caught on to Java fairly quickly. But, once I started to learn more Java, I realized that everything in Java is an object, a concept that I only learned very briefly in my Python course. After a lot of practice, I started to understand the concepts of data structures which I then implemented in Java.
ICS 314, software engineering, was my first exposure to JavaScript. Before the class, I've heard a lot about how useful JavaScript is and how Java is to JavaScript as car is to carpet, but I haven't attempted to try it. Though the freecodecamp.org JavaScript crash course, I realized that JavaScript is similar to both Python and Java in terms of syntax. The ease of use that the JavaScript language provides made me realize why it is so widely used by software engineers. The universal support for JavaScript as well as its functionality made my first experience with JavaScript a pleasant one.
The first week of the ICS 314 course was also my first exposure to the "athletic programming" pedagogy. Though at first, the idea of timed programming assignments were intimidating, by practicing workouts of the day (WODs) at home until I could complete them in a reasonable time, I found the first actual WOD less intimidating than I initially thought. I believe that this style of learning is overall more beneficial than standard lecturing because WODs are far more engaging and they require students to practice programming whereas lecturing in typically unengaging. Though it is just the beginning of the year, I believe that this style of learning will help me further improve my programming skills better than other learning strategies.
|
Python
|
UTF-8
| 1,134
| 3.078125
| 3
|
[] |
no_license
|
#!/bin/python3
import sys
import math
def sq_root(nos):
sq_root_nrst = sq_min(nos)
sq_root_nrst_ma = max_sqroot(nos)
for nums in range(sq_root_nrst,sq_root_nrst_ma):
square=nums*nums
#print(square)
str_square=int(''.join(list(str(square))[0::2]))
nostr=''
for no in nos:
nostr = nostr+ str(no)
nums_no = int(nostr)
if (nums_no==str_square) and (math.sqrt(square).is_integer()):
return int(math.sqrt(square))
return 0
def max_sqroot(nos):
nostr1 = ''
for no in nos:
nostr1 = nostr1 + '9' + str(no)
sqre_nearest_ma = int(nostr1)
sq_root_nrst_ma = int(math.sqrt(sqre_nearest_ma))
return sq_root_nrst_ma
def sq_min(nos):
nostr = ''
for no in nos:
nostr = nostr + '0' + str(no)
sqre_nearest = int(nostr)
sq_root_nrst = int(math.sqrt(sqre_nearest))
return sq_root_nrst
if __name__ == "__main__":
n = int(input().strip())
numbers = list(map(int, input().strip().split(' ')))
result = sq_root(numbers)
#print (" ".join(map(str, result)))
print(result)
|
Java
|
UTF-8
| 3,007
| 2.921875
| 3
|
[] |
no_license
|
package karting;
public class Vozilo {
private double maksBrzina;
private double ubrzanje;
private double upravljivost;
private String ime;
private double trenutnaBrzina;
private double pomMaksBrzina;
private double duzinaPuta(double V0, double t, double a) {
return (V0 * t) + (a * Math.pow(t, 2)) / 2;
}
private double brzinaPut(double V0, double a, double s) {
return Math.sqrt(Math.pow(V0, 2) + 2 * a * s);
}
private double brzinaVreme(double V0, double a, double t) {
return V0 + a * t;
}
private double izrVreme(double Vmax, double Vtren, double a) {
return (Vmax - Vtren) / a;
}
public Vozilo(double maksBrzina, double ubrzanje, double upravljivost, String ime) {
this.maksBrzina = maksBrzina;
this.ubrzanje = ubrzanje;
if(upravljivost < 0) upravljivost = 0;
if(upravljivost > 1) upravljivost = 1;
this.upravljivost = upravljivost;
this.ime = ime;
trenutnaBrzina = 0;
}
public double dohvMaksBrzinu() {
return maksBrzina;
}
public double dohvUbrzanje() {
return ubrzanje;
}
public double dohvUpravljivost() {
return upravljivost;
}
public String dohvIme() {
return ime;
}
public double dohvTrenBrzinu() {
return trenutnaBrzina;
}
public double dohvPomMaxBrzinu() {
return pomMaksBrzina;
}
public void postMaksBrzinu(double maksBrzina) {
this.maksBrzina = maksBrzina;
if(this.trenutnaBrzina > this.maksBrzina) this.trenutnaBrzina = this.maksBrzina;
}
public void postUbrzanje(double ubrzanje) {
this.ubrzanje = ubrzanje;
}
public void postUpravljivost(double upravljivost) {
if(upravljivost < 0) upravljivost = 0;
if(upravljivost > 1) upravljivost = 1;
this.upravljivost = upravljivost;
}
public void postIme(String ime) {
this.ime = ime;
}
public void postTrenBrzinu(double trenutnaBrzina) {
if(trenutnaBrzina > this.maksBrzina) trenutnaBrzina = this.maksBrzina;
this.trenutnaBrzina = trenutnaBrzina;
}
public void postPomMaksBrzinu(double v) {
pomMaksBrzina = v;
}
public double pomeriVozilo(double t) {
double vreme = this.izrVreme(maksBrzina, trenutnaBrzina, ubrzanje);
double s = 0;
if(vreme > t) {
s = this.duzinaPuta(trenutnaBrzina, t, ubrzanje);
this.postTrenBrzinu(this.brzinaVreme(trenutnaBrzina, ubrzanje, t));
} else {
double s1 = this.duzinaPuta(trenutnaBrzina, vreme, ubrzanje);
double t2 = t - vreme;
double s2 = t2 * maksBrzina;
this.postTrenBrzinu(maksBrzina);
s = s1 + s2;
}
return s;
}
public double izracunajVreme(double s) {
double t = 0;
double t1 = this.izrVreme(maksBrzina, trenutnaBrzina, ubrzanje);
double s1 = this.duzinaPuta(trenutnaBrzina, t1, ubrzanje);
if(s1 < s) {
double s2 = s - s1;
double t2 = s2 / maksBrzina;
t = t1 + t2;
} else {
double x = this.brzinaPut(trenutnaBrzina, ubrzanje, s);
t = (x - trenutnaBrzina) / ubrzanje;
}
return t;
}
@Override
public String toString() {
return this.ime + " [" + this.maksBrzina + ", " + this.ubrzanje + ", " + this.upravljivost + "]";
}
}
|
Markdown
|
UTF-8
| 2,578
| 2.75
| 3
|
[] |
no_license
|
## Contributing changes to the Synchronet Source Repository
Merge requests are considered and accepted at [gitlab.synchro.net](https://gitlab.synchro.net).
Do not submit pull/merge requests in the Synchronet *mirror projects* on github.com or gitlab.com; they won't be considered.
When submitting merge requests to existing files, unless you have prior agreement with the maintainers:
* Use the dominant coding style of the file(s) being modified
* Do not perform tab to space conversions (or vice-versa); incidental trimming of trailing whitespace is okay
* Do not include changes that are not relevant to the merge request description/message
* Keep merge requests to a single topical change (e.g. don't combine new features with bug fixes with typo-fixes and style changes)
### Commit content
In general, if it's a large set of changes, your best bet of getting it accepted and merged into the repo would be to discuss the concept of the change with the developers in the [Synchronet Programming conference](http://web.synchro.net/?page=001-forum.ssjs&sub=syncprog) **first**.
When modifying the C/C++ source files:
* Do not call functions from `ctype.h` (e.g. `isprint()`, `isspace()`, `isdigit()`, etc.) - use the `xpdev/gen_defs.h IS_*` macros instead.
* Use safe string handling (e.g. xpdev's `SAFECOPY()` instead of `strcpy()`, `SAFEPRINTF()` or `safe_snprintf()` instead of `sprintf()`).
When modifying JavaScript (`.js`) files:
* Specify `"use strict"` when adding new files and write conforming code
* Don't introduce/use 3rd party libraries unnecessarily
### Branches
Only approved and authenticaed "developers" can create new branches in the `main/sbbs`repo. If, as a developer, you are creating a new branch in the `main/sbbs` repository, use the branch naming scheme: `<your-name>/<topic>`, where *your-name* is your abbreviated name, user-name, or alias and *topic* helps to identify the intended purpose of the branch. Branches created in user repositories (e.g. forks of main/sbbs) need not contain the `<your-name>/` prefix.
### Commit messages
* Try to keep the commit title (first line) to 70 characters or less.
* When a comment is related to an [issue](https://gitlab.synchro.net/main/sbbs/-/issues), use the proper commit message syntax foir automatic issue management as documented [here](https://docs.gitlab.com/ce/user/project/issues/managing_issues.html#closing-issues-automatically).
### Other types of contributions
If you were interested in contributing money, not code, then paypal to rob at synchro dot net.
Thank you for contributing!
|
Python
|
UTF-8
| 445
| 3.234375
| 3
|
[
"MIT"
] |
permissive
|
from Rationals.RationalType import Rational
def harmonic_series(n):
H = Rational(1,1)
ctr = 2
while True:
yield H
if ctr > n:
break
H += Rational(1,ctr)
ctr += 1
def alternating_harmonic_series(n):
H = Rational(1,1)
ctr = 2
alt = 1
while True:
yield H
if ctr > n:
break
H += Rational(alt,ctr)
alt *= -1
ctr += 1
|
Java
|
UTF-8
| 146
| 2.703125
| 3
|
[] |
no_license
|
public class PineApple implements Fruit
{
@Override
public void smeel()
{
System.out.println("Smels like PineApple");
}
}
|
JavaScript
|
UTF-8
| 1,187
| 2.765625
| 3
|
[] |
no_license
|
import anecdotesService from '../services/anecdotes'
const reducer = (state = [], action) => {
switch (action.type) {
case 'INITIALIZE':
return action.data
case 'UPDATE':
const updatedAnecdote = action.data
return state.map(item => item.id === updatedAnecdote.id ? updatedAnecdote : item)
case 'ADD_NEW':
const anecdoteObject = action.data
return [anecdoteObject, ...state]
default:
return state
}
}
export const addVote = (anecdote) => {
return async dispatch => {
const updatedAnecdote = { ...anecdote, votes: anecdote.votes + 1 }
const returnedAnecdote = await anecdotesService.update(updatedAnecdote)
dispatch({
type: 'UPDATE',
data: returnedAnecdote
})
}
}
export const createNew = (anecdote) => {
return async dispatch => {
const savedAnecdote = await anecdotesService.createNew(anecdote)
dispatch({
type: 'ADD_NEW',
data: savedAnecdote
})
}
}
export const initialize = () => {
return async dispatch => {
const anecdotes = await anecdotesService.getAll()
dispatch({
type: 'INITIALIZE',
data: anecdotes
})
}
}
export default reducer
|
JavaScript
|
UTF-8
| 1,837
| 2.75
| 3
|
[] |
no_license
|
function Student (name,email) {
let _name = name;
let _email = email;
this.getName= () => _name;
this.getEmail=() => _email;
let homworkRes = [];
this.addHomworkResult = function(topic,success) {
homworkRes.push({topic:topic, success:success})
}
this.getHomworkResult = () => homworkRes;
}
function FrontendLab (studentsList,failedHomeworksLimit) {
let _failedHomeworksLimit = failedHomeworksLimit;
let _studentsList = studentsList;
for(let i=0; i<_studentsList.length; i++){
_studentsList[i].resultsOf=[];
}
this.getFailedHomeworksLimit= () => _failedHomeworksLimit;
this.getStudentsList=() => _studentsList;
this.setFailedHomeworksLimit = function (num){
_failedHomeworksLimit=num;
}
this.setStudentsList = function(arr){
_studentsList=arr;
}
this.printStudentsList = function(){
_studentsList.forEach(element => {
console.log(element);
});
}
this.addHomworkResult = function(resultArr) {
for(let i=0; i<_studentsList.length; i++){
for(let j=0; j<resultArr.results.length; j++){
if(_studentsList[i].email===resultArr.results[j].email){
_studentsList[i].resultsOf.push({topic:resultArr.topic, success:resultArr.results[j].success})
}
}
}
}
this.printStudentsEligibleForTest = function(){
let allowPoint=0;
for(let i=0; i<_studentsList.length; i++){
for(let j=0; j<_studentsList[i].resultsOf.length; j++){
if(!_studentsList[i].resultsOf[j].success){
allowPoint++;
}
}
if(allowPoint<=_failedHomeworksLimit) {
console.log(_studentsList[i])
}
}
}
}
|
JavaScript
|
UTF-8
| 958
| 2.59375
| 3
|
[] |
no_license
|
var TweetCompose = function (form) {
this.$textArea = $(form).find("#tweet-content");
this.content = this.$textArea.val();
this.$mention = $(form).find("#tweet-mentions");
this.mentioned = this.$mention.val();
this.$form = $(form);
this.handleSubmit();
};
TweetCompose.prototype.handleSubmit = function () {
this.$form.on("submit", function (e) {
e.preventDefault();
var data = this.$form.serializeJSON();
$(":input").prop("disabled", true);
$.ajax({
type: "POST",
url: "/tweets",
data: { tweet: data.tweet },
dataType: "json",
success: function (data) {
$(":input").prop("disabled", false);
console.log(data);
},
error: function() {
$(":input").prop("disabled", false);
console.log("error error");
}
});
}.bind(this));
};
TweetCompose.prototype.clearInputs = function () {
$(":input").val("");
};
module.exports = TweetCompose;
|
Java
|
UTF-8
| 397
| 2.65625
| 3
|
[
"MIT"
] |
permissive
|
package com.javaxator.patterns.visitor;
public class SteeringComponent extends AbstractComponent {
@Override
public String getName() {
return "Steering component";
}
@Override
public void acceptVisitor(ShipComponentVisitor visitor) {
visitor.visit(this);
}
@Override
public void doAction() {
System.out.println("Turning craft");
}
}
|
Python
|
UTF-8
| 641
| 3.203125
| 3
|
[] |
no_license
|
#!/usr/bin/env python3
from itertools import permutations
import sys
def solve(A: int, B: int, C: int):
m = 0
for n1, n2, n3 in permutations([A, B, C]):
exp1 = "%d+%d%d" % (n1, n2, n3)
exp2 = "%d%d+%d" % (n1, n2, n3)
m = max(m, eval(exp1), eval(exp2))
print(m)
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
A = int(next(tokens)) # type: int
B = int(next(tokens)) # type: int
C = int(next(tokens)) # type: int
solve(A, B, C)
if __name__ == '__main__':
main()
|
Markdown
|
UTF-8
| 4,108
| 3.03125
| 3
|
[
"MIT"
] |
permissive
|
---
title: "Sawing in VR"
permalink: /portfolio/vr-mesh-cutting/
date: 2020-10-15
excerpt: "This is a tech demo in VR environment where objects can be cut as the user does."
header:
image: /assets/images/vrMeshCut_main_wide.png
teaser: /assets/images/vrMeshCut_play_1.gif
company: "Academic Project"
engine: "Unity"
platform: "Windows PC, HTC Vive"
skills: "C#, Graphics, Linear Algebra"
role: "Gameplay Engineer"
responsibilities: "Mesh Cutting, Sawing Behavior"
---
| |
| **Company**<br> {{page.company}} |||**Engine**<br> {{page.engine}}
| **Platform**<br> {{page.platform}} |||**Skills**<br> {{page.skills}}
| **Role**<br> <span style="color:red">{{page.role}}</span> |||**Responsibilities**<br> <span style="color:red">{{page.responsibilities}}</span>
## In-Game Videos
<figure class="half">
<img src="/assets/images/vrMeshCut_play_1.gif">
<img src="/assets/images/vrMeshCut_play_2.gif">
<figcaption>Mesh cutting without a blade width</figcaption>
</figure>
## Experiment
### Features
- Mesh Cutting with a Blade Width
- Concave Decomposition
- Optimization for Real-Time Performance
### Convex Cutting
<figure>
<img src="/assets/images/vrMeshCut_convex_plan_1.png">
</figure>
<figure>
<img src="/assets/images/vrMeshCut_convex_plan_2.png">
</figure>
```csharp
// The final data to rearrange vertex indices to split triangles
private struct StartEndPairPoints
{
CuttingDepthPoint start
CuttingDepthPoint end
List<CuttingStartPoints> cuttingPointsList
}
// Each depth point from a blade
private struct CuttingDepthPoint
{
// the start index in the triangle data of a mesh
int triangleIndex
// the intersected point between a ray and the object
float[3] point
float dist
// the start point of the sliced edge in clock-wised direction
float[3] pointStart
// the end point of the sliced edge in clock-wised direction
float[3] pointEnd
// the relative direction of the blade and the triangle order
bool isStartLeft
}
// Each sliced edge is refined as CuttingStartPoints
private struct CuttingStartPoints
{
int triangleStartIndex
// whether one edge is cut or not
int isolatedIndex
// the first vertex of a sliced edge in clock-wised order
int triangleIndex1
// the second one
int triangleIndex2
float[3] pointStart
float[3] pointEnd
bool isStartLeft
// whether the width of the blade is exactly on a vertex or not
bool isOnBlade
}
```
<figure>
<img src="/assets/images/vrMeshCut_convex_done.png">
</figure>
### Concave Decomposition
<figure>
<img src="/assets/images/vrMeshCut_concave_plan_1.png">
</figure>
The above description is the main concept of the concave decomposition for this project. The blue and red dots are the depth point of each object. After an object is sliced into two convex objects, the two objects which are at the left and right side of the blade will test collision check with other objects only within the box.
<figure>
<img src="/assets/images/vrMeshCut_concave_plan_2.png">
</figure>
### Optimization
<figure>
<img src="/assets/images/vrMeshCut_optimization_1.png">
</figure>
**Reducing the calculation range** is one of methods to optimize the performance. It partitions the space using a dot product between the perpendicular plane and each vertex so that only the upper trianges are conducted a complex calculation.
## References
- [Mesh Manipulation](https://www.raywenderlich.com/3169311-runtime-mesh-manipulation-with-unity)
- [Convex Mesh Slicing](https://github.com/hugoscurti/mesh-cutter)
- [Metal Gear Rising – Slicing](https://simonschreibt.de/gat/metal-gear-rising-slicing)
- [Concave Decomposition](https://gamedev.stackexchange.com/questions/53142/decomposing-a-concave-mesh-into-a-set-of-convex-meshes)
- [Constructive Solid Geometry](https://github.com/evanw/csg.js)
- [Addaptive Virtual Node Algorithm](https://www.math.ucla.edu/~jteran/papers/WJST14.pdf)
- [Chainsaw with Voxel Wood](https://twitter.com/pushmatrix/status/1328710719269990401)
|
Java
|
UTF-8
| 953
| 2.421875
| 2
|
[] |
no_license
|
package ru.geekbrains.simple.market.controllers;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import ru.geekbrains.simple.market.beans.Cart;
import ru.geekbrains.simple.market.dto.CartDto;
@RestController
@RequestMapping("api/v1/cart")
@RequiredArgsConstructor
public class CartController {
private final Cart cart;
@GetMapping
public CartDto showCart (){
return new CartDto(cart);
}
@GetMapping("/add/{id}")
public void addProductIntoCart(@PathVariable Long id) {
cart.addProductToCart(id);
}
@GetMapping("/inc/{id}")
public void incrementProductIntoCart(@PathVariable Long id) {
cart.addProductToCart(id);
}
@GetMapping("/dec/{id}")
public void decrementProductFromCart(@PathVariable Long id) {
cart.decrementProductInCart(id);
}
@GetMapping("/clear")
public void clearCart() {
cart.clear();
}
}
|
C
|
UTF-8
| 11,815
| 2.59375
| 3
|
[
"BSD-2-Clause"
] |
permissive
|
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/xattr.h>
#include <fuse.h>
#include <ulockmgr.h>
#define UNUSED(x) (void)(x)
#define CHECK(call) ({int rc = call; if(rc<0) {return -errno;}rc;})
struct mtimedb {
int fd;
size_t fsize;
const void *buf;
uint32_t base_mtime;
};
static uint32_t mtimedb_read32(const struct mtimedb *db, unsigned offset)
{
return *(uint32_t *)((uint8_t *)db->buf + offset);
}
static int mtimedb_init(struct mtimedb *db, const char *fname)
{
struct stat st;
int rc = open(fname, O_RDONLY);
if(rc<0) {
perror(fname);
goto err_open;
}
db->fd = rc;
rc = fstat(db->fd, &st);
if(rc<0) {
perror(fname);
goto err_fstat;
}
db->fsize = st.st_size;
db->buf = mmap(NULL, db->fsize, PROT_READ, MAP_SHARED, db->fd, 0);
if(db->buf==MAP_FAILED) {
perror(fname);
rc = -1;
goto err_mmap;
}
db->base_mtime = mtimedb_read32(db, 8);
return 0;
err_mmap:
err_fstat:
close(db->fd);
err_open:
return rc;
}
static void mtimedb_uninit(struct mtimedb *db)
{
munmap((void *)db->buf, db->fsize);
close(db->fd);
return;
}
static int mtimedb_compare_name(const struct mtimedb *db, unsigned offset, const char *path, unsigned *len)
{
const unsigned char *db_name = (const unsigned char *)((uint8_t *)db->buf + offset);
unsigned i;
bool debug = false;
int result = 0;
for(i=0;;) {
unsigned char db_ch = db_name[i];
unsigned char path_ch = path[i];
if(db_ch == path_ch) {
if(db_ch == 0) {
*len = i;
break;
}
i++;
continue;
}
if(path_ch=='/') {
if( db_ch == 0 ) {
*len = i;
break;
}
path_ch = 0;
}
result = (int)db_ch - (int)path_ch;
break;
}
if(debug) {
printf("compare: path:%s name:%s -> %d\n", path, db_name, result);
}
return result;
}
struct name_entry {
uint32_t name;
uint32_t mtime;
uint32_t children;
};
struct mtimedb_lookup_level_result {
unsigned name_len;
const struct name_entry *entry;
};
static int mtimedb_lookup_level(const struct mtimedb *db, const char *path, unsigned offset, struct mtimedb_lookup_level_result *result)
{
unsigned dirs = mtimedb_read32(db, offset);
unsigned i;
struct name_entry *entry;
bool debug=false;
offset += 4;
entry = (struct name_entry *)((uint8_t *)db->buf + offset);
bool linear = false;
if (linear) {
for(i=0;i<dirs;i++) {
unsigned name_offset = entry[i].name;
if(debug) {
printf("i=%u dirs=%u\n", i, dirs);
}
if(mtimedb_compare_name(db, name_offset, path, &result->name_len)==0) {
result->entry = entry+i;
return 0;
}
}
} else {
int left = 0;
int right = (int)dirs - 1;
for(;;) {
unsigned name_offset;
int middle;
int cmp;
if(left>right) {
break;
}
middle = (left + right)/2;
name_offset = entry[middle].name;
cmp = mtimedb_compare_name(db, name_offset, path, &result->name_len);
if(debug) {
printf("range [%d,%d,%d] -> %d dirs=%u\n", left, middle, right, cmp, dirs);
}
if(cmp<0) {
left = middle + 1;
} else if (cmp>0) {
right = middle - 1;
} else {
result->entry = entry+middle;
return 0;
}
}
}
if(debug) {
for(i=0;i<dirs;i++) {
unsigned name_offset = entry[i].name;
const char *db_name = (const char *)((uint8_t *)db->buf + name_offset);
int cmp = mtimedb_compare_name(db, name_offset, path, &result->name_len);
printf("%d %c %s %s\n", cmp, cmp>0?'>':(cmp < 0?'<':'='), path, db_name);
}
}
return -1;
}
static int mtimedb_lookup(const struct mtimedb *db, const char *path, long *mtime)
{
unsigned path_offset = 0;
unsigned db_offset = 16;
struct mtimedb_lookup_level_result result;
bool debug = false;
memset(&result, 0, sizeof(result));
for(;;) {
int rc = mtimedb_lookup_level(db, path+path_offset, db_offset, &result);
if(debug) {
printf("tc=%d offset:%#x match %s(%s)\n", rc, db_offset, path, path+(rc==0?result.name_len:0));
}
if(rc!=0) {
return rc;
}
path_offset += result.name_len;
if(path[path_offset]==0) {
*mtime = (long)db->base_mtime + result.entry->mtime;
break;
}
db_offset = result.entry->children;
if(db_offset==0) {
return -1;
}
path_offset ++;
}
return 0;
}
static const struct mtimedb *mtime_db=NULL;
static void passthru_update_mtime(const char *path, struct stat *st)
{
bool debug = false;
if(mtime_db) {
long mtime=st->st_mtime;
int rc = mtimedb_lookup(mtime_db, path, &mtime);
if(debug) {
fprintf(stderr, "path:%s rc:%d\n", path, rc);
}
if(rc==0) {
memset(&st->st_mtime, 0, sizeof(*st) - offsetof(struct stat, st_mtime));
st->st_mtime = mtime;
st->st_atime = st->st_mtime;
st->st_ctime = st->st_mtime;
}
}
return;
}
static const char *get_local_path(const char *path)
{
if(path[0]=='/') {
path++;
if(path[0]==0) {
return ".";
}
}
return path;
}
static int passthru_getattr(const char *path, struct stat *st)
{
path = get_local_path(path);
CHECK(lstat(path, st));
passthru_update_mtime(path, st);
return 0;
}
static int passthru_fgetattr(const char *path, struct stat *st,
struct fuse_file_info *fi)
{
CHECK(fstat(fi->fh, st));
path = get_local_path(path);
passthru_update_mtime(path, st);
return 0;
}
static int passthru_access(const char *path, int mask)
{
path = get_local_path(path);
CHECK(access(path, mask));
return 0;
}
static int passthru_readlink(const char *path, char *buf, size_t size)
{
int rc;
path = get_local_path(path);
rc = CHECK(readlink(path, buf, size - 1));
buf[rc] = '\0';
return 0;
}
static int passthru_opendir(const char *path, struct fuse_file_info *fi)
{
DIR *dp;
path = get_local_path(path);
dp = opendir(path);
if (dp == NULL) {
return -errno;
}
fi->fh = (uintptr_t) dp;
return 0;
}
static int passthru_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi)
{
DIR *dp = (DIR *) (uintptr_t) fi->fh;
UNUSED(path);
seekdir(dp, offset);
for(;;) {
struct stat st;
struct dirent *de = readdir(dp);
if(de==NULL) {
break;
}
memset(&st, 0, sizeof(st));
st.st_ino = de->d_ino;
st.st_mode = de->d_type << 12;
if (filler(buf, de->d_name, &st, telldir(dp))) {
break;
}
}
return 0;
}
static int passthru_releasedir(const char *path, struct fuse_file_info *fi)
{
DIR *dp = (DIR *) (uintptr_t) fi->fh;
UNUSED(path);
CHECK(closedir(dp));
return 0;
}
static int passthru_open(const char *path, struct fuse_file_info *fi)
{
int rc;
path = get_local_path(path);
rc = CHECK(open(path, fi->flags));
fi->fh = rc;
return 0;
}
static int passthru_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
int rc = CHECK(pread(fi->fh, buf, size, offset));
UNUSED(path);
return rc;
}
static int passthru_statfs(const char *path, struct statvfs *st)
{
path = get_local_path(path);
CHECK(statvfs(path, st));
return 0;
}
static int passthru_release(const char *path, struct fuse_file_info *fi)
{
UNUSED(path);
CHECK(close(fi->fh));
return 0;
}
static int passthru_getxattr(const char *path, const char *name, char *value,
size_t size)
{
int rc;
path = get_local_path(path);
rc = CHECK(lgetxattr(path, name, value, size));
return rc;
}
static int passthru_listxattr(const char *path, char *list, size_t size)
{
int rc;
path = get_local_path(path);
rc = CHECK(llistxattr(path, list, size));
return rc;
}
static int passthru_lock(const char *path, struct fuse_file_info *fi, int cmd,
struct flock *lock)
{
UNUSED(path);
return ulockmgr_op(fi->fh, cmd, lock, &fi->lock_owner, sizeof(fi->lock_owner));
}
static const char *root_path ="/";
static void *passthru_init(struct fuse_conn_info *conn)
{
int rc;
UNUSED(conn);
rc = chdir(root_path);
UNUSED(rc);
return NULL;
}
static const struct fuse_operations interposer_ops = {
.init = passthru_init,
.access = passthru_access,
.fgetattr = passthru_fgetattr,
.getattr = passthru_getattr,
.getxattr = passthru_getxattr,
.listxattr = passthru_listxattr,
.lock = passthru_lock,
.open = passthru_open,
.opendir = passthru_opendir,
.read = passthru_read,
.readdir = passthru_readdir,
.readlink = passthru_readlink,
.release = passthru_release,
.releasedir = passthru_releasedir,
.statfs = passthru_statfs
};
int main(int argc, char *argv[])
{
struct mtimedb db;
int rc;
int cur_arg = 1;
bool mtime_verbose = false;
const char *db_path = NULL;
bool mtime_lookup = false;
for(;;) {
const char *arg;
if(cur_arg>=argc) {
break;
}
arg = argv[cur_arg];
if(cur_arg+1<argc && strcmp("--mtime",arg)==0) {
db_path = argv[cur_arg+1];
cur_arg+=2;
continue;
}
if(cur_arg+1<argc && strcmp("--root",arg)==0) {
root_path = argv[cur_arg+1];
cur_arg+=2;
continue;
}
if(strcmp("--mtime-verbose",arg)==0) {
mtime_verbose = true;
cur_arg++;
continue;
}
if(strcmp("--mtime-lookup",arg)==0) {
mtime_lookup=true;
cur_arg++;
continue;
}
break;
}
if(db_path) {
rc = mtimedb_init(&db, db_path);
if(rc<0) {
return 1;
}
mtime_db=&db;
}
rc = chdir(root_path);
if(rc!=0) {
perror(root_path);
goto done;
}
if(mtime_lookup) {
if(mtime_db==NULL) {
fprintf(stderr,"must speficy mtime database first\n");
return 1;
}
for(;;) {
char buf[4096];
const char *path = fgets(buf,sizeof(buf),stdin);
long mtime;
if(path==NULL) {
break;
}
buf[strlen(path)-1]='\0';
rc = mtimedb_lookup(&db, path, &mtime);
if(mtime_verbose || rc<0) {
printf("%s %s\n", path, rc==0?"match":"no match");
}
if(rc<0) {
goto done;
}
}
goto done;
}
if(cur_arg!=1) {
argv[cur_arg-1] = argv[0];
}
rc = fuse_main(argc-(cur_arg-1), argv+(cur_arg-1), &interposer_ops, NULL);
done:
if(mtime_db) {
mtime_db = NULL;
mtimedb_uninit(&db);
}
return rc;
}
|
Python
|
UTF-8
| 455
| 3.71875
| 4
|
[
"MIT"
] |
permissive
|
from collections import deque
class Queue(object):
def __init__(self):
self._queue = deque()
def size(self):
return len(self._queue)
def is_empty(self):
return len(self._queue) == 0
def enqueue(self, value):
self._queue.append(value)
def deque(self):
try:
self.is_empty()
except Exception:
print("Index out of bounds")
return self._queue.popleft()
|
Shell
|
UTF-8
| 3,024
| 3.15625
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# builds intermediate interp tables (geo and taxonomy). NOTE: make sure the epsg-hsql jar is the right version for the latest release of occurrence-hive!
log () {
echo $(tput setaf 6)$(date '+%Y-%m-%d %H:%M:%S ')$(tput setaf 14)$1$(tput sgr0)
}
#SONAR_REDIRECT_URL=http://repository.gbif.org/repository/gbif/org/gbif/occurrence/occurrence-hive
#VERSION=$(xmllint --xpath "string(//release)" <(curl -s "${SONAR_REDIRECT_URL}/maven-metadata.xml"))
#FILENAME=occurrence-hive-${VERSION}-jar-with-dependencies.jar
#SONAR_DOWNLOAD_URL=${SONAR_REDIRECT_URL}/${VERSION}/${FILENAME}
#curl -SsLo /tmp/occurrence-hive.jar "${SONAR_REDIRECT_URL}/${VERSION}/${FILENAME}"
if [[ ! -e /home/hdfs/occurrence-hive-0.187-SNAPSHOT.jar ]]; then
echo "Build the dev branch of occurrence-hive, copy to /home/hdfs/occurrence-hive-0.187-SNAPSHOT.jar"
exit 1
fi
# Last known working version for species matching
curl -SsLo /home/hdfs/occurrence-hive-0.129.jar https://repository.gbif.org/repository/gbif/org/gbif/occurrence/occurrence-hive/0.129/occurrence-hive-0.129-jar-with-dependencies.jar
curl -SsLo /tmp/gt-epsg-hsql.jar 'http://download.osgeo.org/webdav/geotools/org/geotools/gt-epsg-hsql/20.5/gt-epsg-hsql-20.5.jar'
log 'Building intermediate interp geo tables'
hive --hiveconf occjar=/home/hdfs/occurrence-hive-0.187-SNAPSHOT.jar \
--hiveconf epsgjar=/tmp/gt-epsg-hsql.jar \
--hiveconf layerSource=/mnt/auto/maps/geocode/layers/ \
-f hive/normalize/interp_geo.q
# Use the webservice directly.
# (There's no use to the caching, every query is different. And it's a huge load on Varnish.)
log 'Finding address of checklistbank-nub-ws'
zk_servers=c5zk1.gbif.org,c5zk2.gbif.org,c5zk3.gbif.org
clb_nub_zk_node=$(zookeeper-client -server $zk_servers ls /prod/services/checklistbank-nub-ws 2> /dev/null | grep --only-matching ........-....-....-....-............ | tail -n 1)
clb_nub_host=$(zookeeper-client -server $zk_servers get /prod/services/checklistbank-nub-ws/$clb_nub_zk_node 2> /dev/null | grep $clb_nub_zk_node | tail -n 1 | jq -r .address)
clb_nub_port=$(zookeeper-client -server $zk_servers get /prod/services/checklistbank-nub-ws/$clb_nub_zk_node 2> /dev/null | grep $clb_nub_zk_node | tail -n 1 | jq -r .port)
clb_nub_location=http://$clb_nub_host:$clb_nub_port/
# ? clb_nub_location=http://ws2.gbif.org:9000/
log "Address is $clb_nub_location"
log 'Building intermediate interp taxonomy tables'
hive --hiveconf occjar=/home/hdfs/occurrence-hive-0.129.jar \
--hiveconf api=$clb_nub_location \
-f hive/normalize/interp_taxonomy.q
log 'Building country→gbifRegion map table'
(
curl -Ssg https://api.gbif.org/v1/enumeration/country | jq -r '.[] | "\(.iso2)\t\(.gbifRegion)"'
# Kosovo's code isn't shown in that enumeration
echo -e "XK\tEUROPE"
# Snapshots 2010-04-01 and 2010-07-26 contain UK values.
echo -e "UK\tEUROPE"
) | sort | sort -k2 > /tmp/analytics_regions.tsv
hive --hiveconf regionTable=/tmp/analytics_regions.tsv \
-f hive/normalize/create_region_table.q
|
Markdown
|
UTF-8
| 3,217
| 2.546875
| 3
|
[] |
no_license
|
---
published: true
title: Entregan 36 millones de pesos en apoyos a adultos mayores y jefas de familia
twitt: ■ Distribuyeron cheques a 115 abuelitos de los municipios de Zacatecas y Guadalupe
author: "RAQUEL OLLAQUINDIA "
location: Local
category: Portada
layout: posts
---

■ Tras casi 4 horas de espera, mil 118 mamás también recibieron ayuda gubernamental
Desde las 8 horas de este jueves, decenas de adultos mayores, algunos de ellos con necesidad de utilizar andaderas y sillas de ruedas o con dificultades para caminar, fueron llegando al recinto en el que se les citó para recibir los apoyos del programa Sumando a los Abuelos.
Después de registrarse y sentarse en los lugares asignados para ellos en el salón, todavía tuvieron que esperar casi 4 horas para que se les entregara el apoyo de Gobierno estatal y, así, poder regresar a sus hogares en la zona metropolitana, pues los beneficiarios provenían de los municipios de Zacatecas y Guadalupe.
No fue hasta las 11:30 horas aproximadamente cuando el gobernador Miguel Alonso Reyes arribó al lugar para comenzar el acto protocolario, el cual concluyó pasado el mediodía.
Durante el evento, 115 zacatecanos adultos mayores recibieron apoyos. En 2013, informó el mandatario estatal, se otorgaron ayudas del programa Sumando a los Abuelos a 2 mil personas de las cabeceras municipales de Zacatecas, Guadalupe, Frenillo y Jerez.
Además asistieron al acto madres jefas de familia que son beneficiarias de otro programa de apoyos de Gobierno del Estado y quienes también fueron llegando al lugar desde las 8 horas.
Para este segmento de población, se dieron mil 118 cheques de 2 mil 400 pesos cada uno. En este caso, los municipios de donde provenían las mujeres eran Zacatecas, Guadalupe, Pánuco, Vetagrande y Morelos.
El total de recurso económico que fue entregado este jueves ascendió a 5 millones 359 mil pesos y el balance de 2013 arroja una cifra en ambos programas, el de sumando a las madres zacatecanas y a los abuelos, de más de 36 millones, expuso el gobernador.
Por su parte, el director del Sistema Estatal para el Desarrollo Integral de la Familia (SEDIF), Álvaro Elías Ibargüengoitia, señaló que es una obligación apoyar a los dos grupos de población que estuvieron presentes en la distribución de ayudas, debido a la importancia que tienen en la sociedad zacatecana.
El mandatario Alonso Reyes hizo un recuento de los diferentes programas que tiene la administración de Zacatecas con enfoque social y que se incorporan dentro de la estrategia de Superación de la Marginación (Sumar).
Además, mencionó también la labor que ha realizado en materia de atracción de inversiones y entrega de microcréditos, lo que ha fomentado un mayor desarrollo económico y bienestar entre los zacatecanos.
“Hemos traído empresas de distintos lados para que sus hijos y sus nietos puedan trabajar, pero también a través de microcréditos Sumar estamos apoyando a aquellas mamás, papás y abuelitos que desde su casa quieren iniciar un pequeño negocio; que saben tejer, que saben coser, que saben preparar algunos alimentos y que también los estamos capacitando para que puedan iniciar un pequeño negocio”, concluyó.
|
TypeScript
|
UTF-8
| 2,127
| 3.140625
| 3
|
[] |
no_license
|
/// <amd-module name="viewportCollision"/>
// amd-module directive only required for OneRf.
// TODO: 8607647 - Update OneRf build task to add this directive automatically.
import * as HtmlExtensions from 'htmlExtensions';
/**
* Determines whether or not an HTML Element collides with the edges of the viewport (is partially or completely hidden)
*
* @export
* @param {HTMLElement} element - the element
* @returns {(ICollisionsDetected | boolean)} - an ICollisionsDetected object if a collision is detected,
* else it returns 'false' if no collisions detected
*/
export function collidesWith(element: HTMLElement): ICollisionsDetected | boolean {
let elementRectangle = HtmlExtensions.getClientRect(element) as ClientRect;
let collisionsDetected: ICollisionsDetected = {
top: false,
bottom: false,
left: false,
right: false
};
// Detecting width to account for lingering listeners and hidden elements
// without it collision would be detected at 0,0 (top,left) for hidden elements or non removed listeners
if (elementRectangle.width !== 0) {
if (elementRectangle.top <= 0) {
collisionsDetected.top = true;
}
if (window.innerHeight <= elementRectangle.bottom || document.documentElement.clientHeight <= elementRectangle.bottom) {
collisionsDetected.bottom = true;
}
if (elementRectangle.left <= 0) {
collisionsDetected.left = true;
}
if (window.innerWidth <= elementRectangle.right || document.documentElement.clientWidth <= elementRectangle.right) {
collisionsDetected.right = true;
}
}
for (let direction in collisionsDetected) {
if (collisionsDetected[direction] === true) {
return collisionsDetected;
}
}
return false;
}
/**
* Defines the ICollisionsDetected interface for the collidesWith method
*
* @interface ICollisionsDetected
*/
export interface ICollisionsDetected {
top: boolean;
bottom: boolean;
left: boolean;
right: boolean;
[direction: string]: boolean;
}
|
Markdown
|
UTF-8
| 1,461
| 2.671875
| 3
|
[] |
no_license
|
---
layout: post
category: blog
published: true
title: 'Lukáš Kolářík: Špatný exekuční řád poškozuje celou naši společnost [VIDEO]'
date: '2021-08-23'
author: Piráti Jihočeský kraj
image: 2021/kolis-video-exekuce.png
youtubeVideoId: XhctoRHiGnI
description: 'Obchodníci s chudobou nesmějí dál vydělávat na neštěstí lidí. Špatný exekuční řád totiž ve výsledku poškozuje celou naši společnost.
Nejen dlužníky, ale i věřitele, zaměstnavatele a nakonec samotné exekutory.'
tags:
- Volby 2021
- Lukáš Kolářík
---
**Obchodníci s chudobou nesmějí dál vydělávat na neštěstí lidí. Špatný exekuční řád totiž ve výsledku poškozuje celou naši společnost.
Nejen dlužníky, ale i věřitele, zaměstnavatele a nakonec samotné exekutory.**
Lukáš Kolářík, který vede kandidátku v Jihočeském kraji, proto za změnu exekučního řádu bojuje i ve Sněmovně. Vedou ho k tomu hodnoty, které mu dal život na venkově.
Sliby a závazky se musejí plnit. Proto je také třeba pomoci lidem z pastí, ve kterých je sami plnit nemohou. Lidé v Česku mají právo na to, cítit se znovu svobodně a bezpečně.
Je čas na změnu! Čas vrátit zemi budoucnost.
Celý náš program najdete na [piratiastarostove.cz/program](https://www.piratiastarostove.cz/program/)
Naše kandidátky a kandidáty v Jihočeském kraji na [piratiastarostove.cz/kandidati/kraj/jihocesky/](https://www.piratiastarostove.cz/kandidati/kraj/jihocesky/)
|
Python
|
UTF-8
| 11,366
| 2.75
| 3
|
[] |
no_license
|
"""
ObjectId: used to generate Id
Flask: Allow template functionality
Pymongo: Allows interaction between python and MongoDB
"""
import os
from flask import Flask, render_template, redirect, request, url_for
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
from os import path
if path.exists("env.py"):
import env
app = Flask(__name__)
app.config["MONGO_DBNAME"] = "pcbuilder"
app.config["MONGO_URI"] = os.environ.get("MONGO_URI")
mongo = PyMongo(app)
@app.route('/')
@app.route('/home_page')
def home_page():
"""
Default route to send user to home page
"""
return render_template("index.html")
@app.route('/all_builds')
def all_builds():
"""
Renders the allbuild template to see all builds
"""
return render_template("allbuilds.html", builds=mongo.db.build.find())
@app.route('/add_build')
def add_build():
"""
Finds all data in collection to populate the options in the forms
"""
build_names = mongo.db.build.find()
motherboards = mongo.db.motherboard.find()
processors = mongo.db.processor.find()
processor_coolers = mongo.db.processorcooler.find()
memory = mongo.db.memory.find()
graphics_cards = mongo.db.graphicscard.find()
hard_drives = mongo.db.harddrive.find()
power_supplies = mongo.db.powersupply.find()
cases = mongo.db.case.find()
return render_template(
'/addbuild.html',
motherboards=motherboards,
processors=processors,
processorcoolers=processor_coolers,
memory=memory,
graphicscards=graphics_cards,
harddrives=hard_drives,
powersupplies=power_supplies,
cases=cases,
build_names=build_names)
@app.route('/insert_build', methods=['POST'])
def insert_build():
"""Takes form options and turns it into a
dictionary and sends it to the database"""
build = mongo.db.build
build.insert_one(request.form.to_dict())
return redirect(url_for('all_builds'))
@app.route('/edit_build/<build_id>')
def edit_build(build_id):
"""
Gets the build's Id to populate the forms
with that build values for editing
finds all collection data to populate the forms with options
"""
build = mongo.db.build.find_one({"_id": ObjectId(build_id)})
motherboards = mongo.db.motherboard.find()
processors = mongo.db.processor.find()
processor_coolers = mongo.db.processorcooler.find()
memory = mongo.db.memory.find()
graphics_cards = mongo.db.graphicscard.find()
hard_drives = mongo.db.harddrive.find()
power_supplies = mongo.db.powersupply.find()
cases = mongo.db.case.find()
return render_template(
'editbuild.html',
motherboards=motherboards,
processors=processors,
processorcoolers=processor_coolers,
memory=memory,
graphicscards=graphics_cards,
harddrives=hard_drives,
powersupplies=power_supplies,
cases=cases, build=build)
@app.route('/update_build/<build_id>', methods=["POST"])
def update_build(build_id):
"""
Gets the build Id and sends updated data to mongo
Then gets redirected to all builds page
"""
build = mongo.db.build
build_params = {
'build_name': request.form.get('build_name'),
'motherboard': request.form.get('motherboard'),
'processor': request.form.get('processor'),
'processor_cooler': request.form.get('processor_cooler'),
'memory': request.form.get('memory'),
'graphics_card': request.form.get('graphics_card'),
'hard_drive': request.form.get('hard_drive'),
'power_supply': request.form.get('power_supply'),
'case': request.form.get('case')
}
build.replace_one({'_id': ObjectId(build_id)}, build_params)
return redirect(url_for('all_builds'))
@app.route('/delete_build/<build_id>')
def delete_build(build_id):
"""
Gets the build Id and deletes it form the database
Then gets redirected to all builds page
"""
mongo.db.build.delete_one({'_id': ObjectId(build_id)})
return redirect(url_for('all_builds'))
@app.route('/search_motherboard')
def search_motherboard():
"""
Sends user to search page and populates form option
"""
motherboards = mongo.db.motherboard.find()
return render_template(
'/search-by-motherboard.html',
motherboards=motherboards)
@app.route('/search_processor')
def search_processor():
"""
Sends user to search page and populates form option
"""
processors = mongo.db.processor.find()
return render_template(
'/search-by-processor.html',
processors=processors)
@app.route('/search_processor_cooler')
def search_processor_cooler():
"""
Sends user to search page and populates form option
"""
processor_coolers = mongo.db.processorcooler.find()
return render_template(
'/search-by-processor-cooler.html',
processor_coolers=processor_coolers)
@app.route('/search_memory')
def search_memory():
"""
Sends user to search page and populates form option
"""
memory = mongo.db.memory.find()
return render_template('/search-by-memory.html', memory=memory)
@app.route('/search_graphics_card')
def search_graphics_card():
"""
Sends user to search page and populates form option
"""
graphics_cards = mongo.db.graphicscard.find()
return render_template(
'/search-by-graphics-card.html',
graphics_cards=graphics_cards)
@app.route('/search_hard_drive')
def search_hard_drive():
"""
Sends user to search page and populates form option
"""
hard_drives = mongo.db.harddrive.find()
return render_template(
'/search-by-hard-drive.html',
hard_drives=hard_drives)
@app.route('/search_power_supply')
def search_power_supply():
"""
Sends user to search page and populates form option
"""
power_supplies = mongo.db.powersupply.find()
return render_template(
'/search-by-power-supply.html',
powersupplies=power_supplies)
@app.route('/search_case')
def search_case():
"""
Sends user to search page and populates form option
"""
cases = mongo.db.case.find()
return render_template('/search-by-case.html', cases=cases)
@app.route('/search_build_by_motherboard', methods=['POST'])
def search_build_by_motherboard():
"""
Searches for builds containing selected option
And redirects to page showing the results
"""
build = mongo.db.build.find()
search = request.form.get('search_build_by_motherboard')
motherboard_search = mongo.db.build.find(
{"motherboard": {"$regex": search}})
count = motherboard_search.count()
return render_template(
'search-results-motherboard.html',
motherboard_search=motherboard_search,
build=build,
count=count,
search=True)
@app.route('/search_build_by_processor', methods=['POST'])
def search_build_by_processor():
"""
Searches for builds containing selected option
And redirects to page showing the results
"""
build = mongo.db.build.find()
search = request.form.get('search_build_by_processor')
processor_search = mongo.db.build.find({"processor": {"$regex": search}})
count = processor_search.count()
return render_template(
'search-results-processor.html',
processor_search=processor_search,
build=build,
count=count,
search=True)
@app.route('/search_build_by_processor_cooler', methods=['POST'])
def search_build_by_processor_cooler():
"""
Searches for builds containing selected option
And redirects to page showing the results
"""
build = mongo.db.build.find()
search = request.form.get('search_build_by_processor_cooler')
processor_cooler_search = mongo.db.build.find(
{"processor_cooler": {"$regex": search}})
count = processor_cooler_search.count()
return render_template(
'search-results-processor-cooler.html',
processor_cooler_search=processor_cooler_search,
build=build,
count=count,
search=True)
@app.route('/search_build_by_memory', methods=['POST'])
def search_build_by_memory():
"""
Searches for builds containing selected option
And redirects to page showing the results
"""
build = mongo.db.build.find()
search = request.form.get('search_build_by_memory')
memory_search = mongo.db.build.find({"memory": {"$regex": search}})
count = memory_search.count()
return render_template(
'search-results-memory.html',
memory_search=memory_search,
build=build,
count=count,
search=True)
@app.route('/search_build_by_graphics_card', methods=['POST'])
def search_build_by_graphics_card():
"""
Searches for builds containing selected option
And redirects to page showing the results
"""
build = mongo.db.build.find()
search = request.form.get('search_build_by_graphics_card')
graphics_card_search = mongo.db.build.find(
{"graphics_card": {"$regex": search}})
count = graphics_card_search.count()
return render_template(
'search-results-graphics-card.html',
graphics_card_search=graphics_card_search,
build=build,
count=count,
search=True)
@app.route('/search_build_by_hard_drive', methods=['POST'])
def search_build_by_hard_drive():
"""
Searches for builds containing selected option
And redirects to page showing the results
"""
build = mongo.db.build.find()
search = request.form.get('search_build_by_hard_drive')
hard_drive_search = mongo.db.build.find({"hard_drive": {"$regex": search}})
count = hard_drive_search.count()
return render_template(
'search-results-hard-drive.html',
hard_drive_search=hard_drive_search,
build=build,
count=count,
search=True)
@app.route('/search_build_by_power_supply', methods=['POST'])
def search_build_by_power_supply():
"""
Searches for builds containing selected option
And redirects to page showing the results
"""
build = mongo.db.build.find()
search = request.form.get('search_build_by_power_supply')
power_supply_search = mongo.db.build.find(
{"power_supply": {"$regex": search}})
count = power_supply_search.count()
return render_template(
'search-results-power-supply.html',
power_supply_search=power_supply_search,
build=build,
count=count,
search=True)
@app.route('/search_build_by_case', methods=['POST'])
def search_build_by_case():
"""
Searches for builds containing selected option
And redirects to page showing the results
"""
build = mongo.db.build.find()
search = request.form.get('search_build_by_case')
case_search = mongo.db.build.find({"case": {"$regex": search}})
count = case_search.count()
return render_template(
'search-results-case.html',
case_search=case_search,
build=build,
count=count,
search=True)
if __name__ == '__main__':
app.run(host=os.environ.get('IP'),
port=int(os.environ.get('PORT')),
debug=False)
|
JavaScript
|
UTF-8
| 479
| 4.09375
| 4
|
[
"MIT"
] |
permissive
|
function hoistingWithDeclaration() {
var x = 5;
var y;
console.log("x is " + x + " and y is " + y);
y = 7;
}
hoistingWithDeclaration();
function hoistingWithDeclarationAfterUse() {
var x = 5;
console.log("x is " + x + " and y is " + y);
var y = 7;
}
hoistingWithDeclarationAfterUse();
// Why is the result the same in both? x is 5 and y is undefined
// Answer: This is because the declaration of y is hoisted to the top but NOT the assignment!
|
JavaScript
|
UTF-8
| 333
| 2.578125
| 3
|
[] |
no_license
|
document.addEventListener("DOMContentLoaded", function (event) {
console.log("DOM fully loaded and parsed");
var isle = document.getElementById('islands');
var fade = document.getElementsByClassName('fade');
fade.addEventListener('mouseover', function () {
fade.style.transition = "opacity 1s";
});
});
|
C++
|
UTF-8
| 790
| 2.71875
| 3
|
[] |
no_license
|
#pragma once
#include <cstdint>
#include <cstring>
#include <vector>
#include <glm/vec2.hpp>
#include "geom.h"
struct ImageShape {
uint8_t id;
geom::Bounds<int> bounds;
ImageShape()
:id(0), bounds() {
}
ImageShape(uint8_t id, int x, int y)
:id(id), bounds(x, y) {
}
};
class ImageData {
public:
std::vector<uint8_t> rawData;
std::vector<ImageShape> shapes;
int width = 0;
int height = 0;
private:
std::vector<uint8_t> pixelShapeMap;
public:
uint32_t findShapes(uint8_t maxShapes);
int getIndex(int x, int y) const;
uint8_t getShapeID(int index) const;
uint8_t getAlpha(int index) const;
void setPixelData(int index, uint32_t value);
uint32_t getPixelData(int index);
private:
void reset();
};
|
Shell
|
UTF-8
| 1,767
| 2.6875
| 3
|
[] |
no_license
|
#!/bin/bash
outdir=outputs
mkdir $outdir
domainArray=("recipes" "housing" "basketball" "blocks" "calendar" "publications" "restaurants" "socialnetwork")
outdir1=${outdir}/out1
mkdir $outdir1
for domain in ${domainArray[*]}; do
echo $domain
python preprocess_1.py overnight-lf/ $domain $outdir1
done
java_out_dir=${outdir}/entity_normalized_out
mkdir $java_out_dir
javac OvernightEntityAnonymizer.java
java OvernightEntityAnonymizer $outdir1 $java_out_dir
final_out_dir=${outdir}/preprocessed_data
mkdir $final_out_dir
for domain in ${domainArray[*]}; do
echo $domain
python preprocess_2.py $java_out_dir $domain $final_out_dir
done
post_out_dir1=${outdir}/post11
mkdir $post_out_dir1
#python postprocess_tsv_2.py $final_out_dir $post_out_dir1
python postprocess_p4.py $final_out_dir $post_out_dir1
post_out_dir2=${outdir}/post2
mkdir $post_out_dir2
suffix1train=_train.tsv.entity.prune.txt
suffix1test=_test.tsv.entity.prune.txt
suffix2=.prune2.txt.orig1
for domain in ${domainArray[*]}; do
echo $domain
parseFile=$post_out_dir1'/'$domain$suffix1train$suffix2
parseFile_test=$post_out_dir1'/'$domain$suffix1test$suffix2
transformation_file="${java_out_dir}/${domain}_train.trans.txt"
transformation_file_test="${java_out_dir}/${domain}_test.trans.txt"
outputfile="${post_out_dir2}/${domain}_train.transout.txt"
outputfile_test="${post_out_dir2}/${domain}_test.transout.txt"
python entity_deanonymization.py $parseFile $transformation_file $outputfile 1
python entity_deanonymization.py $parseFile_test $transformation_file_test $outputfile_test 1
done
post_out_dir_final=${outdir}/postprocessed_final
mkdir $post_out_dir_final
python postprocess_tsv_1.py $post_out_dir2 $post_out_dir_final
|
C++
|
UTF-8
| 465
| 2.625
| 3
|
[] |
no_license
|
#include "Reboot_to_boot.h"
// the setup function runs once when you press reset or power the board
void setup() {
//reboot_setup(int delay, char pin, char flag).delay is the timer timeout for reboot,pin is which pin is for LED to set ,flag is for selecting/unselecting led functionality.
// timer timeout for delay of 10 is 2.4 sec.
reboot_setup(20,1,1);
}
// the loop function runs over and over again forever
void loop() {
delay(1000);
}
|
SQL
|
UTF-8
| 868
| 3.09375
| 3
|
[] |
no_license
|
USE Employees
DELETE FROM dbo.Employees
DELETE FROM dbo.Shifts
DELETE FROM dbo.Countries
DBCC CHECKIDENT ('Employees.dbo.Employees',RESEED, 0)
DBCC CHECKIDENT ('Employees.dbo.Shifts',RESEED, 0)
DBCC CHECKIDENT ('Employees.dbo.Countries',RESEED, 0)
INSERT INTO dbo.Shifts
VALUES ('Morning',9,16)
INSERT INTO dbo.Shifts
VALUES ('Afternoon',16,0)
INSERT INTO dbo.Shifts
VALUES ('Night',0,9)
INSERT INTO dbo.Countries
values ('Argentina')
INSERT INTO dbo.Countries
values ('Brasil')
INSERT INTO dbo.Countries
values ('United States')
INSERT INTO dbo.Employees
VALUES ('Bruce','Willis','2015-12-02 0:0:0',150,1,1)
INSERT INTO dbo.Employees
VALUES ('Sylvester','Stallone','2015-06-10 0:0:0',250,2,1)
INSERT INTO dbo.Employees
VALUES ('Jason','Statham','2014-04-05 0:0:0',125,3,3)
INSERT INTO dbo.Employees
VALUES ('Mel','Gibson','2016-07-21 0:0:0',180,3,2)
|
JavaScript
|
UTF-8
| 5,311
| 2.859375
| 3
|
[] |
no_license
|
const HEADERS = {
'Content-Type': 'application/json;charset=utf-8',
'Access-Control-Allow-Origin': '*'
};
const whereSpentInput = document.getElementById('where-spent');
const howMuchSpentInput = document.getElementById('how-much-spent');
const buttonAddEl = document.getElementById('button-add-el');
const mainList = document.getElementById('main-list');
const total = document.getElementById('total');
let items;
const render = collection => {
mainList.innerHTML = '';
collection.forEach(item => {
const li = document.createElement('li');
let whereSpentSpan;
if (item.isWhereEdit) {
whereSpentSpan = document.createElement('input');
whereSpentSpan.value = item.whereSpent;
whereSpentSpan.addEventListener("keyup", (e) => onChangeTarget(e, item));
whereSpentSpan.addEventListener("blur", (e) => editTarget(e, item));
window.setTimeout(() => whereSpentSpan.focus(), 0);
} else {
whereSpentSpan = document.createElement('span');
whereSpentSpan.setAttribute('title', item.whereSpent)
whereSpentSpan.innerHTML = item.whereSpent;
whereSpentSpan.addEventListener('dblclick', () => onDblClickWhere(item))
}
let howMuchSpentSpan;
if (item.isHowMuchEdit) {
howMuchSpentSpan = document.createElement('input');
howMuchSpentSpan.setAttribute('type', 'number');
howMuchSpentSpan.value = item.howMuchSpent;
howMuchSpentSpan.addEventListener("keyup", (e) => onChangeTarget(e, item));
howMuchSpentSpan.addEventListener("blur", (e) => editTarget(e, item));
window.setTimeout(() => howMuchSpentSpan.focus(), 0);
} else {
howMuchSpentSpan = document.createElement('span');
howMuchSpentSpan.setAttribute('title', item.howMuchSpent)
howMuchSpentSpan.innerHTML = `${item.howMuchSpent} p.`;
howMuchSpentSpan.addEventListener('dblclick', () => onDblClickHowMuch(item))
}
const buttonEdit = document.createElement('button');
const buttonDelete = document.createElement('button');
buttonEdit.className = 'edit';
buttonDelete.className = 'delete';
mainList.appendChild(li);
li.appendChild(whereSpentSpan);
li.appendChild(howMuchSpentSpan);
li.appendChild(buttonEdit);
li.appendChild(buttonDelete);
buttonEdit.addEventListener('click', () => onBtnEditClick(item));
buttonDelete.addEventListener('click', () => onBtnDeleteClick(item));
});
}
const request = async (url, method, headers, body) => {
const resp = await fetch(url,
{
method: method,
headers: headers,
body: JSON.stringify(body)
});
items = await resp.json();
total.innerHTML = `Итого: ${items.total} p.`;
render(items.body);
}
window.onload = async () => {
await request('http://localhost:8000/', 'GET');
}
const onBtnAddClick = async () => {
if (whereSpentInput.value && howMuchSpentInput.value && typeof +howMuchSpentInput.value === 'number') {
await request(
'http://localhost:8000/createNewItem',
'POST',
HEADERS,
{
whereSpent: whereSpentInput.value,
howMuchSpent: howMuchSpentInput.value
})
whereSpentInput.value = '';
howMuchSpentInput.value = '';
}
}
let btnAddOrSave = onBtnAddClick;
const onClickAddOrSave = async () => {
await btnAddOrSave();
}
buttonAddEl.addEventListener('click', () => onClickAddOrSave());
const onBtnEditClick = item => {
whereSpentInput.value = item.whereSpent;
howMuchSpentInput.value = item.howMuchSpent;
buttonAddEl.innerHTML = 'Сохранить';
btnAddOrSave = () => editItem(item);
}
const editItem = async item => {
if (whereSpentInput.value && howMuchSpentInput.value && typeof +howMuchSpentInput.value === 'number') {
const itemId = item._id;
await request(
'http://localhost:8000/updateItem',
'PATCH',
HEADERS,
{
_id: itemId,
whereSpent: whereSpentInput.value,
howMuchSpent: howMuchSpentInput.value
}
)
buttonAddEl.innerHTML = 'Добавить';
btnAddOrSave = onBtnAddClick;
whereSpentInput.value = '';
howMuchSpentInput.value = '';
}
}
const onBtnDeleteClick = async item => {
const itemId = item._id;
await request(
`http://localhost:8000/deleteItem?id=${itemId}`,
'DELETE',
HEADERS,
)
}
function onDblClickWhere(item) {
item.isWhereEdit = true;
render(items.body)
}
function onDblClickHowMuch(item) {
item.isHowMuchEdit = true;
render(items.body)
}
async function onChangeTarget(e, item) {
e.preventDefault();
if (e.keyCode === 13) {
await editTarget(e, item);
}
}
async function editTarget(e, item) {
if (item.isWhereEdit) {
item.isWhereEdit = false;
const itemId = item._id;
await request(
'http://localhost:8000/updateItem',
'PATCH',
HEADERS,
{
_id: itemId,
whereSpent: e.target.value
}
)
} else {
if (e.target.value && typeof +e.target.value === 'number') {
item.isHowMuchEdit = false;
const itemId = item._id;
await request(
'http://localhost:8000/updateItem',
'PATCH',
HEADERS,
{
_id: itemId,
howMuchSpent: e.target.value
}
)
}
}
}
|
TypeScript
|
UTF-8
| 1,481
| 2.5625
| 3
|
[] |
no_license
|
import { Component, OnInit } from '@angular/core';
import { ConfigService } from './config.service';
import { HttpHeaders, HttpParams } from '@angular/common/http';
@Component({
selector: 'app-config',
templateUrl: './config.component.html',
styleUrls: ['./config.component.css']
})
export interface Config {
heroesUrl: string;
textfile: string;
date: any;
}
export class ConfigComponent implements OnInit {
constructor(private configService: ConfigService) { }
config?: Config;
showConfig() {
this.configService.getConfig()
.subscribe((data: Config) => this.config = {
heroesUrl: data.heroesUrl,
textfile: data.textfile,
date: data.date,
});
}
ngOnInit(): void {
}
options?: {
headers?: HttpHeaders | {[header: string]: string | string[]},
observe?: 'body' | 'events' | 'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
}
showConfigResponse() {
this.configService.getConfigResponse()
// resp is of type `HttpResponse<Config>`
.subscribe(resp => {
// display its headers
const keys = resp.headers.keys();
this.headers = keys.map(key =>
`${key}: ${resp.headers.get(key)}`);
// access the body directly, which is typed as `Config`.
this.config = { ... resp.body };
});
}
}
|
Python
|
UTF-8
| 4,821
| 2.75
| 3
|
[
"MIT"
] |
permissive
|
import paramiko
import time
from optparse import OptionParser
# Option Parer Menu
parser = OptionParser(usage="useage: %prog -o (check|assign) -H (IP Address) -u (Username) -p (Password) -x (Port) -n (VLAN Number)",
version="VLAN Swap 1.0")
parser.add_option("-o", "--option",
action="store",
dest="option",
help="Select (assign|check) depending if you are assigning or checking a port's vlan.")
parser.add_option("-H", "--hostname",
action="store",
dest="ipAddr",
help="Enter the IP Address or Hostname of the switch.")
parser.add_option("-u", "--username",
action="store",
dest="username",
help="Enter the username for the SSH connection to the switch.")
parser.add_option("-p", "--password",
action="store",
dest="password",
help="Enter the password for the SSH connection to the switch.")
parser.add_option("-x", "--port",
action="store",
dest="switchPort",
help="Enter the port of the switch. i.e. FastEthernet0/1")
parser.add_option("-n", "--vlan-number",
action="store",
dest="switchVLAN",
help="Enter the VLAN number of the switch. i.e. '30'")
parser.add_option("-s", "--speed",
action="store",
dest="portSpeed",
help="Enter the speed for the port. Options: (100|1000|auto)")
parser.add_option("-d", "--duplex",
action="store",
dest="portDuplex",
help="Enter the duplex for the port. Options: (half|full|auto)")
(options, args) = parser.parse_args()
class Port(object):
def __init__(self, port, vlan, speed, duplex):
self.port = port
self.vlan = vlan
self.speed = speed
self.duplex = duplex
def check(self):
remote_conn.send("\n")
remote_conn.send("show interface " + self.port + " status\n")
def focus(self):
remote_conn.send("\n")
remote_conn.send("configure terminal\n")
remote_conn.send("interface " + self.port + "\n")
def assignVLAN(self):
remote_conn.send("switchport access vlan " + self.vlan + "\n")
remote_conn.send("spanning-tree portfast\n")
def assignSpeed(self):
remote_conn.send("speed " + self.speed + "\n")
def assignDuplex(self):
remote_conn.send("duplex " + self.duplex + "\n")
def disable_paging(remote_conn):
# Disable paging on a Cisco router
remote_conn.send("terminal length 0\n")
time.sleep(1)
# Clear the buffer on the screen
output = remote_conn.recv(1000)
return output
if __name__ == '__main__':
# VARIABLES THAT NEED CHANGED
option = options.option
ip = options.ipAddr
username = options.username
password = options.password
switchPort = options.switchPort
vlanNumber = options.switchVLAN
speed = options.portSpeed
duplex = options.portDuplex
# Variable for the Port class
port = Port(switchPort, vlanNumber, speed, duplex)
# Create instance of SSHClient object
remote_conn_pre = paramiko.SSHClient()
# Automatically add untrusted hosts (make sure okay for security policy in your environment)
remote_conn_pre.set_missing_host_key_policy(
paramiko.AutoAddPolicy())
# initiate SSH connection
remote_conn_pre.connect(ip, username=username, password=password, look_for_keys=False, allow_agent=False)
print("SSH connection established to %s" %ip)
# Use invoke_shell to establish an 'interactive session'
remote_conn = remote_conn_pre.invoke_shell()
print("Interactive SSH session established")
# Strip the initial router prompt
output = remote_conn.recv(1000)
# See what we have
print(output)
# Turn off paging
disable_paging(remote_conn)
# Now let's try to send the router a command
if option == "check":
port.check()
elif option == "assign":
if vlanNumber != None or speed != None or duplex != None:
port.focus()
if vlanNumber != None:
port.assignVLAN()
if speed != None:
port.assignSpeed()
if duplex != None:
port.assignDuplex()
else:
print ("Nothing was selected to assign. Choose a VLAN number, port speed, or port duplex option.")
remote_conn_pre.close()
else:
print("Unknown -o switch option. Use the -h switch to see additionl help on the script.")
# Wait for the command to complete
time.sleep(2)
output = remote_conn.recv(5000)
print(output)
|
PHP
|
UTF-8
| 3,243
| 2.625
| 3
|
[] |
no_license
|
<?php
namespace tests\unit\models;
use app\models\ArraySplit;
use app\models\User;
class ArraySplitTest extends \Codeception\Test\Unit
{
public function testCanSplitArray()
{
$this->assertEquals(
4,
ArraySplit::getSplitIndex(5, [5, 5, 1, 7, 2, 3, 5]));
$this->assertEquals(
3,
ArraySplit::getSplitIndex(1, [1, 1, 1, 0, 0, 0]));
$this->assertEquals(
3,
ArraySplit::getSplitIndex(1, [0, 0, 0, 1, 1, 1]));
$this->assertEquals(
3,
ArraySplit::getSplitIndex(1, [1, 0, 1, 0, 1, 0]));
$this->assertEquals(
5,
ArraySplit::getSplitIndex(1, [1, 1, 0, 0, 0, 0, 0]));
$this->assertEquals(
2,
ArraySplit::getSplitIndex(1, [1, 1, 1, 1, 1, 0, 0]));
}
public function testCanDetermineUnsplitableArrays()
{
$this->assertEquals(
-1,
ArraySplit::getSplitIndex(1, [1, 1, 1, 1, 1, 1, 1]));
$this->assertEquals(
-1,
ArraySplit::getSplitIndex(1, [0, 0, 0, 0, 0, 0, 0]));
$this->assertEquals(
-1,
ArraySplit::getSplitIndex(1, [1]));
$this->assertEquals(
-1,
ArraySplit::getSplitIndex(1, [0]));
$this->assertEquals(
-1,
ArraySplit::getSplitIndex(1, []));
}
public function testCanCreateRecords()
{
$split = new ArraySplit();
$split->user_id = 1;
$split->number_n = 1;
$split->array = [1,1,1,0,0,0];
$split->split_index = 3;
$split->save();
$new = ArraySplit::findOne(['user_id' => 1]);
$this->assertEquals([1,1,1,0,0,0], $new->array);
$this->assertEquals(1, $new->number_n);
}
public function testCanValidateFields()
{
$split = new ArraySplit();
$split->number_n = 1;
$this->assertTrue($split->validate(['number_n']));
$split->number_n = -1;
$this->assertTrue($split->validate(['number_n']));
$split->number_n = 1000000000;
$this->assertTrue($split->validate(['number_n']));
$split->number_n = 'fds';
$this->assertFalse($split->validate(['number_n']));
$split->array = [1,2,3,4];
$this->assertTrue($split->validate(['array']));
$split->array = [1];
$this->assertTrue($split->validate(['array']));
$split->array = [];
$this->assertTrue($split->validate(['array']));
$split->array = '1234';
$this->assertFalse($split->validate(['array']));
$split->array = [1,'two',3,4];
$this->assertFalse($split->validate(['array']));
$split->array = [1,[2,3],4,5];
$this->assertFalse($split->validate(['array']));
}
public function testCanCreateNewSplit()
{
$user = User::findOne(['access_token' => '00000000000000000000000000000000']);
$split = ArraySplit::createSplit($user, 1, [1,1,1,0,0,0]);
$this->assertInstanceOf(ArraySplit::class, $split);
$this->assertEquals($user->id, $split->user_id);
$this->assertEquals(3, $split->split_index);
$this->assertTrue($split->save());
}
}
|
PHP
|
UTF-8
| 1,779
| 2.734375
| 3
|
[] |
no_license
|
<?php
namespace Chatbox\ApiAuth\Http\Controllers;
use Chatbox\ApiAuth\Domains\User;
use Chatbox\ApiAuth\Domains\UserServiceInterface;
use Chatbox\ApiAuth\Http\AuthRequest;
use Chatbox\ApiAuth\Http\Request\AuthToken;
use Chatbox\ApiAuth\Http\Request\ProfileForRegister;
use Chatbox\ApiAuth\Http\Request\ProfileForUpdate;
use Chatbox\ApiAuth\Http\Service\HttpProfileService;
/**
* Created by PhpStorm.
* User: mkkn
* Date: 2016/06/17
* Time: 14:42
*/
class ProfileController
{
protected $service;
protected $token;
/**
* ProfileController constructor.
* @param $request
* @param $service
*/
public function __construct(
UserServiceInterface $service,
AuthToken $token
){
$this->service = $service;
$this->token = $token;
}
public function create(ProfileForRegister $profile)
{
$user = $profile->get();
$user = $this->service->registerProfile($user);
return [
"user" => $user
];
}
public function load(AuthToken $token){
$user = $this->unpackToken();
$user = $this->service->loadProfileById($user->userId);
return [
"user" => $user
];
}
public function update(ProfileForUpdate $profile){
$user = $this->unpackToken();
$userData = $profile->get();
$user = $this->service->updateProfile($user->userId,$userData);
return [
"user" => $user
];
}
public function ban(){
$user = $this->unpackToken();
$user = $this->service->deleteProfile($user->userId);
return [
"user" => $user
];
}
protected function unpackToken():User{
return $this->token->getUser();
}
}
|
PHP
|
UTF-8
| 1,492
| 2.828125
| 3
|
[] |
no_license
|
<?php
include_once '../abstract/Abstrata.php';
include_once '../iCRUD/iCRUD.php';
class Foto extends Abstrata implements iCRUD {
//CRIANDO OS ATRUBUTOS
private $id;
private $nome;
private $foto;
function getId() {
return $this->id;
}
function getNome() {
return $this->nome;
}
function setId($id) {
$this->id = $id;
}
function setNome($nome) {
$this->nome = $nome;
}
function getFoto() {
return $this->foto;
}
function setFoto($foto) {
$this->foto = $foto;
}
public function alterar() {
}
public function cadastrar() {
$pdo = parent::getDB();
try {
$cadastrar = $pdo->prepare("INSERT INTO foto(nome, foto) VALUES(?,?)");
$cadastrar->bindParam(1, $this->getNome());
$cadastrar->bindParam(2, $this->getFoto());
$cadastrar->execute();
if ($cadastrar->rowCount() == 1):
return true;
else:
$this->setErro("Erro ao cadastrar cliente !");
endif;
} catch (PDOException $e) {
echo $e->getMessage();
} finally {
}
}
public function deletar() {
parent::deletar();
}
public function listar() {
parent::$tabela = "foto";
return parent::listar();
}
}
|
Python
|
UTF-8
| 1,414
| 2.90625
| 3
|
[] |
no_license
|
import copy
import re
def parse(line):
m = re.findall(r"\<([0-9,-]+)\>", line)
p, v, a = map(lambda x: [int(k) for k in x.split(",")], m)
return [p, v, a]
def step(particle):
particle[1][0] += particle[2][0]
particle[1][1] += particle[2][1]
particle[1][2] += particle[2][2]
particle[0][0] += particle[1][0]
particle[0][1] += particle[1][1]
particle[0][2] += particle[1][2]
return particle
def dist_from_origin(particle):
return abs(particle[0][0]) + abs(particle[0][1]) + abs(particle[0][2])
def main(input_file):
with open(input_file) as f:
particles = [parse(line.strip()) for line in f.readlines()]
collisions = copy.deepcopy(particles)
for _ in range(1000):
for i in range(len(particles)):
particles[i] = step(particles[i])
for _ in range(100):
for i in range(len(collisions)):
collisions[i] = step(collisions[i])
removes = []
for particle in collisions:
c = [p for p in collisions if p[0] == particle[0]]
if len(c) > 1:
for p in c:
removes.append(p)
for r in removes:
try: collisions.remove(r)
except ValueError: pass
dists = [dist_from_origin(particle) for particle in particles]
closest = dists.index(min(dists))
return {"part1": closest, "part2": len(collisions)}
|
C++
|
UTF-8
| 555
| 2.765625
| 3
|
[] |
no_license
|
#pragma once
#include <iostream>
#include <string>
using namespace std;
#include <iomanip>
#include "vehicle.h"
vehicle::vehicle
(int myr, string mname, int ntires){
model_year = myr;
model_name = mname;
num_of_tires = ntires;
}
void vehicle::init_class_vars(
int myear, string mname, int ntires){
model_year = myear;
model_name = mname;
num_of_tires = ntires;
}
int vehicle::getModelYear(){
return model_year;
}
string vehicle::getModelName(){
return model_name;
}
int vehicle::getTireNum(){
return num_of_tires;
}
|
Java
|
UTF-8
| 3,125
| 2.453125
| 2
|
[] |
no_license
|
package com.example.tradestorage;
import java.time.LocalDate;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import com.example.tradestorage.controller.TradeStorageController;
import com.example.tradestorage.exception.InvalidTradeException;
import com.example.tradestorage.model.Trade;
@SpringBootTest
public class TradeStorageSolutionApplicationTests {
@Test
void contextLoads() {
}
@Autowired
private TradeStorageController tradeStorageController;
@Test
void testSaveTradeForSuccessful() {
String responseEntity = tradeStorageController.saveTrade(createTrade("T3", 2, "CP-3","B3",LocalDate.now().plusDays(3),LocalDate.now()));
Assertions.assertEquals("Trade T3 store successfully in database!!!!", responseEntity);
}
@Test
void testSaveTradeForPastMaturityDate() {
try {
tradeStorageController.saveTrade(createTrade("T2", 1, "CP-2","B2",LocalDate.now().minusDays(3),LocalDate.now()));
} catch (InvalidTradeException ie) {
Assertions.assertEquals("Maturity date for T2 is before today's Date", ie.getMessage());
Assertions.assertEquals("BU102", ie.getErrorCode());
}
}
@Test
void testTradeValidateAndStoreWhenOldVersion() {
String responseEntity = tradeStorageController.saveTrade(createTrade("T1", 2, "CP-1","B1",LocalDate.now().plusDays(3),LocalDate.now()));
Assertions.assertEquals("Trade T1 store successfully in database!!!!", responseEntity);
try {
tradeStorageController.saveTrade(createTrade("T1", 1, "CP-1","B1",LocalDate.now().plusDays(3),LocalDate.now()));
} catch (InvalidTradeException e) {
Assertions.assertEquals("Lower version is received for T1 than existing.", e.getMessage());
Assertions.assertEquals("BU101", e.getErrorCode());
}
}
@Test
void testSaveTradeOverwrite() {
String responseEntity = tradeStorageController.saveTrade(createTrade("T1", 2, "CP-1","B1",LocalDate.now().plusDays(3),LocalDate.now()));
Assertions.assertEquals("Trade T1 store successfully in database!!!!", responseEntity);
Trade trade2 = createTrade("T1", 3, "CP-1","B1",LocalDate.now().plusDays(3),LocalDate.now());
trade2.setBookId("B2");
String responseEntity2 = tradeStorageController.saveTrade(trade2);
Assertions.assertEquals("Trade T1 store successfully in database!!!!", responseEntity2);
List<Trade> tradeList2 = tradeStorageController.findAllTrades();
Assertions.assertEquals("T1", tradeList2.get(0).getTradeId());
Assertions.assertEquals(3, tradeList2.get(0).getVersion());
Assertions.assertEquals("B2", tradeList2.get(0).getBookId());
}
private Trade createTrade(String tradeId, int version, String counterPartyId,String bookId,LocalDate maturityDate,LocalDate createdDate) {
Trade trade = new Trade();
trade.setTradeId(tradeId);
trade.setVersion(version);
trade.setCounterPartyId(counterPartyId);
trade.setBookId(bookId);
trade.setMaturityDate(maturityDate);
trade.setMaturityDate(createdDate);
trade.setExpired("N");
return trade;
}
}
|
JavaScript
|
UTF-8
| 3,345
| 2.859375
| 3
|
[] |
no_license
|
const Command = require('../commands.js').Command;
const Discord = require('discord.js');
module.exports = class Admin extends Command {
/**
* @param {string} prefix: the prefix for this instance
*/
constructor(prefix) {
let hooks = ["admin", "admins"];
super(prefix, hooks);
this.name = "Admin"; // File should be called _ExampleCommand.js
this.hooks = hooks;
this.help = {
// What the command does
description: "Manages admins",
// How users invoke it. Will be printed on a stub (but not full) match.
usage: `${prefix}admin list | add/remove @user`,
// in-depth explanation of the command and any options. Will be printed on !help <name>
text: `List: shows all admins for this server.\nAdd/remove @user: sets @user as an admin for this server (mention them for it to work)`
};
this.requiresLib = ["admin"];
this.requiresDB = ["admins"];
// and you can have your own init code here too
this.matchesRegex = new RegExp(`${this.stubRegex.source}\\s+(?:(list)|(add|remove)\\s+<@(\\d+)>\\s*)$`,'i');
}
/**
* Checks if the input matches your command (fully). If not, commands.js will reply with `help.usage`. If this is not present then if your message starts with the prefix followed by a hook, your command matches.
* @param {String} message: the message text
* @return {Boolean}: true if this message does match fully and exec() should be called, false otherwise
*/
matches(message) {
return this.matchesRegex.test(message);
}
/**
* Run your command here.
* @param {Message} message: the message that triggered this command
* @param {Discord.Client} client: the client that this bot is running on
* @param {Object} obj: Various scope passed between commands. Includes obj.db for databases
*/
exec(message, client, obj) {
let match = this.matchesRegex.exec(message);
if(match[1] && match[1].toLowerCase() === "list") {
obj.lib.admin.getAdmins(obj, message.guild).then(admins => {
const embed = new Discord.RichEmbed()
.setTitle(`Admins for ${message.guild.name}:`)
.setDescription(admins.map(gm => `**${gm.displayName}** (${gm.user.username}#${gm.user.discriminator})`).join("\n"))
message.channel.send({embed});
})
}
else {
obj.lib.admin.isAdmin(obj, message.guild, message.member).then(isAdmin => {
if(isAdmin) {
let value = match[2].toLowerCase() === "add";
let id = match[3];
obj.lib.admin.setAdmin(obj, message.guild, id, value).then(() => {
message.react(`✅`);
}).catch((err) => {
const embed = new Discord.RichEmbed()
.setColor("#ff0000")
.setTitle("An error occurred")
.setDescription("```" + err + "```");
message.channel.send({embed});
})
}
else {
message.channel.send(`You must be an admin in order to add other people as admins!\nSee the list of admins with \`${this.prefix}admin list\`.`);
}
})
}
}
}
|
Markdown
|
UTF-8
| 969
| 2.78125
| 3
|
[
"MIT"
] |
permissive
|
# Avatar Creator
## Aim/Purpose
To make our own customised avtaar
## Short description of package/script
- Here using the library for avatar we can customize each and every thing from background to face parts.Here we can select the background colour and shape then for face parts we can choose shapes of nose, eyes , mouth,eyebrows all the things.We can also have sunglasses ,hat ,hoodie ,etc. all as extraa accessories.
- List out the libraries imported ->python_avatars
## Workflow of the Project
Here we make avtaar as per our wish so for that we have to choose a particular thing for each of the face parts and background.So select as per wish and then run the script so the avtaar will be created
.
## Setup instructions
First install the library then run the script after selcting all the things for avtaar and then the avtaar will be created.
## Output
.png)
.png)
## Author(s)
Neel Shah
|
Markdown
|
UTF-8
| 2,764
| 2.625
| 3
|
[
"CC-BY-4.0",
"MIT"
] |
permissive
|
---
title: パック() - Azure データ エクスプローラー |マイクロソフトドキュメント
description: この記事では、Azure データ エクスプローラーでの pack() について説明します。
services: data-explorer
author: orspod
ms.author: orspodek
ms.reviewer: rkarlin
ms.service: data-explorer
ms.topic: reference
ms.date: 02/13/2020
ms.openlocfilehash: a7b43be96f272ab929434f10cac910bd4072e650
ms.sourcegitcommit: 47a002b7032a05ef67c4e5e12de7720062645e9e
ms.translationtype: MT
ms.contentlocale: ja-JP
ms.lasthandoff: 04/15/2020
ms.locfileid: "81511834"
---
# <a name="pack"></a>pack()
名前と`dynamic`値のリストからオブジェクト (プロパティ バッグ) を作成します。
エイリアスを`pack_dictionary()`使用して機能します。
**構文**
`pack(`*キー1*`,`*値1*`,`*キー2*`,`*値2*`,... )`
**引数**
* キーと値の交互のリスト (リストの全長は偶数である必要があります)
* すべてのキーは空でない定数文字列でなければなりません
**使用例**
次の例は、 `{"Level":"Information","ProcessID":1234,"Data":{"url":"www.bing.com"}}`を返します。
```kusto
pack("Level", "Information", "ProcessID", 1234, "Data", pack("url", "www.bing.com"))
```
2つのテーブル、SmsMessagesとMmsMessagesを取ることができます:
テーブル Sms メッセージ
|ソース番号 |ターゲット番号| 文字数
|---|---|---
|555-555-1234 |555-555-1212 | 46
|555-555-1234 |555-555-1213 | 50
|555-555-1212 |555-555-1234 | 32
テーブル Mms メッセージ
|ソース番号 |ターゲット番号| アタッシェムネットサイズ | アタッシェネットタイプ | アタッシェネット名
|---|---|---|---|---
|555-555-1212 |555-555-1213 | 200 | JPEG | ピック1
|555-555-1234 |555-555-1212 | 250 | JPEG | ピック2
|555-555-1234 |555-555-1213 | 300 | png | ピック3
次のクエリ:
```kusto
SmsMessages
| extend Packed=pack("CharsCount", CharsCount)
| union withsource=TableName kind=inner
( MmsMessages
| extend Packed=pack("AttachmnetSize", AttachmnetSize, "AttachmnetType", AttachmnetType, "AttachmnetName", AttachmnetName))
| where SourceNumber == "555-555-1234"
```
戻り値:
|TableName |ソース番号 |ターゲット番号 | パック
|---|---|---|---
|メッセージ|555-555-1234 |555-555-1212 | {"文字数": 46}
|メッセージ|555-555-1234 |555-555-1213 | {"文字数": 50}
|メッセージ|555-555-1234 |555-555-1212 | {"添付ネットサイズ": 250, "添付ネットタイプ": "jpeg", "アタッシェネット名": "Pic2"}
|メッセージ|555-555-1234 |555-555-1213 | {"添付ネットサイズ": 300, "添付ネットタイプ": "png", "アクトネット名": "Pic3"}
|
PHP
|
UTF-8
| 4,063
| 2.515625
| 3
|
[] |
no_license
|
<?php
namespace Scoris\Contact\Repositories\Eloquent;
use Scoris\Contact\Repositories\Interfaces\ContactCategoryInterface;
use Scoris\Support\Repositories\Eloquent\RepositoriesAbstract;
use Scoris\Contact\Models\ContactCategoryParent;
use Scoris\Contact\Models\ContactCategory;
class ContactCategoryRepository extends RepositoriesAbstract implements ContactCategoryInterface
{
public function index()
{
$contact_category_parent = ContactCategoryParent::get();
$tmp = [];
foreach($contact_category_parent as $k => $v)
{
$tmp[] = ContactCategory::where('id', $v->child_id)->get();
}
return response()->json([
'status' => true,
'code' => 0,
'data' => $contact_category_parent,
$tmp,
'message' => "success"
]);
}
public function store($request)
{
$validator = \Validator::make($request->all(), [
'name_vi' => 'required|min:6|max:100',
]);
if ($validator->fails()) {
return response()->json([
'status' => false,
'code' => 707,
'data' => [],
'message' => $validator->errors()
]);
}
$input = $request->except('token', 'parent_id');
$input['users_id'] = auth()->id();
$name_en = isset($input['name_en']) ? $input['name_en'] : '';
$description = isset($input['description']) ? $input['description'] : '';
$find_raw = $input['name_vi'].' '.$name_en.' '.$description;
$input['find_raw'] = strtolower($this->stripUnicode($find_raw));
# return var_dump(explode(' ', $input['description']));
$input['name_vi'] = xss_cleaner($request->name_vi);
$contact_category = ContactCategory::create($input);
$contact_category_parent = [];
$count = isset($request->parent_id) ? count($request->parent_id) : 0;
if($count == 0)
{
$contact_category_parent['child_id'] = $contact_category->id;
$contact_category_parent['parent_id'] = 0;
ContactCategoryParent::create($contact_category_parent);
}else{
foreach($request->parent_id as $k => $v)
{
$contact_category_parent['child_id'] = $contact_category->id;
$contact_category_parent['parent_id'] = $v;
ContactCategoryParent::create($contact_category_parent);
}
}
return response()->json([
'status' => true,
'code' => 0,
'data' => $contact_category,
'message' => "success"
], 200);
}
function stripUnicode($str)
{
if(!$str) return false;
$unicode = array(
'a'=>'á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ|Á|À|Ả|Ã|Ạ|Ă|Ắ|Ặ|Ằ|Ẳ|Ẵ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ',
'd'=>'đ|Đ',
'e'=>'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ|É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ',
'i'=>'í|ì|ỉ|ĩ|ị|Í|Ì|Ỉ|Ĩ|Ị',
'o'=>'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ|Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ',
'u'=>'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự|Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự',
'y'=>'ý|ỳ|ỷ|ỹ|ỵ|Ý|Ỳ|Ỷ|Ỹ|Ỵ',
);
foreach($unicode as $nonUnicode=>$uni) $str = preg_replace("/($uni)/i",$nonUnicode,$str);
return $str;
}
public function delete($id)
{
$contact_category_parent = ContactCategoryParent::where('parent_id', $id)->get();
ContactCategoryParent::where('parent_id', $id)->delete();
foreach($contact_category_parent as $k => $v)
{
$this->delete($v->child_id);
}
return response()->json([
'status' => true,
'code' => 0,
'data' => [],
'message' => "success"
], 200);
}
}
|
C
|
UTF-8
| 3,003
| 2.9375
| 3
|
[] |
no_license
|
#include<stdio.h>
#define ll long long int
#define get(n) ll n; if(scanf("%lld", &n))
#define gets(n) char n ; if(scanf("%c", &n))
#define show(n) printf("%lld\n", n)
#define shows(n) printf("%c\n",n)
#define loop(a,b) for( int i=a ; i<b ; i++)
#define eloop(a,b) for(int i=a ; i<=b ; i++)
void merge(ll arr[] , ll arr2[], ll left, ll mid, ll right)
{
ll n1 = mid-left + 1;
ll n2 = right-mid;
ll l[n1], l2[n1],r2[n2] , r[n2];
for(ll i = 0 ; i<n1 ;i++)
{
l[i] = arr[left+i];
l2[i]= arr2[left+i];
}
for(ll i = 0 ; i<n2 ; i++)
{
r[i] = arr[mid+1+i];
r2[i] = arr2[mid+1+i];
}
ll k = left, i=0, j=0;
while(i<n1 && j<n2)
{
if(l[i] < r[j])
{
arr[k] = l[i];
arr2[k++] = l2[i++];
}
else if(r[j] < l[i])
{
arr[k] = r[j];
arr2[k++] = r2[j++];
}
else if(l[i] == r[j])
{
if(l2[i] < r2[j])
{
arr[k] = l[i];
arr2[k++] = l2[i++];
}
else
{
arr[k] = r[j];
arr2[k++] = r2[j++];
}
}
}
while(i<n1)
{
arr[k] = l[i];
arr2[k++] = l2[i++];
}
while(j<n2)
{
arr[k] = r[j];
arr2[k++] = r2[j++];
}
return;
}
void mergesort( ll arr[], ll arr2[], ll left, ll right)
{
if(left < right)
{
ll mid = (left + right)/2;
mergesort(arr, arr2 , left , mid);
mergesort(arr, arr2 , mid+1, right);
merge(arr, arr2, left , mid, right);
}
return ;
}
ll p_garb[1000006], q_garb[1000006];
ll p[1000006], q[1000006];
ll calc(ll n)
{
if(n<3)return 0;
ll ans = 1;
ans = (n*(n-1))/2;
ans *= n-2;
ans /= 3;
return ans;
}
int main()
{
get(n);
get(mod);
for (ll i = 0; i < n; ++i)
{
get(pi);
get(qi);
p_garb[i] = pi;
q_garb[i] = qi;
}
mergesort( p_garb, q_garb, 0, n-1);
//now i have the list of all the points in sorted order
//now i will traverse it to find all the unique points;
p[0] = p_garb[0];
q[0] = q_garb[0];
ll temp = 1, count =1 ;
for(ll i=1 ; i<n ; i++)
{
if(p_garb[i] == p_garb[i-1] && q_garb[i] == q_garb[i-1])continue;
//else
count++;
p[temp] = p_garb[i];
q[temp++] = q_garb[i];
}
//for(int i =0 ; i<count ; i++)
// printf("%lld %lld\n",p[i], q[i]);
// now I have all the unique points and the thing is sorted;
//printf("numebr of distinct points is %lld\n", count);
ll ans = 0;
ans += calc(count);
//printf("intial Nc3 is %lld\n",ans );
for(ll i = 0 ; i<count ; i++)
{
ll c = 1;
ll temp = p[i];
while(p[i+1] == temp && i<count)
{
c++;
i++;
}
//printf("number of points on the line x = %lld is %lld\n", temp , c );
temp = calc(c);
ans -= temp;
//printf("modified ans is %lld\n", ans );
}
mergesort(q, p, 0, count -1);
for(ll i =0 ; i<count ; i++)
{
ll c = 1;
ll temp = q[i];
while(q[i+1] == temp && i<count)
{
c++;
i++;
}
//printf("the number of points on the line y = %lld is %lld\n",temp , c );
temp = calc(c);
ans -= temp;
//printf("modified ans is %lld\n", ans );
}
printf("%lld\n", ans%mod);
return 0;
}
|
Shell
|
UTF-8
| 1,503
| 2.84375
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
PATH='/opt/conda/bin:/opt/conda/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
if [ ! -d "imgs" ]; then
# get celeba data
DEBIAN_FRONTEND=noninteractive apt-get -yq update
DEBIAN_FRONTEND=noninteractive apt-get -yq install wget unzip git
echo "getting data"
wget --quiet --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1g9tAydWEN0PW-BYxdhNuGG9vXrdNzffA' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1g9tAydWEN0PW-BYxdhNuGG9vXrdNzffA" -O img_align_celeba.zip && rm -rf /tmp/cookies.txt
unzip -q img_align_celeba.zip -d imgs
# install apex
git clone https://github.com/NVIDIA/apex.git
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./apex
# get FID calculation library
git clone https://github.com/mseitzer/pytorch-fid.git
mv pytorch-fid stylegan2-pytorch/stylegan2_pytorch/pytorch_fid
touch stylegan2-pytorch/stylegan2_pytorch/pytorch_fid/__init__.py
sed -i 's/from pytorch_fid.inception/from .inception/' stylegan2-pytorch/stylegan2_pytorch/pytorch_fid/pytorch_fid/fid_score.py
# get some more python libraries
pip install matplotlib scipy
fi
pip install stylegan2-pytorch/
chmod u+x stylegan2-pytorch/bin/stylegan2_pytorch
|
Python
|
UTF-8
| 885
| 3
| 3
|
[] |
no_license
|
g=open('output.txt','w')
with open('A-small-attempt3.txt','r') as f :
t=int(f.readline())
c=1
while True :
l=[]
m=[]
x=int(f.readline())
for i in range(4):
l.append(f.readline().split())
y=int(f.readline())
for i in range(4):
m.append(f.readline().split())
l=[ [int(l[i][j]) for j in range(4)] for i in range(4) ]
m=[ [int(m[i][j]) for j in range(4)] for i in range(4) ]
n=list(set(l[x-1]).intersection(set(m[y-1])))
if len(n)==0 :
g.write("Case #"+str(c)+": Volunteer cheated!\n")
elif len(n)==1:
g.write("Case #"+str(c)+": "+str(n[0])+"\n")
else:
g.write("Case #"+str(c)+": Bad magician!\n")
c=c+1
t=t-1;
if t==0:
break
g.close()
|
Java
|
UTF-8
| 443
| 1.84375
| 2
|
[] |
no_license
|
package com.yingzi.center.manager.eo;
import javax.persistence.Column;
import javax.persistence.Comment;
import javax.persistence.Table;
@Table(name = "manager_area_code")
@Comment("行政区域编码")
public class AreaCode {
@Column(columnDefinition = "编码")
Integer code;
@Column(columnDefinition = "父类编码")
Integer parendCode;
@Column(columnDefinition = "名称")
String name;
}
|
Markdown
|
UTF-8
| 3,913
| 2.90625
| 3
|
[] |
no_license
|
# FixIT3160: IT Support Ticketing Software
Project Implementation for University of Newcastle SENG3160 2019
**Authors:** Benjamin McDonnell, Jordan Maddock, Matthew Rudge, Kundayi Sitole
Project now live on Heroku at https://fixit3160.herokuapp.com
Project hosted on GitHub at https://github.com/benoz11/fixit3160
Compile & Run locally with `mvn spring-boot:run` then navigate to http://localhost:8080 to test
### Environment Description
- Project is hosted live on the cloud using Heroku, Database is linked into Heroku using Postgresql.
- Project is written in Java using Spring-boot, Hibernate, and Spring Security
- Project is compiled using maven - see pom.xml for dependencies
### Roles
| Role | Description |
|:------------- |:------------------------------------------------------------------------------|
| Manager | The admin/manager |
| Caseworker | The person who finds and posts solutions to tickets |
| Regular | The user who is using the system to report a problem that they need help with |
| User | An alias for ANY user within the system - Not a real role |
### Ticket States / Lifecycle
| Ticket State | Description |
|:------------- |:------------------------------------------------------------------------------ |
| Open | Newly posted and not assigned to any caseworkers |
| In Progress | Manager has assigned the ticket to a Caseworkers |
| Resolved | A solution for the problem is posted. Users can Reject the solution to change the ticket state back to In Progress |
| Completed | User has accepted the solution - Ticket cannot be edited at or after this stage |
| Knowledge Base| Manager believes this solution might be useful to others, makes it public |
| Closed | Manager has locked the ticket as it has been deemed unworthy |
*Here's a [State transition diagram](https://drive.google.com/file/d/1svo6e6X1p97XKs81Sh9r6BP7yzpGU_V7/view?usp=sharing)*
### Software Major Functions
- Users
- Users can log in to the system using one of the given user/pass combinations (see users file - not present on GitHub for security)
- Users can create, view, edit their own help tickets describing a problem they want help with
- Users can create, view, edit, delete their own comments on tickets
- Users can comment on Tickets
- Users can comment on Tickets
- Users can edit their own profiles
- Users can view Knowledge Base articles
- Users can log out
- Caseworkers
- Caseworkers can only see tickets they are assigned to, Regular users can only see tickets they have posted
- Managers
- Managers can edit, delete all other users comments
- Managers can edit, delete all other users tickets
- Managers can assign these tickets to Caseworkers who will find a solution to the problem and post it as a comment under the ticketing
- Managers can view statistics relevant to the system
- Managers can create, read, edit, delete Users within the system
- All Users
- Tickets and Users can be searched using the search box, or sorted by clicking the table headers
- System contains security measures so that only logged in users can see content
- System contains security measures so that users can only see content specific to their account and access role
*Please find the SENG3150 FixIT requirements document in the project files*
### Git / Local steps
Clone with `git clone https://github.com/benoz11/fixit3160.git`
Create a git remote with `git remote add fixit3160 https://github.com/benoz11/fixit3160.git`
Pull most recent version with `git pull fixit3160 master`
Compile and run locally with `mvn spring-boot:run` then connect to http://localhost:8080 to test
Please test thoroughly before proceeding...
Add your changes to local git with `git add .`
Commit your changes to local git with `git commit -m "A meaningful message"`
Push your changes to the git repository with `git push fixit3160 master`
Tada!
|
JavaScript
|
UTF-8
| 966
| 3.234375
| 3
|
[] |
no_license
|
import pointwise from './pointwise'
import spPointwise from './spPointwise'
import Sparse from './Sparse'
import Complex from './Complex'
import atan2 from './atan2'
import abs from './abs'
const log = pointwise(Math.log)
const slog = spPointwise(Math.log)
function clog(x) {
if (x.im) {
var theta = new Complex(atan2(x.im, x.re)),
r = abs(x);
return new Complex(log(r.re), theta.re);
}
return new Complex(log(x.re));
}
/**
* Pointwise Math.log(x)
*
* @export
* @param {Number|Array|Complex|Sparse} m
* @returns {Number|Array|Complex|Sparse}
* @example
*
* log(1)
* // returns Math.log(1)
* log([1, 2])
* // returns [Math.log(1), Math.log(2)]
* log([[1,2],[1,3]])
* // returns [ [Math.log(1), Math.log(2)], [Math.log(1), Math.log(3)] ]
*/
export default function (m) {
switch (m.constructor.name) {
case 'Complex':
return clog(m);
case 'Sparse':
return slog(m);
default:
return log(m);
}
}
|
C#
|
UTF-8
| 693
| 2.921875
| 3
|
[] |
no_license
|
using Saucar.Chess.Models;
namespace Saucar.Chess.Tests.contexts
{
public class boardContext
{
protected int _column;
protected int _row;
protected Chessboard _board;
public Models.Knight Knight;
protected void Given_a_board(int row, int column)
{
_board = new Chessboard(8, 8);
}
protected void When_placing_the_piece(int row, int column)
{
_row = row;
_column = column;
Knight = new Models.Knight(_board);
Knight.Init(row, column);
}
protected void When_moving_the_piece()
{
Knight.Move();
}
}
}
|
JavaScript
|
UTF-8
| 2,318
| 2.796875
| 3
|
[] |
no_license
|
var kartta = L.map('kartta').setView([60.1733, 24.94], 14);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1
}).addTo(kartta);
/*GEOLOKAATIO jonka avulla saadaan käyttäjän sijainti kartalle alussa*/
let omaLat;
let omaLng;
let x = document.getElementById("virheilmoitus");
function getLocation() {
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser."
}
}
function showPosition(position) { //tässä kohtaa lisätään sijainti karttamarkkeriksi
omaLat = position.coords.latitude;
omaLng = position.coords.longitude;
let piste = L.marker([omaLat, omaLng]).addTo(kartta);
piste.bindPopup("Sinä olet täällä!");
kartta.panTo([omaLat, omaLng]);
}
getLocation();
function haeReitti(elem) { //funktio, jota haetaan kun dropdown menun linkkiä painetaan
'use strict';
let id = elem.value; //id on muuttuja jonka avulla tiedetään, minkä paikan tiedot haetaan
const url = "https://citynature.eu/api/wp/v2/places?cityid=5";
fetch(url) //haetaan API-sivusto
.then(function(vastaus){
return vastaus.json();
}).then(function(json){
naytaTulos(json);
}).catch(function(error){
console.log(error);
})
function naytaTulos(json) {
let i;
for(i=0;i < json[id].points.length;i++) { //käydään läpi halutun reitin json ja lisätään markerit karttaan
let lat = json[id].points[i].locationPoint.lat;
let lng = json[id].points[i].locationPoint.lng;
let info = json[id].points[i].locationPoint.pointInfo;
let piste = L.marker([lat, lng]).addTo(kartta);
piste.bindPopup(info);
}
kartta.flyTo([json[id].points[0].locationPoint.lat, json[id].points[0].locationPoint.lng]); //kartan ominaisuus "lentää" jonkin markerin luo
}
}
|
Java
|
UTF-8
| 5,401
| 2.4375
| 2
|
[
"MIT"
] |
permissive
|
package io.frictionlessdata.tableschema.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.google.common.util.concurrent.AtomicDouble;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
// we need to give the property order to get a valid schema, as Java reflection tosses this.
@JsonPropertyOrder({
"id", "byteVal", "shortVal", "intVal", "longClassVal", "longVal", "floatVal",
"doubleVal", "floatClassVal", "doubleClassVal", "bigIntVal", "bigDecimalVal",
"atomicIntegerVal", "atomicLongVal", "atomicDoubleVal"
})
public class NumbersBean {
private Integer id;
private byte byteVal;
private short shortVal;
private int intVal;
private Long longClassVal;
private long longVal;
private float floatVal;
private double doubleVal;
private Float floatClassVal;
@JsonProperty("doubleClassVal")
private Double doubleClassVal;
private BigInteger bigIntVal;
private BigDecimal bigDecimalVal;
private AtomicInteger atomicIntegerVal;
private AtomicLong atomicLongVal;
private AtomicDouble atomicDoubleVal;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public byte getByteVal() {
return byteVal;
}
public void setByteVal(byte byteVal) {
this.byteVal = byteVal;
}
public short getShortVal() {
return shortVal;
}
public void setShortVal(short shortVal) {
this.shortVal = shortVal;
}
public int getIntVal() {
return intVal;
}
public void setIntVal(int intVal) {
this.intVal = intVal;
}
public Long getLongClassVal() {
return longClassVal;
}
public void setLongClassVal(Long longClassVal) {
this.longClassVal = longClassVal;
}
public long getLongVal() {
return longVal;
}
public void setLongVal(long longVal) {
this.longVal = longVal;
}
public float getFloatVal() {
return floatVal;
}
public void setFloatVal(float floatVal) {
this.floatVal = floatVal;
}
public double getDoubleVal() {
return doubleVal;
}
public void setDoubleVal(double doubleVal) {
this.doubleVal = doubleVal;
}
public BigInteger getBigIntVal() {
return bigIntVal;
}
public void setBigIntVal(BigInteger bigIntVal) {
this.bigIntVal = bigIntVal;
}
public BigDecimal getBigDecimalVal() {
return bigDecimalVal;
}
public void setBigDecimalVal(BigDecimal bigDecimalVal) {
this.bigDecimalVal = bigDecimalVal;
}
public AtomicInteger getAtomicIntegerVal() {
return atomicIntegerVal;
}
public void setAtomicIntegerVal(AtomicInteger atomicIntegerVal) {
this.atomicIntegerVal = atomicIntegerVal;
}
public AtomicLong getAtomicLongVal() {
return atomicLongVal;
}
public void setAtomicLongVal(AtomicLong atomicLongVal) {
this.atomicLongVal = atomicLongVal;
}
public AtomicDouble getAtomicDoubleVal() {
return atomicDoubleVal;
}
public void setAtomicDoubleVal(AtomicDouble atomicDoubleVal) {
this.atomicDoubleVal = atomicDoubleVal;
}
public float getFloatClassVal() {
return floatClassVal;
}
public void setFloatClassVal(float floatClassVal) {
this.floatClassVal = floatClassVal;
}
public double getDoubleClassVal() {
return doubleClassVal;
}
public void setDoubleClassVal(double doubleClassVal) {
this.doubleClassVal = doubleClassVal;
}
@Override
public String toString() {
return "NumbersBean{" +
"id=" + id +
", byteVal=" + byteVal +
", shortVal=" + shortVal +
", intVal=" + intVal +
", longClassVal=" + longClassVal +
", longVal=" + longVal +
", floatVal=" + floatVal +
", doubleVal=" + doubleVal +
", floatClassVal=" + floatClassVal+
", doubleClassVal=" + doubleClassVal+
", bigIntVal=" + bigIntVal +
", bigDecimalVal=" + bigDecimalVal +
", atomicIntegerVal=" + atomicIntegerVal +
", atomicLongVal=" + atomicLongVal +
", atomicDoubleVal=" + atomicDoubleVal +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof NumbersBean)) return false;
NumbersBean that = (NumbersBean) o;
return byteVal == that.byteVal &&
shortVal == that.shortVal &&
intVal == that.intVal &&
longVal == that.longVal &&
Float.compare(that.floatVal, floatVal) == 0 &&
Double.compare(that.doubleVal, doubleVal) == 0 &&
Objects.equals(id, that.id) &&
Objects.equals(longClassVal, that.longClassVal) &&
Objects.equals(floatClassVal, that.floatClassVal)&&
Objects.equals(doubleClassVal, that.doubleClassVal)&&
Objects.equals(bigIntVal, that.bigIntVal) &&
Objects.equals(bigDecimalVal, that.bigDecimalVal) &&
Objects.equals(atomicIntegerVal.intValue(), that.atomicIntegerVal.intValue()) &&
Objects.equals(atomicLongVal.longValue(), that.atomicLongVal.longValue()) &&
Objects.equals(atomicDoubleVal.doubleValue(), that.atomicDoubleVal.doubleValue());
}
@Override
public int hashCode() {
return Objects.hash(id, byteVal, shortVal, intVal, longClassVal, longVal, floatVal, doubleVal, bigIntVal,
bigDecimalVal, atomicIntegerVal, atomicLongVal, atomicDoubleVal);
}
}
|
TypeScript
|
UTF-8
| 1,869
| 2.625
| 3
|
[
"MIT"
] |
permissive
|
import * as commander from "commander";
import { readFileSync } from "fs";
import { Parser } from "./Parser";
import { JiraApiConnector } from "./jira/JiraApiConnector";
import { FormatError } from "./errors";
import { checkForUpdates } from "./util/checkForUpdates";
import { Logger } from "./util/Logger";
import { handleError } from "./util/handleError";
export const execute = async () => {
let executed = false;
await checkForUpdates();
commander
.command("updateCredentials")
.description("Update the saved credentials")
.action(() => {
JiraApiConnector.updateCredentials(true);
executed = true;
});
commander
.command("updateHost")
.description("Update the saved host")
.action(() => {
JiraApiConnector.updateHost();
executed = true;
});
commander
.version("0.0.13")
.arguments("<file>")
.option(
"-s, --saveCredentials",
"Save the user credentials in the home directory",
false
)
.option(
"-a, --syncAll",
"Sync every day in the timesheet file, ignoring the default of one week",
false
)
.action(async (file: string, { saveCredentials, syncAll }: any) => {
executed = true;
const connector = new JiraApiConnector(saveCredentials, syncAll);
try {
const fileContent = readFileSync(file, "utf8");
const dates = Parser.parse(fileContent);
await connector.importLogs(dates);
Logger.success("Import was successful");
} catch (e) {
handleError(e);
if (e instanceof FormatError) {
process.exit(128);
}
process.exit(1);
}
});
commander.parse(process.argv);
if (!executed) {
Logger.error("Please specify a timesheet file");
process.exit(1);
}
};
execute().catch(e => {
handleError(e);
process.exit(1);
});
|
PHP
|
UTF-8
| 796
| 2.53125
| 3
|
[] |
no_license
|
<?php
require __DIR__ . "/vendor/autoload.php";
require_once('functions.php');
use Twilio\Rest\Client;
$dotenv = Dotenv\Dotenv::create(__DIR__);
$dotenv->load();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$message = $_REQUEST['Body'] ?? '';
$from = $_REQUEST['From'] ?? '';
if ($message !== '') {
$account_sid = getenv("TWILIO_ACCOUNT_SID");
$auth_token = getenv("TWILIO_AUTH_TOKEN");
$twilio_number = getenv("TWILIO_PHONE_NUMBER");
$weatherData = getWeatherData($message);
$text = $weatherData['weather'].' Today with '.$weatherData['temp'].' degrees Temprature ';
$client = new Client($account_sid, $auth_token);
$client->messages->create($from,
array(
'from' => $twilio_number,
'body' => $text
)
);
}
}
|
Ruby
|
UTF-8
| 182
| 3.21875
| 3
|
[] |
no_license
|
def compute(str1, str2)
counter=0
min_length = [str1.length, str2.length].min
i=0
while i<min_length do
counter++ if not str1[i] == str2[i]
i = i+1
end
counter
end
|
Python
|
UTF-8
| 201
| 4.0625
| 4
|
[] |
no_license
|
# python arrays 2
cars = ["Ford","Audi", "Benz"]
#loop through an array
for x in cars:
print(x)
# adding an item
cars.append("Honda")
print(cars)
# to remove an item
cars.pop(0)
print(cars)
|
Shell
|
UTF-8
| 408
| 2.734375
| 3
|
[] |
no_license
|
#!/bin/sh
root="$GOPATH/src"
LIBS[0]="github.com/gorilla/websocket"
LIBS[1]="github.com/astaxie/beego/logs"
LIBS[2]="github.com/golang/protobuf/proto"
LIBS[3]="github.com/garyburd/redigo/redis"
LIBS[4]="labix.org/v2/mgo"
echo ${LIBS[*]}
for item in ${LIBS[*]}
do
if [ ! -e "$root/$item" ]; then
echo "go get $item"
go get $item
else
echo "$root/$item exists!"
fi
done
|
Ruby
|
UTF-8
| 2,192
| 2.875
| 3
|
[
"MIT"
] |
permissive
|
require 'epilog'
describe Epilog::UnificationGoal do
let( :bound_value ){ "bound" }
let( :bound_variable ){ Epilog::Variable.new( bound_value ) }
let( :variable ){ Epilog::Variable.new }
context "with left input unbound and right input is ground" do
let( :goal ){ Epilog::UnificationGoal.new( variable, bound_variable ) }
it "is proven" do
goal.solve.should be_true
end
context "with the left variable" do
before { goal.solve }
it "is ground" do
variable.should be_ground
end
it "materialized as the right value" do
variable.value.should == bound_value
end
end
it "grounds the left variable" do
goal.solve
variable.should be_ground
end
it "grounds the left variable to the value" do
goal.solve
variable.should be_ground
end
end
context "with the left value bound and right is free" do
let( :goal ){ Epilog::UnificationGoal.new( bound_variable, variable ) }
it "is proven true" do
goal.solve.should be_true
end
context "for the right variable" do
before { goal.solve }
it "is bound" do
variable.should be_ground
end
it "comoses the two variables from the same matter" do
variable.matter.should == bound_variable.matter
end
end
end
it "is true when the left input is unbound and the right is bound" do
left = Epilog::Variable.new
right = Epilog::Variable.new( "bound" )
goal = Epilog::UnificationGoal.new( left, right )
goal.solve.should be_true
end
context "with bound inputs" do
it "is true when the left and right values are equal" do
goal = Epilog::UnificationGoal.new( Epilog::Variable.new( "side" ), Epilog::Variable.new( "side" ) )
goal.solve.should be_true
end
it "is false when the left and right avlues are not equal" do
goal = Epilog::UnificationGoal.new( Epilog::Variable.new( "left" ), Epilog::Variable.new( "right" ) )
goal.solve.should be_false
end
end
context "with both inputs unbound" do
let( :other_variable ){ Epilog::Variable.new }
let( :goal ){ Epilog::UnificationGoal.new( variable, other_variable ) }
it "associates the variables" do
goal.solve
other_variable.matter.should == variable.matter
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.