|
15 | 15 | PrivateFormat, |
16 | 16 | PublicFormat, |
17 | 17 | ) |
| 18 | + |
18 | 19 | from lightspark.exceptions import LightsparkException |
19 | 20 | from lightspark.objects.Account import Account |
20 | 21 | from lightspark.objects.Account import from_json as Account_from_json |
|
79 | 80 | from lightspark.scripts.create_uma_invitation import ( |
80 | 81 | CREATE_UMA_INVITATION_MUTATION, |
81 | 82 | CREATE_UMA_INVITATION_WITH_INCENTIVES_MUTATION, |
| 83 | + CREATE_UMA_INVITATION_WITH_PAYMENT_MUTATION, |
82 | 84 | ) |
83 | 85 | from lightspark.scripts.create_uma_invoice import CREATE_UMA_INVOICE_MUTATION |
84 | 86 | from lightspark.scripts.current_account import CURRENT_ACCOUNT_QUERY |
@@ -1015,5 +1017,37 @@ def fail_htlcs(self, invoice_id: str, cancel_invoice: bool = True) -> str: |
1015 | 1017 |
|
1016 | 1018 | return json["fail_htlcs"]["invoice"]["id"] |
1017 | 1019 |
|
| 1020 | + def create_uma_invitation_with_payment( |
| 1021 | + self, |
| 1022 | + inviter_uma: str, |
| 1023 | + payment_amount: float, |
| 1024 | + payment_currency: Any, |
| 1025 | + expires_at: str, |
| 1026 | + ) -> UmaInvitation: |
| 1027 | + """ |
| 1028 | + Creates a new UMA invitation with payment. |
| 1029 | +
|
| 1030 | + Args: |
| 1031 | + inviter_uma: The UMA of the inviter. |
| 1032 | + payment_amount: The amount to be paid. |
| 1033 | + payment_currency: The currency object (should have code, symbol, name, decimals attributes). |
| 1034 | + expires_at: The expiration datetime as an ISO8601 string. |
| 1035 | + """ |
| 1036 | + json = self._requester.execute_graphql( |
| 1037 | + CREATE_UMA_INVITATION_WITH_PAYMENT_MUTATION, |
| 1038 | + { |
| 1039 | + "inviter_uma": inviter_uma, |
| 1040 | + "payment_amount": payment_amount, |
| 1041 | + "payment_currency_code": payment_currency.code, |
| 1042 | + "payment_currency_symbol": payment_currency.symbol, |
| 1043 | + "payment_currency_name": payment_currency.name, |
| 1044 | + "payment_currency_decimals": payment_currency.decimals, |
| 1045 | + "expires_at": expires_at, |
| 1046 | + }, |
| 1047 | + ) |
| 1048 | + return UmaInvitation_from_json( |
| 1049 | + self._requester, json["create_uma_invitation_with_payment"]["invitation"] |
| 1050 | + ) |
| 1051 | + |
1018 | 1052 |
|
1019 | 1053 | E614_REGEX = re.compile(r"^\+?[1-9]\d{1,14}$") |
0 commit comments