本文整理汇总了Java中org.killbill.billing.payment.api.PluginProperty类的典型用法代码示例。如果您正苦于以下问题:Java PluginProperty类的具体用法?Java PluginProperty怎么用?Java PluginProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginProperty类属于org.killbill.billing.payment.api包,在下文中一共展示了PluginProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:19,代码来源:AdyenPaymentTransactionInfoPlugin.java
示例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;
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:17,代码来源:AdyenPaymentPluginApi.java
示例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);
}
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:18,代码来源:AdyenPaymentPluginApi.java
示例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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:21,代码来源:AdyenPaymentPluginApi.java
示例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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:20,代码来源:AdyenPaymentPluginApi.java
示例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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:22,代码来源:AdyenPaymentPluginApi.java
示例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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:20,代码来源:AdyenPaymentPluginApi.java
示例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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:20,代码来源:AdyenPaymentPluginApi.java
示例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);
}
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:21,代码来源:AdyenPaymentPluginApi.java
示例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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:21,代码来源:AdyenPaymentPluginApi.java
示例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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:26,代码来源:UserDataMappingServiceTest.java
示例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");
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:22,代码来源:TestAdyenPaymentPluginApi.java
示例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);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:21,代码来源:TestAdyenPaymentPluginApi.java
示例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");
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:23,代码来源:TestAdyenPaymentPluginApiHPP.java
示例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");
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:25,代码来源:TestAdyenPaymentPluginApiHPP.java
示例16: testCancelExpiredPayPalPaymentNoNotification
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Test(groups = "slow")
public void testCancelExpiredPayPalPaymentNoNotification() throws Exception {
final Payment payment = triggerBuildFormDescriptor(ImmutableMap.<String, String>of(AdyenPaymentPluginApi.PROPERTY_CREATE_PENDING_PAYMENT, "true",
AdyenPaymentPluginApi.PROPERTY_AUTH_MODE, "true",
AdyenPaymentPluginApi.PROPERTY_BRAND_CODE, "paypal"),
TransactionType.AUTHORIZE);
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");
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:25,代码来源:TestAdyenPaymentPluginApiHPP.java
示例17: testCancelExpiredBoletoPayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Test(groups = "slow")
public void testCancelExpiredBoletoPayment() 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", "boletobancario_santander", false)), context.getTenantId());
final Period expirationPeriod = adyenConfigProperties.getPendingPaymentExpirationPeriod("boletobancario_santander");
assertEquals(expirationPeriod.toString(), "P7D");
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");
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:25,代码来源:TestAdyenPaymentPluginApiHPP.java
示例18: verifyPayment
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
private void verifyPayment(final TransactionType transactionType) throws SQLException, PaymentPluginApiException, PaymentApiException {
final List<Payment> accountPayments = killbillApi.getPaymentApi().getAccountPayments(account.getId(), false, false, ImmutableList.<PluginProperty>of(), context);
assertEquals(accountPayments.size(), 1);
final Payment payment = accountPayments.get(0);
final List<AdyenResponsesRecord> responses = dao.getResponses(payment.getId(), context.getTenantId());
// Unlike 3D-S redirects which have two rows (2 calls to Adyen), we only have one row per HPP call
assertEquals(responses.size(), 1);
// After the redirect or processing the notification, we updated the psp_result
assertEquals(responses.get(0).getPspResult(), PaymentServiceProviderResult.AUTHORISED.getResponses()[0]);
final List<PaymentTransactionInfoPlugin> processedPaymentTransactions = adyenPaymentPluginApi.getPaymentInfo(payment.getAccountId(), payment.getId(), ImmutableList.<PluginProperty>of(), context);
assertEquals(processedPaymentTransactions.size(), 1);
assertEquals(processedPaymentTransactions.get(0).getTransactionType(), transactionType);
assertEquals(processedPaymentTransactions.get(0).getStatus(), PaymentPluginStatus.PROCESSED);
assertEquals(processedPaymentTransactions.get(0).getFirstPaymentReferenceId(), pspReference);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:18,代码来源:TestAdyenPaymentPluginApiHPP.java
示例19: testAuthorizeWithIncorrectValues
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
/**
* Sanity check that a refused purchase (wrong cc data) still results in an error.
*/
@Test(groups = "slow")
public void testAuthorizeWithIncorrectValues() throws Exception {
final String expectedGatewayError = "CVC Declined";
final Account account = defaultAccount();
final OSGIKillbillAPI killbillAPI = TestUtils.buildOSGIKillbillAPI(account);
final Payment payment = killBillPayment(account, killbillAPI);
final AdyenCallContext callContext = newCallContext();
final AdyenPaymentPluginApi pluginApi = AdyenPluginMockBuilder.newPlugin()
.withAccount(account)
.withOSGIKillbillAPI(killbillAPI)
.withDatabaseAccess(dao)
.build();
final PaymentTransactionInfoPlugin result = authorizeCall(account, payment, callContext, pluginApi, invalidCreditCardData(AdyenPaymentPluginApi.PROPERTY_CC_VERIFICATION_VALUE, String.valueOf("1234")));
assertEquals(result.getStatus(), PaymentPluginStatus.ERROR);
assertEquals(result.getGatewayError(), expectedGatewayError);
assertNull(result.getGatewayErrorCode());
final List<PaymentTransactionInfoPlugin> results = pluginApi.getPaymentInfo(account.getId(), payment.getId(), ImmutableList.<PluginProperty>of(), callContext);
assertEquals(results.size(), 1);
assertEquals(results.get(0).getStatus(), PaymentPluginStatus.ERROR);
assertEquals(results.get(0).getGatewayError(), expectedGatewayError);
assertNull(results.get(0).getGatewayErrorCode());
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:29,代码来源:TestAdyenPaymentPluginHttpErrors.java
示例20: testAuthorizeWithInvalidValues
import org.killbill.billing.payment.api.PluginProperty; //导入依赖的package包/类
@Test(groups = "slow", enabled=false)
public void testAuthorizeWithInvalidValues() throws Exception {
final String expectedGatewayError = "validation Expiry month should be between 1 and 12 inclusive Card";
final String expectedGatewayErrorCode = "o.a.cxf.binding.soap.SoapFault";
final Account account = defaultAccount();
final OSGIKillbillAPI killbillAPI = TestUtils.buildOSGIKillbillAPI(account);
final Payment payment = killBillPayment(account, killbillAPI);
final AdyenCallContext callContext = newCallContext();
final AdyenPaymentPluginApi pluginApi = AdyenPluginMockBuilder.newPlugin()
.withAccount(account)
.withOSGIKillbillAPI(killbillAPI)
.withDatabaseAccess(dao)
.build();
final PaymentTransactionInfoPlugin result = authorizeCall(account, payment, callContext, pluginApi, invalidCreditCardData(AdyenPaymentPluginApi.PROPERTY_CC_EXPIRATION_MONTH, String.valueOf("123")));
assertEquals(result.getStatus(), PaymentPluginStatus.CANCELED);
assertEquals(result.getGatewayError(), expectedGatewayError);
assertEquals(result.getGatewayErrorCode(), expectedGatewayErrorCode);
final List<PaymentTransactionInfoPlugin> results = pluginApi.getPaymentInfo(account.getId(), payment.getId(), ImmutableList.<PluginProperty>of(), callContext);
assertEquals(results.size(), 1);
assertEquals(results.get(0).getStatus(), PaymentPluginStatus.CANCELED);
assertEquals(results.get(0).getGatewayError(), expectedGatewayError);
assertEquals(results.get(0).getGatewayErrorCode(), expectedGatewayErrorCode);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:27,代码来源:TestAdyenPaymentPluginHttpErrors.java
注:本文中的org.killbill.billing.payment.api.PluginProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论