Our beloved clients sometime ask for really fine tuning. In one of my use cases, i need to be able to alter the description sent to Stripe.
We need a patch to let the modules do that.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 2545400-stripe-charge-alter-12.patch | 3.17 KB | torgospizza |
| #10 | 2545400-stripe-charge-alter-10.patch | 3.62 KB | torgospizza |
Comments
Comment #1
artusamakHere is a patch for that.
We *could* send data in the metadata of the payment but it's not enough.
The other implementation option could be to let any module alter the Charge object (i have another use case (and patch coming) where we need to set the destination attribute) but we could let any module alter the amount of the Charge. I have mixed feelings about this, i think it's not a good idea to let anyone alter the whole object but on the other side it avoids to have multiple hooks to implement.
I'm opened for discussion about this.
Comment #2
aviindub commentedseems reasonable. committing.
Comment #4
aviindub commentedComment #5
artusamakCool, thanks! This should be reverted if the submodule is created though.
Comment #6
artusamakActually, i believe that it should be wilder than that. We may want to add / alter other information to the charge object so instead of adding a hook for each attribute, we should let the modules alter the whole data.
Comment #7
alberto56 commented#2569597: Provide an API hook to make it possible to alter information sent to stripe marked as a duplicate of this one.
Comment #8
Remon commentedPatch in #6 works perfectly.
Comment #9
torgospizzaI'll move this to RTBC then!
And actually since commerce_stripe_add_metadata() was added in a -dev version we may even want to consider removing it in factor of putting everything into an alter hook. That would make it more standardized, although on the other hand, having a specific add_metadata() function might have advantages. We did technically add a new hook_commerce_stripe_metadata() which is more specific than the one for charge data, which is more generic. So the concept of moving the metadata actions into a more generic charge data alter hook gets a +1 from me.
That might be worth opening up a new issue, though, since the metadata hook is in -dev.
Comment #10
torgospizzaHere is a re-roll of the patch in #6 against the latest dev as some lines have changed.
Comment #11
artusamakBeware, there is an extra whitespace in the last line of your patch. After that it looks RTBC to me.
Comment #12
torgospizzaWhoops! Here's a re-reoll.
Comment #13
aviindub commentedall looks good except for this line... what is this doing?
Comment #14
torgospizzaThat's just an example for the API documents, on how you might add an extra (hidden) fee. I probably wouldn't advocate for that, but it was a holdover from the first patch in the issue.
Comment #15
torgospizzaAccidental edit fix
Comment #16
aviindub commentedoh, right, obviously :) -- i was seeing it out of context.
Comment #18
aviindub commented