Configurazione di un gateway di pagamento per Exchanges RMA (solo B2C)
Se non si utilizza Pagamenti Salesforce, è possibile configurare un gateway di pagamento per gestire i pagamenti. Pacchetti di pagamento per alcuni fornitori sono disponibili in AppExchange.
Versioni (Edition) richieste
Importante Se si utilizzano gli scambi con B2B o D2C Commerce, i passaggi da 1 a 4 sono già configurati durante l'implementazione di Gestione ordini. Passare direttamente al punto 5.
-
Creare una classe adattatore gateway di pagamento utilizzando Salesforce Apex Connector Framework.
Per iniziare, vedere queste classi di riferimento.
- Creare un record provider del gateway di pagamento che punti alla classe adattatore creata.
- In Imposta, definire una credenziale denominata contenente le informazioni di autenticazione e di accesso del provider del gateway. La definizione di chiamata della classe adattatore chiama la credenziale denominata.
- Collegare il record provider del gateway di pagamento e la credenziale denominata creando un record gateway di pagamento.
- Associare il gateway di pagamento al record Webstore.
Esempio
Per associare il gateway di pagamento al record Webstore, utilizzare uno script come questo
// Script to add a connection between the web store and the payment gateway for B2C Commerce stores
String webStoreName = 'SiteGenesis';
String paymentGatewayName = 'SalesforceAdapter';
// obtain webstoreid
List<WebStore> webstores = [SELECT Id, Name FROM WebStore WHERE Name = :webStoreName];
System.debug('Webstores: ' + webstores);
if(webstores.isEmpty()){
System.debug('Error obtaining webstore with name ' + webStoreName);
}
String webStoreId = webstores[0].Id;
System.debug('WebStoreId: ' + webStoreId);
// obtain payment gateway id from the payment gateway name
List<PaymentGateway> paymentGateways = [SELECT Id, PaymentGatewayName FROM PaymentGateway WHERE PaymentGatewayName = :paymentGatewayName];
System.debug('paymentGateways: ' + paymentGateways);
if(paymentGateways.isEmpty()){
System.debug('Error obtaining payment gateway with name ' + paymentGatewayName);
}
String paymentGatewayId = paymentGateways[0].Id;
System.debug('paymentGatewayId: ' + paymentGatewayId);
// If a StoreIntegratedService already exists for Payment on the WebStore then update the Integration field with the paymentGatewayId
List<StoreIntegratedService> storeServices = [SELECT Id FROM StoreIntegratedService WHERE StoreId = :webStoreId AND ServiceProviderType ='Payment' ];
System.debug('storeServices: ' + storeServices);
if(storeServices.isEmpty()){
StoreIntegratedService storeService = new StoreIntegratedService(
StoreId = webStoreId,
Integration = paymentGatewayId,
ServiceProviderType ='Payment');
insert storeService;
} else {
StoreIntegratedService existingStoreService = storeServices[0];
existingStoreService.Integration = paymentGatewayId;
update existingStoreService;
}
Questo articolo ha risolto il problema?
Facci sapere, così possiamo migliorare!

