src/payments.js
/**
 * Create a new payment. This DOES actually attempt to charge the user.
 *
 * @param {Object} params - Function parameters
 * @param {String} params.url - The endpoint url
 * @param {Datetime} params.due - due
 * @param {Datetime} params.currency - cyrrency
 * @param {Datetime} params.payment_gateway - gateway
 * @param {Datetime} params.product_tax - product tax
 * @param {Datetime} params.shipping_tax - shipping tax
 * @param {Datetime} params.note - note
 * @param {Datetime} params.id - id
 * 
 * @returns {Promise} Response or Error Object
 */
Create a new payment. This DOES actually attempt to charge the user.

@returns {Promise} Response or Error Object
Create a new payment . This DOES actually attempt to charge the user . @returns { Promise } Response or Error Object
function putPayment({
    url,
    due,
    currency,
    payment_gateway,
    product_tax,
    shipping_tax,
    note,
    id,
}) {
    return new Promise((resolve) => {
        axios
            .put(`${url}/ecommerce/payment`, {
                data: {
                    type: 'payment',
                    attributes: {
                        due,
                        currency,
                        payment_gateway,
                        product_tax,
                        shipping_tax,
                        note,
                    },
                    relationships: {
                        paymentMethod: {
                            data: {
                                type: 'paymentMethod',
                                id,
                            },
                        },
                    },
                },
            })
            .then((response) => {
                resolve({ response });
            })
            .catch((error) => {
                resolve({ error });
            });
    });    
}
function putPayment ( { url , due , currency , payment_gateway , product_tax , shipping_tax , note , id , } ) { return new Promise ( ( resolve ) => { axios . put ( ` ${ url } ` , { data : { type : 'payment' , attributes : { due , currency , payment_gateway , product_tax , shipping_tax , note , } , relationships : { paymentMethod : { data : { type : 'paymentMethod' , id , } , } , } , } , } ) . then ( ( response ) => { resolve ( { response } ) ; } ) . catch ( ( error ) => { resolve ( { error } ) ; } ) ; } ) ; }
Create a new payment.
Create a new payment .