Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
somentelucas edited this page Sep 3, 2018 · 7 revisions

Introduction

The order is the shop cart representation.

Dependencies

import static br.com.moip.helpers.PayloadFactory.payloadFactory;
import static br.com.moip.helpers.PayloadFactory.value;

Features

Index

Create order

Authorization able
Basic Auth
OAuth
Map<String, Object> subtotals = payloadFactory(
    value("shipping", 15000)
);

Map<String, Object> amount = payloadFactory(
    value("currency", "BRL"),
    value("subtotals", subtotals)
);

Map<String, Object> product1 = payloadFactory(
    value("product", "Product 1 Description"),
    value("category", "TOYS_AND_GAMES"),
    value("quantity", 2),
    value("detail", "Anakin's Light Saber"),
    value("price", 100000000)
);

Map<String, Object> product2 = payloadFactory(
    value("product", "Product 2 Description"),
    value("category", "SCIENCE_AND_LABORATORY"),
    value("quantity", 5),
    value("detail", "Pym particles"),
    value("price", 2450000000)
);

List items = new ArrayList();
items.add(product1);
items.add(product2);

Map<String, Object> customer = payloadFactory(
    value("id", "CUS-XXOBPZ80QLYP")
);

Map<String, Object> order = payloadFactory(
    value("ownId", "order_own_id"),
    value("amount", amount),
    value("items", items),
    value("customer", customer)
);

Map<String, Object> responseCreation = Moip.API.orders().create(order, setup);

Get order

Authorization able
Basic Auth
OAuth
Map<String, Object> responseGet = Moip.API.orders().get("order_id", setup);

List orders

Authorization able
Basic Auth
OAuth
Map<String, Object> responseList = Moip.API.orders().list(setup);

List order' payments

Authorization able
Basic Auth
OAuth
Map<String, Object> responseListOrderPayments = Moip.API.orders().listOrderPayments("order_id", setup);
Clone this wiki locally