All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.orders.commands.updateactions.RemovePayment Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.orders.commands.updateactions;

import io.sphere.sdk.commands.UpdateActionImpl;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.orders.Order;
import io.sphere.sdk.payments.Payment;

import java.util.Optional;

/**
 *
 * This action removes a payment from the PaymentInfo.
 *
 * {@doc.gen intro}
 *
 * {@include.example io.sphere.sdk.orders.commands.OrderUpdateCommandTest#addPayment()}
 *
 * @see Payment
 * @see Order#getPaymentInfo()
 * @see AddPayment
 */
public class RemovePayment extends UpdateActionImpl {
    private final Reference payment;

    private RemovePayment(final Reference payment) {
        super("removePayment");
        this.payment = payment;
    }

    public static RemovePayment of(final Referenceable payment) {
        return new RemovePayment(Optional.ofNullable(payment).map(Referenceable::toReference).orElse(null));
    }

    public Reference getPayment() {
        return payment;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy