Hello,

I faced a major issue while triggering an escrow transaction using Rules.
Indeed, the transaction is created and all information are correctly reported in the DB, however the corresponding amount is not withdrawn from the user balance.

A normal behaviour would also be that before the transaction is launched, the transaction amount (+ fees) is checked vs the user balance, and the transaction is effectively fired only if user balance > transition amount (+ fees). If not, the user should get the instruction to make a deposit first.

I didn't test yet with other transaction types, but I may expect the same behaviour.
Do not hesitate to tell me if you need further info, I'll be happy to provide necessary details.

Thanks!

Comments

Arno2Mars created an issue. See original summary.

aporie’s picture

StatusFileSize
new1.55 KB

Hi,

Attached a patch to perform the transaction with rules.

Caution: it won't validate anything, it will update user balances whatever their balances are.

  • Aporie committed fac05bf on 8.x-1.x
    Issue #3065618 by Aporie, Arno2Mars: Commerce funds integration with...
aporie’s picture

Status: Active » Needs review
arno2mars’s picture

Hi Aporie,

Again thank you very much for your help.
Just tested it with the latest version 1.x-dev.

I could create an escrow with Rules, but the escrow amount is still not withdrawn from the issuer balance when the escrow is created. This happens only when the escrow is created with Rules, everything works fine when the escrow is created manually.

Also, I have cancelled the escrow, and the balance of the escrow issuer was credited with the cancelled escrow amount. This is what is expected if the amount was withdrawn at escrow creation, however in my case the issuer earned money by cancelling its escrow.

Regarding your caution, do you plan to implement a validation process, or is it technically impossible? No pressure, and take your time, just to know what is feasible or not:-).

Just let me know if you need more info.

Cheers,

aporie’s picture

StatusFileSize
new81.89 KB

Hi Arno2Mars,

I'm gonna write a tutorial to explain how to use rules with CF.

You have to add the rule action "Perform transaction" after saving your entity. As followed:

Perform transaction

Then, you have to select "entity" as data selector in the rule action.

Regarding the validation process, it's technically impossible with the actual rules, yes. And at the end, the validation process, if we want to be the more flexible, will need to be done by the website builder (through rules).

Fact is, it's really nothing to do it by code (you'll find the hook to put in the tutorial).

arno2mars’s picture

Hi Aporie,

Thanks a lot for your support, it's very much appreciated and really helping me.
I confirm that this works, and allows to have the amount withdrawn from the issuer balance.
I didn't notice that this "Perform transaction" action was listed in Rules, and thought that saving the entity was enought to have the whole thing done.

For the validation process, OK I understand, and I'm happy to do it with a hook in a custom module.
I will then rely on your tutorial instructions, because as I told you, I'm really a newbie in all that stuff, and for now I didn't ever create any custom module by myself... :-) So if you can put very detailed instructions in the tutorial, this will again really guide me to have it done the correct way.

Again thanks a lot for your time and efforts.
Cheers,

aporie’s picture

Hi Arno2Mars,

Can you open a new ticket for the validation process?

I've a patch ready, and it will indeed require a small hook (easy to implement) to get it working. The tutorial is still on the writing process but I'll publish it as soon as it's finished.

Please open a new ticket so you can be credited for the validation request.

Thanks

aporie’s picture

Status: Needs review » Fixed

So, the dev is included in the last release alpha8.

Doc for using Commerce Funds with Rules here.

arno2mars’s picture

You're a legend!
I'll do that right now.

Cheers

Status: Fixed » Closed (fixed)

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