Skip to content

Creating a new Preauthorization discards client and description #23

@PerWiklander

Description

@PerWiklander

I'm doing this (yeah, it's scala, bear with me):

val service: PreauthorizationService = Paymill.getService(classOf[PreauthorizationService])
val preauth = new Preauthorization()
preauth.setToken(paymentToken)
preauth.setDescription(order.id.get.toString)
preauth.setClient(
    findClient(customer).getOrElse(createClient(customer))
)
preauth.setAmount(order.orderValue * 100)
preauth.setCurrency("SEK")
service.create(preauth).getId

The intent is to send my order id as description of the preauth transaction and connect it to an existing client or a newly created (by me) one.

What I end up with in Paymill is a preauth transaction with no description and a newly created empty client.

Looking at PreauthorizationService.create I see that only the amount, currency and token is used. The rest of my parameters are disregarded.

public Preauthorization create(Preauthorization preauth) {
    Map<String,Object> params = new HashMap<String,Object>();
    params.put("amount", preauth.getAmount());
    params.put("currency", preauth.getCurrency());

    if (preauth.getPayment() != null) {
        params.put("payment", preauth.getPayment().getId());
    } else {
        params.put("token", preauth.getToken());
    }

    Transaction tx = client.post(resource, params, Transaction.class);
    return tx.getPreauthorization();
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions