stripe mailwizz extension issue

maxela

Member
Hello guys,
I'm looking for someone to help me or a developer to fix an issue and will reward.

I signed up with https://linkmink.com that provide affiliate software.
they requested me to complete setup by completing setp2 and step3 below:

Step2

When you create your Stripe subscription or charge, call our exposed function lmFinished() and pass the returned value to the location you make your Stripe API request.

const captureInfo = {
// other info you’re already collecting
lmref: lmFinished()
}


Step 3
Pass the tracking information to Stripe by adding metadata to the call you’re already making.


stripe.customer.subscription.create({
// other info in Stripe subscription
metadata: {lm_data: lmref}
})


integration link is : https://linkmink.com/docs/integration

I contacted Twisted1919 and he helped with this below:
================
1. Open /apps/extensions/payment-gateway-stripe-subscriptions/customer/views/payment-form.php
and find this block of code:
PHP:
if (response.error) {
notify.remove().addError(response.error.message).show();
} else {
$('#' + modelID + '_token').val(response['id']);
$.post($(form).attr('action'), $(form).serialize(), function(json) {
if (json.result == 'error') {
notify.remove().addError(json.message).show();
} else {
notify.remove().addSuccess(json.message).show();
setTimeout(function(){
window.location.href = window.location.href.replace('payment', 'index');
}, 2000);
}
}, 'json');
}
and make it:
PHP:
if (response.error) {
notify.remove().addError(response.error.message).show();
} else {
$('#' + modelID + '_token').val(response['id']);
var lm_data_finish = typeof lmFinished == 'function' ? lmFinished() : '';
$.post($(form).attr('action'), $(form).serialize() + '&lm_data=' + lm_data_finish, function(json) {
if (json.result == 'error') {
notify.remove().addError(json.message).show();
} else {
notify.remove().addSuccess(json.message).show();
setTimeout(function(){
window.location.href = window.location.href.replace('payment', 'index');
}, 2000);
}
}, 'json');
}

Then you will have to open /apps/extensions/payment-gateway-stripe-subscriptions/customer/components/utils/StripeSubscriptionsPaymentHandler.php
and look for:
PHP:
$attributes = $order->attributes;
$attributes['date_added'] = $attributes['last_updated'] = date('Y-m-d H:i:s');
$attributes['status'] = PricePlanOrder::STATUS_COMPLETE;

$subscriptionDetails = array(
"plan" => $order->plan->plan_uid,
"tax_percent" => (float)$order->tax_percent,
"metadata" => $attributes,
);
and make it:
PHP:
$attributes = $order->attributes;
$attributes['date_added'] = $attributes['last_updated'] = date('Y-m-d H:i:s');
$attributes['status'] = PricePlanOrder::STATUS_COMPLETE;
$attributes['lm_data'] = Yii::app()->request->getPost('lm_data', '');

$subscriptionDetails = array(
"plan" => $order->plan->plan_uid,
"tax_percent" => (float)$order->tax_percent,
"metadata" => $attributes,
);
This should do it. but i haven't tested it.
===========
Unfortunately Twisted1919 did not test it , but I test it and it does not work for one reason: the metadata in not extracted, so after testing metadata in stripe are empty!!!!!
check out this screenshot: https://drive.google.com/open?id=1eI86We1WNk2URptmsMCPX9ry3BiF6_37

I think that something is missing on the code above provided by Twisted1919.

to test if it works we should get something like in this screenshot: https://downloads.intercomcdn.com/i/o/70983485/7fda03bea21a6e6f1b9a0314/Stripe+Sync.png

Thanks in advance
 
Back
Top