This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Customers
somentelucas edited this page Sep 3, 2018
·
10 revisions
Here, on Moip, the customer is a service user or a buyer of your business.
import static br.com.moip.helpers.PayloadFactory.payloadFactory;
import static br.com.moip.helpers.PayloadFactory.value;
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> taxDocument = payloadFactory(
value("type", "CPF"),
value("number", "10013390023")
);
Map<String, Object> phone = payloadFactory(
value("countryCode", "55"),
value("areaCode", "11"),
value("number", "22226842")
);
Map<String, Object> shippingAddress = payloadFactory(
value("city", "Sao Paulo"),
value("district", "Itaim BiBi"),
value("street", "Av. Brigadeiro Faria Lima"),
value("streetNumber", "3064"),
value("state", "SP"),
value("country", "BRA"),
value("zipCode", "01451001")
);
Map<String, Object> customer = payloadFactory(
value("ownId", "customer_own_id"),
value("fullname", "Customer Full Name"),
value("email", "[email protected]"),
value("birthDate", "1980-5-10"),
value("taxDocument", taxDocument),
value("phone", phone),
value("shippingAddress", shippingAddress)
);
Map<String, Object> newCustomer = Moip.API.customers().create(customer, setup);
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> taxDocumentHolder = payloadFactory(
value("type", "CPF"),
value("number", "22288866644")
);
Map<String, Object> phoneHolder = payloadFactory(
value("countryCode", "55"),
value("areaCode", "11"),
value("number", "55552266")
);
Map<String, Object> holder = payloadFactory(
value("fullname", "Test Holder Moip"),
value("birthdate", "1990-10-22"),
value("taxDocument", taxDocumentHolder),
value("phone", phoneHolder)
);
Map<String, Object> creditCard = payloadFactory(
value("expirationMonth", "05"),
value("expirationYear", "22"),
value("number", "4012001037141112"),
value("cvc", "123"),
value("holder", holder)
);
Map<String, Object> fundingInstrument = payloadFactory(
value("method", "CREDIT_CARD"),
value("creditCard", creditCard)
);
Map<String, Object> newCreditCard = Moip.API.customers().addCreditCard(fundingInstrument, "customer_id", setup);
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> deleteCreditCardResponse = Moip.API.customers().deleteCreditCard(ccId, setup);
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> responseGet = Moip.API.customers().get("customer_id", setup);
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> listResponse = Moip.API.customers().list(setup);