public static CreatePaymentAuthorization ( APIContext apiContext ) : |
||
apiContext | APIContext | |
Результат |
public void CaptureRefundTest() { try { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorization = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); var cap = new Capture(); var amnt = new Amount(); amnt.total = "1"; amnt.currency = "USD"; cap.amount = amnt; var response = authorization.Capture(TestingUtil.GetApiContext(), cap); var fund = new Refund(); var refundAmount = new Amount(); refundAmount.total = "1"; refundAmount.currency = "USD"; fund.amount = refundAmount; var responseRefund = response.Refund(TestingUtil.GetApiContext(), fund); Assert.AreEqual("completed", responseRefund.state); } finally { TestingUtil.RecordConnectionDetails(); } }
public void RefundIdTest() { try { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorization = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); var cap = new Capture(); var amt = new Amount(); amt.total = "1"; amt.currency = "USD"; cap.amount = amt; var response = authorization.Capture(TestingUtil.GetApiContext(), cap); var fund = new Refund(); var refundAmount = new Amount(); refundAmount.total = "1"; refundAmount.currency = "USD"; fund.amount = refundAmount; var responseRefund = response.Refund(TestingUtil.GetApiContext(), fund); var retrievedRefund = Refund.Get(TestingUtil.GetApiContext(), responseRefund.id); Assert.AreEqual(responseRefund.id, retrievedRefund.id); } catch (ConnectionException ex) { TestingUtil.WriteConnectionExceptionDetails(ex); throw; } }
public void AuthorizationGetTest() { try { var apiContext = TestingUtil.GetApiContext(); this.RecordConnectionDetails(); var pay = PaymentTest.CreatePaymentAuthorization(apiContext); this.RecordConnectionDetails(); Assert.NotNull(pay); Assert.NotNull(pay.transactions); Assert.True(pay.transactions.Count > 0); var transaction = pay.transactions[0]; Assert.NotNull(transaction.related_resources); Assert.True(transaction.related_resources.Count > 0); var resource = transaction.related_resources[0]; Assert.NotNull(resource.authorization); var authorizationId = resource.authorization.id; var authorize = Authorization.Get(apiContext, authorizationId); this.RecordConnectionDetails(); Assert.Equal(authorizationId, authorize.id); } catch (ConnectionException) { this.RecordConnectionDetails(false); throw; } }
public void AuthorizationVoidTest() { try { var apiContext = TestingUtil.GetApiContext(); this.RecordConnectionDetails(); var pay = PaymentTest.CreatePaymentAuthorization(apiContext); this.RecordConnectionDetails(); Assert.IsNotNull(pay); Assert.IsNotNull(pay.transactions); Assert.IsTrue(pay.transactions.Count > 0); var transaction = pay.transactions[0]; Assert.IsNotNull(transaction.related_resources); Assert.IsTrue(transaction.related_resources.Count > 0); var resource = transaction.related_resources[0]; Assert.IsNotNull(resource.authorization); var authorize = Authorization.Get(apiContext, resource.authorization.id); this.RecordConnectionDetails(); var authorizationResponse = authorize.Void(apiContext); this.RecordConnectionDetails(); Assert.AreEqual("voided", authorizationResponse.state); } catch (ConnectionException) { this.RecordConnectionDetails(false); throw; } }
public void RefundIdTest() { try { var apiContext = TestingUtil.GetApiContext(); this.RecordConnectionDetails(); var pay = PaymentTest.CreatePaymentAuthorization(apiContext); this.RecordConnectionDetails(); Assert.IsNotNull(pay); Assert.IsNotNull(pay.transactions); Assert.IsTrue(pay.transactions.Count > 0); var transaction = pay.transactions[0]; Assert.IsNotNull(transaction.related_resources); Assert.IsTrue(transaction.related_resources.Count > 0); var resource = transaction.related_resources[0]; Assert.IsNotNull(resource.authorization); var authorization = Authorization.Get(apiContext, resource.authorization.id); this.RecordConnectionDetails(); var cap = new Capture { amount = new Amount { total = "1", currency = "USD" } }; var response = authorization.Capture(apiContext, cap); this.RecordConnectionDetails(); var fund = new Refund { amount = new Amount { total = "1", currency = "USD" } }; apiContext.ResetRequestId(); var responseRefund = response.Refund(apiContext, fund); this.RecordConnectionDetails(); var retrievedRefund = Refund.Get(apiContext, responseRefund.id); this.RecordConnectionDetails(); Assert.AreEqual(responseRefund.id, retrievedRefund.id); } catch (ConnectionException) { this.RecordConnectionDetails(false); throw; } }
public void AuthorizationGetTest() { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorize = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); Assert.AreEqual(authorizationId, authorize.id); }
public void AuthorizationVoidTest() { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorize = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); var authorizationResponse = authorize.Void(TestingUtil.GetApiContext()); Assert.AreEqual("voided", authorizationResponse.state); }
public void AuthorizationCaptureTest() { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorize = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); var cap = new Capture(); var amt = new Amount(); amt.total = "1"; amt.currency = "USD"; cap.amount = amt; var response = authorize.Capture(TestingUtil.GetApiContext(), cap); Assert.AreEqual("completed", response.state); }
public void AuthorizationGetTest() { try { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorize = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); Assert.AreEqual(authorizationId, authorize.id); } catch (ConnectionException ex) { TestingUtil.WriteConnectionExceptionDetails(ex); throw; } }
public void CaptureIdTest() { try { var apiContext = TestingUtil.GetApiContext(); this.RecordConnectionDetails(); var pay = PaymentTest.CreatePaymentAuthorization(apiContext); this.RecordConnectionDetails(); Assert.NotNull(pay); Assert.NotNull(pay.transactions); Assert.True(pay.transactions.Count > 0); var transaction = pay.transactions[0]; Assert.NotNull(transaction.related_resources); Assert.True(transaction.related_resources.Count > 0); var resource = transaction.related_resources[0]; Assert.NotNull(resource.authorization); var authorization = Authorization.Get(apiContext, resource.authorization.id); this.RecordConnectionDetails(); var cap = new Capture { amount = new Amount { total = "1", currency = "USD" } }; var responseCapture = authorization.Capture(apiContext, cap); this.RecordConnectionDetails(); Assert.NotNull(responseCapture); var returnCapture = Capture.Get(apiContext, responseCapture.id); this.RecordConnectionDetails(); Assert.Equal(responseCapture.id, returnCapture.id); } catch (ConnectionException) { this.RecordConnectionDetails(false); throw; } }
public void CaptureIdTest() { try { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorization = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); var cap = new Capture(); var amt = new Amount(); amt.total = "1"; amt.currency = "USD"; cap.amount = amt; var responseCapture = authorization.Capture(TestingUtil.GetApiContext(), cap); var returnCapture = Capture.Get(TestingUtil.GetApiContext(), responseCapture.id); Assert.AreEqual(responseCapture.id, returnCapture.id); } finally { TestingUtil.RecordConnectionDetails(); } }