Skip to content

Commit

Permalink
add buy credits
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeydi committed Jan 15, 2025
1 parent 3269f73 commit f84dc0e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions developers/src/pages/app/app-billing/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<script>
import { toRefs, reactive, inject, watch, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { base64RawURLEncode } from '@mixin.dev/mixin-node-sdk';
import { useUserClient } from '@/api';
import { v4 as uuid, parse } from 'uuid';
import qs from 'qs';
Expand Down Expand Up @@ -96,6 +97,17 @@
return `${baseUrl}?${query}`;
};
const buildPaymentMemo = (user_id) => {
const extra = JSON.stringify({
u: user_id,
e: 'buy app credit'
});
const version = Buffer.from([1]);
const payee = Buffer.from(parse("fbd26bc6-3d04-4964-a7fe-a540432b16e2"));
const extraBuf = Buffer.from(extra)
return base64RawURLEncode(Buffer.concat([version, payee, extraBuf]));
};
const useClickPay = () => {
if (!allowSubmit.value) {
$message.error(t('Please enter a valid amount'));
Expand All @@ -104,7 +116,7 @@
const url = generateMixPayUrl(
'4d8c508b-91c5-375b-92b0-ee702ed2dac5',
state.amount,
'buy app credit',
buildPaymentMemo(props.appId),
window.location.href
);
window.location.href = url;
Expand Down Expand Up @@ -287,14 +299,5 @@
margin-bottom: 0;
}
}
.btns {
justify-content: center;
}
.btn-close {
display: none;
}
}
</style>

0 comments on commit f84dc0e

Please sign in to comment.