Examples of Payment


Examples of org.jboss.seam.example.seampay.Payment

   
    @Test
    public void testPayMultiple() {
        PaymentProcessor processor = new PaymentProcessor();
       
        Payment payment = createTestPayment(new BigDecimal("100"), Frequency.WEEKLY);

        assert payment.getAccount().getBalance().equals(INITIAL_BALANCE);

        processor.processPayment(payment);
              
        assert payment.getAccount().getBalance().equals(new BigDecimal("900"));
        assert payment.getActive();
        assert payment.getLastPaid() != null;
       
        Date firstPayment = payment.getLastPaid();
       
        pause(); // just need to make sure we are some small time in the future
       
        processor.processPayment(payment);
    
        assert payment.getAccount().getBalance().equals(new BigDecimal("800"));
        assert payment.getActive();
        assert payment.getLastPaid().after(firstPayment);
    }
View Full Code Here

Examples of org.jboss.seam.example.seampay.Payment

    protected Payment createTestPayment(BigDecimal amount, Frequency frequency) {
        Account account = new Account();
        account.setAccountNumber(ACCOUNT_NUMBER);
        setField(account, "balance", INITIAL_BALANCE);
       
        Payment payment = new Payment();
        payment.setAccount(account);
        payment.setAmount(amount);
        payment.setPaymentFrequency(frequency);       
       
        return payment;
    }
View Full Code Here

Examples of org.jboss.seam.example.seampay.Payment

                Account account = (Account) getValue("#{selectedAccount}");
                assert account !=null;
                assert account.getId() == 1;
                assert account.getPayments().size() == 0;
              
                Payment payment = (Payment) getValue("#{newPayment}");
                assert payment.getPayee().equals("Somebody");
                assert payment.getAccount() != null;
                assert payment.getAccount().getId() == 1;
               
            }           
        }.run();
       
       
        new FacesRequest("/search.xhtml", id) {
            @Override
            protected void beforeRequest() {
                setParameter("accountId", "1");
            }
           
            @Override
            protected void applyRequestValues() throws Exception {
                setValue("#{newPayment.payee}", "IRS");
                setValue("#{newPayment.amount}", new BigDecimal("100.00"));
                setValue("#{newPayment.paymentFrequency}", Frequency.ONCE);
            }

            @Override
            protected void invokeApplication() throws Exception {
                invokeMethod("#{paymentHome.saveAndSchedule}");
            }

            @Override
            protected void renderResponse() throws Exception {
                assert ((Boolean)getValue("#{accountHome.idDefined}"));               
                Account account = (Account) getValue("#{selectedAccount}");               
                assert account !=null;
                assert account.getId() == 1;
                assert account.getPayments().size() == 1;              
               
                Payment payment = (Payment) getValue("#{newPayment}");
                assert payment.getPayee().equals("IRS");
                assert payment.getAmount().equals(new BigDecimal("100.00"));
                assert payment.getAccount() != null;
                assert payment.getAccount().getId() == 1;
            }           
        }.run();
       
       
        // test that the payment is around
View Full Code Here

Examples of pl.com.bottega.ecommerce.sales.domain.payment.Payment

    purchaseRepository.save(purchase);//Aggregate must be managed by persistence context before firing events (synchronous listeners may need to load it)
   
    /*
     * Sample model where one aggregate creates another. Client does not manage payment lifecycle, therefore application must manage it.
     */
    Payment payment = client.charge(purchase.getTotalCost());
    paymentRepository.save(payment);
   
    purchase.confirm()
    reservation.close();       
   
View Full Code Here

Examples of securepay.jxa.api.Payment

        }

        GenericValue creditCard = (GenericValue) context.get("creditCard");
        String expiryDate = (String) creditCard.get("expireDate");
        String cardSecurityCode = (String) context.get("cardSecurityCode");
        Payment payment = new Payment();
        payment.setServerURL(serverURL);
        payment.setProcessTimeout(Integer.valueOf(processtimeout));
        payment.setMerchantId(merchantId);

        Txn txn = payment.addTxn(10, orderId);
        txn.setTxnSource(8);
        txn.setAmount(Integer.toString(amont));
        if (UtilValidate.isNotEmpty(currency)) {
            txn.setCurrencyCode(currency);
        } else {
            txn.setCurrencyCode("AUD");
        }

        txn.setCardNumber((String) creditCard.get("cardNumber"));
        txn.setExpiryDate(expiryDate.substring(0, 3) + expiryDate.substring(5));
        if (UtilValidate.isNotEmpty(cardSecurityCode)) {
            txn.setCVV(cardSecurityCode);
        }
        // Send payment to SecurePay for processing
        boolean processed = payment.process(pwd);

        Map<String, Object> result = ServiceUtil.returnSuccess();
        if (UtilValidate.isEmpty(processed)) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                    "AccountingSecurityPayPaymentWasNotSent", locale));
        } else {
            if (payment.getCount() == 1) {
                Txn resp = payment.getTxn(0);
                boolean approved = resp.getApproved();
                if (approved == false){
                    result.put("authResult", new Boolean(false));
                    result.put("authRefNum", "N/A");
                    result.put("processAmount", BigDecimal.ZERO);
View Full Code Here

Examples of securepay.jxa.api.Payment

            amont = newAmount.intValue();
        } else {
            amont = newAmount.multiply(multiplyAmount).intValue();
        }

        Payment payment = new Payment();
        payment.setServerURL(serverURL);
        payment.setProcessTimeout(Integer.valueOf(processtimeout));
        payment.setMerchantId(merchantId);
        Txn txn = payment.addTxn(11, (String) orderPaymentPreference.get("orderId"));
        txn.setTxnSource(8);
        txn.setAmount(Integer.toString(amont));
        txn.setPreauthId(authTransaction.getString("referenceNum"));

        // Send payment to SecurePay for processing
        boolean processed = payment.process(pwd);

        Map<String, Object> result = ServiceUtil.returnSuccess();
        if (UtilValidate.isEmpty(processed)) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                    "AccountingSecurityPayPaymentWasNotSent", locale));
        } else {
            if (payment.getCount() == 1){
                Txn resp = payment.getTxn(0);
                boolean approved = resp.getApproved();
                if (approved == false){
                    result.put("captureResult", false);
                    result.put("captureRefNum", authTransaction.getString("referenceNum"));
                    result.put("captureAmount", BigDecimal.ZERO);
View Full Code Here

Examples of securepay.jxa.api.Payment

            amont = newAmount.intValue();
        } else {
            amont = newAmount.multiply(multiplyAmount).intValue();
        }

        Payment payment = new Payment();
        payment.setServerURL(serverURL);
        payment.setProcessTimeout(Integer.valueOf(processtimeout));
        payment.setMerchantId(merchantId);
        Txn txn = payment.addTxn(6, (String) orderPaymentPreference.get("orderId"));
        txn.setTxnSource(8);
        txn.setAmount(Integer.toString(amont));
        txn.setTxnId(authTransaction.getString("referenceNum"));

        // Send payment to SecurePay for processing
        boolean processed = payment.process(pwd);

        Map<String, Object> result = ServiceUtil.returnSuccess();
        if (UtilValidate.isEmpty(processed)) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                    "AccountingSecurityPayPaymentWasNotSent", locale));
        } else {
            if (payment.getCount() == 1){
                Txn resp = payment.getTxn(0);
                boolean approved = resp.getApproved();
                if (approved == false){
                    result.put("releaseResult", false);
                    result.put("releaseRefNum", authTransaction.getString("referenceNum"));
                    result.put("releaseAmount", BigDecimal.ZERO);
View Full Code Here

Examples of securepay.jxa.api.Payment

            amont = newAmount.intValue();
        } else {
            amont = newAmount.multiply(multiplyAmount).intValue();
        }

        Payment payment = new Payment();
        payment.setServerURL(serverURL);
        payment.setProcessTimeout(Integer.valueOf(processtimeout));
        payment.setMerchantId(merchantId);
        Txn txn = payment.addTxn(4, (String) orderPaymentPreference.get("orderId"));
        txn.setTxnSource(8);
        txn.setAmount(Integer.toString(amont));
        txn.setTxnId(referenceNum);

        // Send payment to SecurePay for processing
        boolean processed = payment.process(pwd);

        Map<String, Object> result = ServiceUtil.returnSuccess();
        if (UtilValidate.isEmpty(processed)) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                    "AccountingSecurityPayPaymentWasNotSent", locale));
        } else {
            if (payment.getCount() == 1){
                Txn resp = payment.getTxn(0);
                boolean approved = resp.getApproved();
                if (approved == false){
                    result.put("refundResult", false);
                    result.put("refundRefNum", authTransaction.getString("referenceNum"));
                    result.put("refundAmount", BigDecimal.ZERO);
View Full Code Here

Examples of securepay.jxa.api.Payment

        } else {
            amont = newAmount.multiply(multiplyAmount).intValue();
        }

        GenericValue creditCard = (GenericValue) context.get("creditCard");
        Payment payment = new Payment();
        payment.setServerURL(serverURL);
        payment.setProcessTimeout(Integer.valueOf(processtimeout));
        payment.setMerchantId(merchantId);

        Txn txn = payment.addTxn(0, referenceCode);
        txn.setTxnSource(8);
        txn.setAmount(Integer.toString(amont));
        txn.setCardNumber((String) creditCard.get("cardNumber"));
        String expiryDate = (String) creditCard.get("expireDate");
        txn.setExpiryDate(expiryDate.substring(0, 3) + expiryDate.substring(5));
        if (UtilValidate.isNotEmpty(cardSecurityCode)) {
            txn.setCVV(cardSecurityCode);
        }

        // Send payment to SecurePay for processing
        boolean processed = payment.process(pwd);

        Map<String, Object> result = ServiceUtil.returnSuccess();
        if (UtilValidate.isEmpty(processed)) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                    "AccountingSecurityPayPaymentWasNotSent", locale));
        } else {
            if (payment.getCount() == 1) {
                Txn resp = payment.getTxn(0);
                boolean approved = resp.getApproved();
                if (approved == false){
                    result.put("creditResult", false);
                    result.put("creditRefNum", "N/A");
                    result.put("creditAmount", BigDecimal.ZERO);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.