medusa-payment-solana
Version:
Solana crypto currency payment provider for MedusaJS 2.0
76 lines • 3.23 kB
TypeScript
import { AbstractPaymentProvider } from '@medusajs/framework/utils';
import { Logger, AuthorizePaymentInput, AuthorizePaymentOutput, CancelPaymentInput, CancelPaymentOutput, CapturePaymentInput, CapturePaymentOutput, DeletePaymentInput, DeletePaymentOutput, GetPaymentStatusInput, GetPaymentStatusOutput, InitiatePaymentInput, InitiatePaymentOutput, RefundPaymentInput, RefundPaymentOutput, RetrievePaymentInput, RetrievePaymentOutput, UpdatePaymentInput, UpdatePaymentOutput, ProviderWebhookPayload, WebhookActionResult } from '@medusajs/framework/types';
import SolanaClient, { PaymentDetails } from './providers/solana-payment/solana-client';
type SolanaPaymentOptions = {
rpcUrl: string;
passPhrase: string;
coldStorageWallet: string;
sessionExpirationSeconds?: number;
currencyConverter?: {
provider: 'default' | 'coingecko';
apiKey?: string;
};
};
declare class SolanaPaymentProviderService extends AbstractPaymentProvider<SolanaPaymentOptions> {
static identifier: string;
protected logger_: Logger;
protected options_: SolanaPaymentOptions;
protected solanaClient: SolanaClient;
initialize(): Promise<void>;
constructor(container: {
logger: Logger;
}, options: SolanaPaymentOptions);
/**
* Validate the options provided to the payment provider
*/
static validateOptions(options: Record<string, unknown>): void;
/**
* Initialize a new payment session
*/
initiatePayment(input: InitiatePaymentInput): Promise<InitiatePaymentOutput>;
/**
* Renews the payment details with a new price and expiration date.
*/
renewPayment(paymentDetails: PaymentDetails): Promise<PaymentDetails>;
/**
* Authorize a payment
*/
authorizePayment(input: AuthorizePaymentInput): Promise<AuthorizePaymentOutput>;
/**
* Capture an authorized payment
*/
capturePayment(input: CapturePaymentInput): Promise<CapturePaymentOutput>;
/**
* Cancel a payment
*/
cancelPayment(input: CancelPaymentInput): Promise<CancelPaymentOutput>;
/**
* Refund a captured payment
*/
refundPayment(input: RefundPaymentInput): Promise<RefundPaymentOutput>;
/**
* Get the status of a payment
* This function is mainely used by webhook based payment modules, but is required by medusa core.
* It is UNCLEAR what data structure it is called with when called by medusa. Beware!
*/
getPaymentStatus(input: GetPaymentStatusInput): Promise<GetPaymentStatusOutput>;
/**
* Retrieve payment data
*/
retrievePayment(input: RetrievePaymentInput): Promise<RetrievePaymentOutput>;
/**
* Update payment data
*/
updatePayment(input: UpdatePaymentInput): Promise<UpdatePaymentOutput>;
/**
* Delete a payment session
*/
deletePayment(input: DeletePaymentInput): Promise<DeletePaymentOutput>;
/**
* Process webhook events
* This could be used to handle notifications from a service monitoring the blockchain
*/
getWebhookActionAndData(payload: ProviderWebhookPayload['payload']): Promise<WebhookActionResult>;
}
export default SolanaPaymentProviderService;
//# sourceMappingURL=service.d.ts.map