示例#1
0
        public async Task CanCreatePaymentWithCustomMetaDataClass()
        {
            // If: We create a payment with meta data
            CustomMetadataClass metadataRequest = new CustomMetadataClass()
            {
                OrderId     = 1,
                Description = "Custom description"
            };

            PaymentRequest paymentRequest = new PaymentRequest()
            {
                Amount      = new Amount(Currency.EUR, "100.00"),
                Description = "Description",
                RedirectUrl = this.DefaultRedirectUrl,
            };

            paymentRequest.SetMetadata(metadataRequest);

            // When: We send the payment request to Mollie
            PaymentResponse result = await this._paymentClient.CreatePaymentAsync(paymentRequest);

            CustomMetadataClass metadataResponse = result.GetMetadata <CustomMetadataClass>();

            // Then: Make sure we get the same json result as metadata
            Assert.IsNotNull(metadataResponse);
            Assert.AreEqual(metadataRequest.OrderId, metadataResponse.OrderId);
            Assert.AreEqual(metadataRequest.Description, metadataResponse.Description);
        }