1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00

Fixed payment link not working on mobile app

This commit is contained in:
Jon Ziebell 2023-12-15 10:41:41 -05:00
parent 0eab6c4bee
commit 2dc95b92fa
2 changed files with 20 additions and 7 deletions

View File

@ -8,10 +8,10 @@
class stripe_payment_link extends cora\crud {
public static $exposed = [
'private' => [
'private' => [],
'public' => [
'open'
],
'public' => []
]
];
public static $user_locked = false;
@ -81,10 +81,9 @@ class stripe_payment_link extends cora\crud {
public function open($attributes) {
$stripe_payment_link = $this->get($attributes);
$user = $this->api('user', 'get', $this->session->get_user_id());
$url = $stripe_payment_link['url'] .
'?prefilled_email=' . $user['email_address'] .
'&client_reference_id=' . $user['user_id'];
'?prefilled_email=' . $attributes['prefilled_email'] .
'&client_reference_id=' . $attributes['client_reference_id'];
header('Location: ' . $url);
die();

View File

@ -306,7 +306,21 @@ beestat.component.card.contribute.prototype.decorate_contents_ = function(parent
.set_background_hover_color()
.removeEventListener('click');
window.open('api/?resource=stripe_payment_link&method=open&arguments={"attributes":{"amount":' + (contribute_amount * 100) + ',"currency":"' + beestat.setting('units.currency') + '","interval":"' + contribute_interval + '"}}&api_key=' + window.beestat_api_key_local);
const stripe_payment_link_arguments = {
'attributes': {
'amount': (contribute_amount * 100),
'currency': beestat.setting('units.currency'),
'interval': contribute_interval,
'prefilled_email': beestat.user.get().email_address,
'client_reference_id': beestat.user.get().user_id
}
};
window.open(
'api/?resource=stripe_payment_link&method=open&arguments=' +
JSON.stringify(stripe_payment_link_arguments) +
'&api_key=' +
window.beestat_api_key_local
);
setTimeout(function() {
self.rerender();