Hello,

Authenticated user has the "create payment" permission.
Consider a partial paid order. User can see all the payments associated with an order using 'Commerce Payment Transaction view". End of page is used with "Commerce Payment Transaction : Total" which shows total of validated payments and balance order.
-> This field does not allow the authenticated user to place a new payment. It requires "Administer Payment" permission. "Create Payment" permission would be accurate permission.
Screenshot show authenticated user without and with Administer Payment permission.

Comments

oturpin’s picture

Hello,

Here is the explanation: digging into code, one can read:
if (user_access('create payments', $account)) {
// We currently allow any user to create any payment transaction,
// regardless of the order, because entity_access() doesn't give us a
// way to discriminate on the order.
// @todo: find a way to prevent creating a payment transaction if the
// user doesn't have access to the order.
if (!isset($order) || commerce_order_access('update', $order, $account)) {
return TRUE;
}

So, "create" is the good one, but is not enough => user MUST have update permission on the related order.
Problem is :
-> I don't want a user to modify orders, once validated.
-> I want to allow user submitting payments for non-balanced orders.

Then, I have to remove that piece of code related to the order permission.

rszrama’s picture

Title: Authenticated user cannot add payment to an order » Allow authenticated users to add payments to their orders
Version: 7.x-1.11 » 7.x-1.x-dev
Component: Payment » Contributed modules
Category: Bug report » Feature request
Status: Active » Postponed

I really think what you're looking for is not the functionality core intends to provide with this interface. You should instead consider creating a custom module that adds a payment management interface to the customer's order screen. Let us know here if you release such a module so we can check it out! : )

oturpin’s picture

Hi All,

I modified this function: function commerce_payment_transaction_order_access($op, $order, $account = NULL)
And removed the test : // if (!isset($order) || commerce_order_access('update', $order, $account)) { }
Then , it now returns the user_access('create payments', $account)) permission.
This is exactly what I needed: each time a user views an order, the payment table is drawn and the user has the ability to apply for a new payment transaction.

You are probably right. I should write a module for that... But Not enough skilled for the time being...

Thx

karing’s picture

If the user/role has the permission 'create payments' - what is the reasoning behind the fact that a user/role also must have 'update order' permissions - before the Add payment button shows up on their /admin/commerce/orders/[id]/payment screen? I really don't want users to update line-items - but I do want them to add payments!

karing’s picture

StatusFileSize
new62.27 KB

This is with #3:

bojanz’s picture

Category: Feature request » Support request
Status: Postponed » Fixed
Issue tags: -commerce payment create payment permission

This is not a feature Commerce will be supporting within its code. People are free to implement it in contrib, but no need to track it here.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.