本文整理汇总了Java中org.killbill.billing.payment.api.PluginProperty类的典型用法代码示例。如果您正苦于以下问题:Java PluginProperty类的具体用法?Java PluginProperty怎么用?Java PluginProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginProperty类属于org.killbill.billing.payment.api包,在下文中一共展示了PluginProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildProperties
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
private static List<PluginProperty> buildProperties(@Nullable final Map data) {
if (data == null) {
return ImmutableList.<PluginProperty>of();
}
final List<PluginProperty> originalProperties = PluginProperties.buildPluginProperties(data);
// Add common properties returned by plugins (used by Analytics)
final Map<String, Object> defaultProperties = new HashMap<String, Object>();
defaultProperties.put("processorResponse", getGatewayErrorCode(data));
defaultProperties.put("avsResultCode", data.get("avsResultRaw"));
defaultProperties.put("cvvResultCode", data.get("cvcResultRaw"));
defaultProperties.put("payment_processor_account_id", data.get(AdyenPaymentPluginApi.PROPERTY_MERCHANT_ACCOUNT_CODE));
// Already populated
//defaultProperties.put("paymentMethod", data.get("paymentMethod"));
final Iterable<PluginProperty> propertiesWithDefaults = PluginProperties.merge(defaultProperties, originalProperties);
return ImmutableList.<PluginProperty>copyOf(propertiesWithDefaults);
}
示例2: getPaymentInfo
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Override
public List<PaymentTransactionInfoPlugin> getPaymentInfo(final UUID kbAccountId, final UUID kbPaymentId, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
final List<PaymentTransactionInfoPlugin> transactions = super.getPaymentInfo(kbAccountId, kbPaymentId, properties, context);
if (transactions.isEmpty()) {
// We don't know about this payment (maybe it was aborted in a control plugin)
return transactions;
}
final ExpiredPaymentPolicy expiredPaymentPolicy = expiredPaymentPolicy(context);
if (expiredPaymentPolicy.isExpired(transactions)) {
cancelExpiredPayment(expiredPaymentPolicy.latestTransaction(transactions), context);
// reload payment
return super.getPaymentInfo(kbAccountId, kbPaymentId, properties, context);
}
return transactions;
}
示例3: cancelExpiredPayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
private void cancelExpiredPayment(PaymentTransactionInfoPlugin expiredTransaction, final TenantContext context) {
final List<PluginProperty> updatedStatusProperties = PluginProperties.buildPluginProperties(
ImmutableMap.builder()
.put(PROPERTY_FROM_HPP_TRANSACTION_STATUS,
PaymentPluginStatus.CANCELED.toString())
.put("message",
"Payment Expired - Cancelled by Janitor")
.build());
try {
dao.updateResponse(expiredTransaction.getKbTransactionPaymentId(),
PluginProperties.merge(expiredTransaction.getProperties(), updatedStatusProperties),
context.getTenantId());
} catch (final SQLException e) {
logService.log(LogService.LOG_ERROR, "Unable to update canceled payment", e);
}
}
示例4: authorizePayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin authorizePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
final AdyenResponsesRecord adyenResponsesRecord;
try {
adyenResponsesRecord = dao.updateResponse(kbTransactionId, properties, context.getTenantId());
} catch (final SQLException e) {
throw new PaymentPluginApiException("HPP notification came through, but we encountered a database error", e);
}
final boolean isHPPCompletion = adyenResponsesRecord != null && Boolean.valueOf(MoreObjects.firstNonNull(AdyenDao.fromAdditionalData(adyenResponsesRecord.getAdditionalData()).get(PROPERTY_FROM_HPP), false).toString());
if (!isHPPCompletion) {
// We don't have any record for that payment: we want to trigger an actual authorization call (or complete a 3D-S authorization)
return executeInitialTransaction(TransactionType.AUTHORIZE, kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context);
} else {
// We already have a record for that payment transaction and we just updated the response row with additional properties
// (the API can be called for instance after the user is redirected back from the HPP to store the PSP reference)
}
return buildPaymentTransactionInfoPlugin(adyenResponsesRecord);
}
示例5: capturePayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin capturePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
return executeFollowUpTransaction(TransactionType.CAPTURE,
new TransactionExecutor<PaymentModificationResponse>() {
@Override
public PaymentModificationResponse execute(final String merchantAccount, final PaymentData paymentData, final String pspReference, final SplitSettlementData splitSettlementData) {
final AdyenPaymentServiceProviderPort port = adyenConfigurationHandler.getConfigurable(context.getTenantId());
return port.capture(merchantAccount, paymentData, pspReference, splitSettlementData);
}
},
kbAccountId,
kbPaymentId,
kbTransactionId,
kbPaymentMethodId,
amount,
currency,
properties,
context);
}
示例6: purchasePayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin purchasePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
final AdyenResponsesRecord adyenResponsesRecord;
try {
adyenResponsesRecord = dao.updateResponse(kbTransactionId, properties, context.getTenantId());
} catch (final SQLException e) {
throw new PaymentPluginApiException("HPP notification came through, but we encountered a database error", e);
}
if (adyenResponsesRecord == null) {
// We don't have any record for that payment: we want to trigger an actual purchase (auto-capture) call
final String captureDelayHours = PluginProperties.getValue(PROPERTY_CAPTURE_DELAY_HOURS, "0", properties);
final Iterable<PluginProperty> overriddenProperties = PluginProperties.merge(properties, ImmutableList.<PluginProperty>of(new PluginProperty(PROPERTY_CAPTURE_DELAY_HOURS, captureDelayHours, false)));
return executeInitialTransaction(TransactionType.PURCHASE, kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, overriddenProperties, context);
} else {
// We already have a record for that payment transaction and we just updated the response row with additional properties
// (the API can be called for instance after the user is redirected back from the HPP to store the PSP reference)
}
return buildPaymentTransactionInfoPlugin(adyenResponsesRecord);
}
示例7: voidPayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin voidPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
return executeFollowUpTransaction(TransactionType.VOID,
new TransactionExecutor<PaymentModificationResponse>() {
@Override
public PaymentModificationResponse execute(final String merchantAccount, final PaymentData paymentData, final String pspReference, final SplitSettlementData splitSettlementData) {
final AdyenPaymentServiceProviderPort port = adyenConfigurationHandler.getConfigurable(context.getTenantId());
return port.cancel(merchantAccount, paymentData, pspReference, splitSettlementData);
}
},
kbAccountId,
kbPaymentId,
kbTransactionId,
kbPaymentMethodId,
null,
null,
properties,
context);
}
示例8: refundPayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin refundPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
return executeFollowUpTransaction(TransactionType.REFUND,
new TransactionExecutor<PaymentModificationResponse>() {
@Override
public PaymentModificationResponse execute(final String merchantAccount, final PaymentData paymentData, final String pspReference, final SplitSettlementData splitSettlementData) {
final AdyenPaymentServiceProviderPort providerPort = adyenConfigurationHandler.getConfigurable(context.getTenantId());
return providerPort.refund(merchantAccount, paymentData, pspReference, splitSettlementData);
}
},
kbAccountId,
kbPaymentId,
kbTransactionId,
kbPaymentMethodId,
amount,
currency,
properties,
context);
}
示例9: getPaymentTransactionInfoPluginForHPP
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
private PaymentTransactionInfoPlugin getPaymentTransactionInfoPluginForHPP(final TransactionType transactionType, final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
final AdyenPaymentServiceProviderHostedPaymentPagePort hostedPaymentPagePort = adyenHppConfigurationHandler.getConfigurable(context.getTenantId());
final Map<String, String> requestParameterMap = Maps.transformValues(PluginProperties.toStringMap(properties), new Function<String, String>() {
@Override
public String apply(final String input) {
// Adyen will encode parameters like merchantSig
return decode(input);
}
});
final HppCompletedResult hppCompletedResult = hostedPaymentPagePort.parseAndVerifyRequestIntegrity(requestParameterMap);
final PurchaseResult purchaseResult = new PurchaseResult(hppCompletedResult);
final DateTime utcNow = clock.getUTCNow();
try {
final AdyenResponsesRecord adyenResponsesRecord = dao.addResponse(kbAccountId, kbPaymentId, kbTransactionId, transactionType, amount, currency, purchaseResult, utcNow, context.getTenantId());
return buildPaymentTransactionInfoPlugin(adyenResponsesRecord);
} catch (final SQLException e) {
throw new PaymentPluginApiException("HPP payment came through, but we encountered a database error", e);
}
}
示例10: buildPaymentData
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
private PaymentData buildPaymentData(final String merchantAccount, final String countryCode, final AccountData account, final UUID kbPaymentId, final UUID kbTransactionId, final AdyenPaymentMethodsRecord paymentMethodsRecord, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
final Payment payment;
try {
payment = killbillAPI.getPaymentApi().getPayment(kbPaymentId, false, false, properties, context);
} catch (final PaymentApiException e) {
throw new PaymentPluginApiException(String.format("Unable to retrieve kbPaymentId='%s'", kbPaymentId), e);
}
final PaymentTransaction paymentTransaction = Iterables.<PaymentTransaction>find(payment.getTransactions(),
new Predicate<PaymentTransaction>() {
@Override
public boolean apply(final PaymentTransaction input) {
return kbTransactionId.equals(input.getId());
}
});
final PaymentInfo paymentInfo = buildPaymentInfo(merchantAccount, countryCode, account, paymentMethodsRecord, properties, context);
return new PaymentData<PaymentInfo>(amount, currency, paymentTransaction.getExternalKey(), paymentInfo);
}
示例11: testToUserDataForPluginProperties
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Test(groups = "fast")
public void testToUserDataForPluginProperties() throws Exception {
final String customerIdProperty = "customerId";
final String customerLocaleProperty = "de";
final String customerEmailProperty = "[email protected]";
final String customerFirstNameProperty = "Hans";
final String customerLastNameProperty = "Meier";
final String customerIpProperty = "1.2.3.4";
final List<PluginProperty> pluginProperties = ImmutableList.of(
new PluginProperty(AdyenPaymentPluginApi.PROPERTY_CUSTOMER_ID, customerIdProperty, false),
new PluginProperty(AdyenPaymentPluginApi.PROPERTY_CUSTOMER_LOCALE, customerLocaleProperty, false),
new PluginProperty(AdyenPaymentPluginApi.PROPERTY_EMAIL, customerEmailProperty, false),
new PluginProperty(AdyenPaymentPluginApi.PROPERTY_FIRST_NAME, customerFirstNameProperty, false),
new PluginProperty(AdyenPaymentPluginApi.PROPERTY_LAST_NAME, customerLastNameProperty, false),
new PluginProperty(AdyenPaymentPluginApi.PROPERTY_IP, customerIpProperty, false));
final UserData userData = UserDataMappingService.toUserData(null, pluginProperties);
assertEquals(userData.getShopperReference(), customerIdProperty);
assertEquals(userData.getShopperLocale().toString(), customerLocaleProperty);
assertEquals(userData.getShopperEmail(), customerEmailProperty);
assertEquals(userData.getFirstName(), customerFirstNameProperty);
assertEquals(userData.getLastName(), customerLastNameProperty);
assertEquals(userData.getShopperIP(), customerIpProperty);
}
示例12: testAuthorizeFailingInvalidCVV
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Test(groups = "slow")
public void testAuthorizeFailingInvalidCVV() throws Exception {
adyenPaymentPluginApi.addPaymentMethod(account.getId(), account.getPaymentMethodId(), adyenEmptyPaymentMethodPlugin(), true, propertiesWithCCInfo, context);
final Payment payment = TestUtils.buildPayment(account.getId(), account.getPaymentMethodId(), account.getCurrency(), killbillApi);
final PaymentTransaction authorizationTransaction = TestUtils.buildPaymentTransaction(payment, TransactionType.AUTHORIZE, new BigDecimal("1000"), account.getCurrency());
final PaymentTransactionInfoPlugin authorizationInfoPlugin = adyenPaymentPluginApi.authorizePayment(account.getId(),
payment.getId(),
authorizationTransaction.getId(),
account.getPaymentMethodId(),
authorizationTransaction.getAmount(),
authorizationTransaction.getCurrency(),
PluginProperties.buildPluginProperties(ImmutableMap.<String, String>of(AdyenPaymentPluginApi.PROPERTY_CC_VERIFICATION_VALUE, "1234")),
context);
assertEquals(authorizationInfoPlugin.getGatewayError(), "CVC Declined");
final List<PaymentTransactionInfoPlugin> fromDBList = adyenPaymentPluginApi.getPaymentInfo(account.getId(), payment.getId(), ImmutableList.<PluginProperty>of(), context);
assertFalse(fromDBList.isEmpty());
assertEquals(fromDBList.get(0).getGatewayError(), "CVC Declined");
}
示例13: testAuthorizeAndCaptureWithSplitSettlements
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Test(groups = "slow")
public void testAuthorizeAndCaptureWithSplitSettlements() throws Exception {
adyenPaymentPluginApi.addPaymentMethod(account.getId(), account.getPaymentMethodId(), adyenEmptyPaymentMethodPlugin(), true, propertiesWithCCInfo, context);
final ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
builder.put(AdyenPaymentPluginApi.PROPERTY_CC_VERIFICATION_VALUE, CC_VERIFICATION_VALUE);
builder.put(String.format("%s.1.amount", AdyenPaymentPluginApi.SPLIT_SETTLEMENT_DATA_ITEM), "3.51");
builder.put(String.format("%s.1.group", AdyenPaymentPluginApi.SPLIT_SETTLEMENT_DATA_ITEM), "MENSWEAR");
builder.put(String.format("%s.1.reference", AdyenPaymentPluginApi.SPLIT_SETTLEMENT_DATA_ITEM), UUID.randomUUID().toString());
builder.put(String.format("%s.1.type", AdyenPaymentPluginApi.SPLIT_SETTLEMENT_DATA_ITEM), "FOOTWEAR");
builder.put(String.format("%s.2.amount", AdyenPaymentPluginApi.SPLIT_SETTLEMENT_DATA_ITEM), "6.49");
builder.put(String.format("%s.2.group", AdyenPaymentPluginApi.SPLIT_SETTLEMENT_DATA_ITEM), "STREETWEAR");
builder.put(String.format("%s.2.reference", AdyenPaymentPluginApi.SPLIT_SETTLEMENT_DATA_ITEM), UUID.randomUUID().toString());
builder.put(String.format("%s.2.type", AdyenPaymentPluginApi.SPLIT_SETTLEMENT_DATA_ITEM), "HEADWEAR");
final Map<String, String> pluginPropertiesMap = builder.build();
final List<PluginProperty> pluginProperties = PluginProperties.buildPluginProperties(pluginPropertiesMap);
final Payment payment = doAuthorize(BigDecimal.TEN, pluginProperties);
doCapture(payment, BigDecimal.TEN);
}
示例14: testCancelExpiredPayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Test(groups = "slow")
public void testCancelExpiredPayment() throws Exception {
final Payment payment = triggerBuildFormDescriptor(ImmutableMap.<String, String>of(AdyenPaymentPluginApi.PROPERTY_CREATE_PENDING_PAYMENT, "true",
AdyenPaymentPluginApi.PROPERTY_AUTH_MODE, "true"),
TransactionType.AUTHORIZE);
final Period expirationPeriod = adyenConfigProperties.getPendingPaymentExpirationPeriod(null);
assertEquals(expirationPeriod.toString(), "P3D");
final Period preExpirationPeriod = expirationPeriod.minusMinutes(1);
clock.setDeltaFromReality(preExpirationPeriod.toStandardDuration().getMillis());
assertEquals(adyenPaymentPluginApi.getPaymentInfo(account.getId(), payment.getId(), Collections.<PluginProperty>emptyList(), context).get(0).getStatus(), PaymentPluginStatus.PENDING);
final Period postExpirationPeriod = expirationPeriod.plusMinutes(1);
clock.setDeltaFromReality(postExpirationPeriod.toStandardDuration().getMillis());
final List<PaymentTransactionInfoPlugin> transactions = adyenPaymentPluginApi.getPaymentInfo(account.getId(), payment.getId(), Collections.<PluginProperty>emptyList(), context);
final PaymentTransactionInfoPlugin canceledTransaction = transactions.get(0);
assertEquals(canceledTransaction.getStatus(), PaymentPluginStatus.CANCELED);
final PluginProperty updateMessage = PluginProperties.findPluginProperties("message", canceledTransaction.getProperties()).iterator().next();
assertEquals(updateMessage.getValue(), "Payment Expired - Cancelled by Janitor");
}
示例15: testCancelExpiredPayPalPayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Test(groups = "slow")
public void testCancelExpiredPayPalPayment() throws Exception {
final Payment payment = triggerBuildFormDescriptor(ImmutableMap.<String, String>of(AdyenPaymentPluginApi.PROPERTY_CREATE_PENDING_PAYMENT, "true",
AdyenPaymentPluginApi.PROPERTY_AUTH_MODE, "true"),
TransactionType.AUTHORIZE);
dao.updateResponse(payment.getTransactions().get(0).getId(), PaymentServiceProviderResult.PENDING, ImmutableList.<PluginProperty>of(new PluginProperty("paymentMethod", "paypal", false)), context.getTenantId());
final Period expirationPeriod = adyenConfigProperties.getPendingPaymentExpirationPeriod("paypal");
assertEquals(expirationPeriod.toString(), "P1D");
final Period preExpirationPeriod = expirationPeriod.minusMinutes(1);
clock.setDeltaFromReality(preExpirationPeriod.toStandardDuration().getMillis());
assertEquals(adyenPaymentPluginApi.getPaymentInfo(account.getId(), payment.getId(), Collections.<PluginProperty>emptyList(), context).get(0).getStatus(), PaymentPluginStatus.PENDING);
final Period postExpirationPeriod = expirationPeriod.plusMinutes(1);
clock.setDeltaFromReality(postExpirationPeriod.toStandardDuration().getMillis());
final List<PaymentTransactionInfoPlugin> transactions = adyenPaymentPluginApi.getPaymentInfo(account.getId(), payment.getId(), Collections.<PluginProperty>emptyList(), context);
final PaymentTransactionInfoPlugin canceledTransaction = transactions.get(0);
assertEquals(canceledTransaction.getStatus(), PaymentPluginStatus.CANCELED);
final PluginProperty updateMessage = PluginProperties.findPluginProperties("message", canceledTransaction.getProperties()).iterator().next();
assertEquals(updateMessage.getValue(), "Payment Expired - Cancelled by Janitor");
}